Bug 1316529. Part 2 - remove TaskQueue::DispatchMode. r=froydnj
authorJW Wang <jwwang@mozilla.com>
Thu, 10 Nov 2016 15:34:35 +0800
changeset 352270 a5c6e3c69ef2d105505c560105de5249e470a626
parent 352269 a467ab284fd5d7201990fbc06313196253c76836
child 352271 bf09a2e3fb6b97636484eb81af709790b6a4d60e
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1316529
milestone52.0a1
Bug 1316529. Part 2 - remove TaskQueue::DispatchMode. r=froydnj MozReview-Commit-ID: 5F2OHCpxx7K
xpcom/threads/TaskQueue.cpp
xpcom/threads/TaskQueue.h
--- a/xpcom/threads/TaskQueue.cpp
+++ b/xpcom/threads/TaskQueue.cpp
@@ -34,17 +34,16 @@ public:
   }
 
   NS_IMETHOD
   Dispatch(already_AddRefed<nsIRunnable> aEvent, uint32_t aFlags) override
   {
     nsCOMPtr<nsIRunnable> runnable = aEvent;
     MonitorAutoLock mon(mTaskQueue->mQueueMonitor);
     return mTaskQueue->DispatchLocked(/* passed by ref */runnable,
-                                      AbortIfFlushing,
                                       DontAssertDispatchSuccess,
                                       NormalDispatch);
   }
 
   NS_IMETHOD
   DelayedDispatch(already_AddRefed<nsIRunnable>, uint32_t aFlags) override
   {
     return NS_ERROR_NOT_IMPLEMENTED;
@@ -88,17 +87,17 @@ TaskQueue::TailDispatcher()
   MOZ_ASSERT(mTailDispatcher);
   return *mTailDispatcher;
 }
 
 // Note aRunnable is passed by ref to support conditional ownership transfer.
 // See Dispatch() in TaskQueue.h for more details.
 nsresult
 TaskQueue::DispatchLocked(nsCOMPtr<nsIRunnable>& aRunnable,
-                          DispatchMode aMode, DispatchFailureHandling aFailureHandling,
+                          DispatchFailureHandling aFailureHandling,
                           DispatchReason aReason)
 {
   AbstractThread* currentThread;
   if (aReason != TailDispatch && (currentThread = GetCurrent()) && RequiresTailDispatch(currentThread)) {
     currentThread->TailDispatcher().AddTask(this, aRunnable.forget(), aFailureHandling);
     return NS_OK;
   }
 
--- a/xpcom/threads/TaskQueue.h
+++ b/xpcom/threads/TaskQueue.h
@@ -59,17 +59,17 @@ public:
 
   void Dispatch(already_AddRefed<nsIRunnable> aRunnable,
                 DispatchFailureHandling aFailureHandling = AssertDispatchSuccess,
                 DispatchReason aReason = NormalDispatch) override
   {
     nsCOMPtr<nsIRunnable> r = aRunnable;
     {
       MonitorAutoLock mon(mQueueMonitor);
-      nsresult rv = DispatchLocked(/* passed by ref */r, AbortIfFlushing, aFailureHandling, aReason);
+      nsresult rv = DispatchLocked(/* passed by ref */r, aFailureHandling, aReason);
       MOZ_DIAGNOSTIC_ASSERT(aFailureHandling == DontAssertDispatchSuccess || NS_SUCCEEDED(rv));
       Unused << rv;
     }
     // If the ownership of |r| is not transferred in DispatchLocked() due to
     // dispatch failure, it will be deleted here outside the lock. We do so
     // since the destructor of the runnable might access TaskQueue and result
     // in deadlocks.
   }
@@ -104,20 +104,17 @@ protected:
   virtual ~TaskQueue();
 
 
   // Blocks until all task finish executing. Called internally by methods
   // that need to wait until the task queue is idle.
   // mQueueMonitor must be held.
   void AwaitIdleLocked();
 
-  enum DispatchMode { AbortIfFlushing, IgnoreFlushing };
-
   nsresult DispatchLocked(nsCOMPtr<nsIRunnable>& aRunnable,
-                          DispatchMode aMode,
                           DispatchFailureHandling aFailureHandling,
                           DispatchReason aReason = NormalDispatch);
 
   void MaybeResolveShutdown()
   {
     mQueueMonitor.AssertCurrentThreadOwns();
     if (mIsShutdown && !mIsRunning) {
       mShutdownPromise.ResolveIfExists(true, __func__);