Bug 1202667 - make TaskQueue task running slightly more efficient; r=mccr8
authorNathan Froyd <froydnj@mozilla.com>
Mon, 07 Sep 2015 20:02:16 -0400
changeset 261438 fe19d71aae51324e6babf07ad9eac0bea843c2f6
parent 261437 348b09b8d6439b13be42b0dabf3afa60866bcf7b
child 261439 7364ae67d69e4b0579de19296f354f0fef26335f
push id29345
push usercbook@mozilla.com
push dateWed, 09 Sep 2015 12:06:02 +0000
treeherdermozilla-central@dd9e40b46959 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1202667
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1202667 - make TaskQueue task running slightly more efficient; r=mccr8 We can transfer the reference out of the queue of runnables instead of taking a new reference right before we drop the old one.
xpcom/threads/TaskQueue.cpp
--- a/xpcom/threads/TaskQueue.cpp
+++ b/xpcom/threads/TaskQueue.cpp
@@ -150,17 +150,17 @@ TaskQueue::Runner::Run()
     MonitorAutoLock mon(mQueue->mQueueMonitor);
     MOZ_ASSERT(mQueue->mIsRunning);
     if (mQueue->mTasks.size() == 0) {
       mQueue->mIsRunning = false;
       mQueue->MaybeResolveShutdown();
       mon.NotifyAll();
       return NS_OK;
     }
-    event = mQueue->mTasks.front();
+    event = mQueue->mTasks.front().forget();
     mQueue->mTasks.pop();
   }
   MOZ_ASSERT(event);
 
   // Note that dropping the queue monitor before running the task, and
   // taking the monitor again after the task has run ensures we have memory
   // fences enforced. This means that if the object we're calling wasn't
   // designed to be threadsafe, it will be, provided we're only calling it