Bug 1588241 - P1. Use move semantics with PrependEvent. r=mattwoodrow

PrepentEvent was already moving the argument passed by reference. This makes it clear that the object will be moved.

Differential Revision: https://phabricator.services.mozilla.com/D52260

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jean-Yves Avenard 2019-11-15 02:41:59 +00:00
Родитель c7abcdb2c6
Коммит 801075cd07
3 изменённых файлов: 4 добавлений и 5 удалений

Просмотреть файл

@ -75,7 +75,7 @@ void ChannelEventQueue::FlushQueue() {
// Next event needs to run on another thread. Put it back to
// the front of the queue can try resume on that thread.
Suspend();
PrependEvent(event);
PrependEvent(std::move(event));
needResumeOnOtherThread = true;
{

Просмотреть файл

@ -102,7 +102,7 @@ class ChannelEventQueue final {
bool aAssertionWhenNotQueued = false);
// Append ChannelEvent in front of the event queue.
inline nsresult PrependEvent(UniquePtr<ChannelEvent>& aEvent);
inline nsresult PrependEvent(UniquePtr<ChannelEvent>&& aEvent);
inline nsresult PrependEvents(nsTArray<UniquePtr<ChannelEvent>>& aEvents);
// After StartForcedQueueing is called, RunOrEnqueue() will start enqueuing
@ -231,7 +231,7 @@ inline void ChannelEventQueue::EndForcedQueueing() {
}
inline nsresult ChannelEventQueue::PrependEvent(
UniquePtr<ChannelEvent>& aEvent) {
UniquePtr<ChannelEvent>&& aEvent) {
MutexAutoLock lock(mMutex);
// Prepending event while no queue flush foreseen might cause the following

Просмотреть файл

@ -3777,8 +3777,7 @@ void HttpChannelChild::CancelOnMainThread(nsresult aRv) {
// Cancel is expected to preempt any other channel events, thus we put this
// event in the front of mEventQ to make sure nsIStreamListener not receiving
// any ODA/OnStopRequest callbacks.
UniquePtr<ChannelEvent> cancelEvent = MakeUnique<CancelEvent>(this, aRv);
mEventQ->PrependEvent(cancelEvent);
mEventQ->PrependEvent(MakeUnique<CancelEvent>(this, aRv));
mEventQ->Resume();
}