Bug 1316529. Part 1 - Remove TaskQueue::mIsFlushing. r=froydnj
authorJW Wang <jwwang@mozilla.com>
Thu, 10 Nov 2016 15:28:48 +0800
changeset 438327 a467ab284fd5d7201990fbc06313196253c76836
parent 438326 361dfd9071b639d1297286cdbe3dc390e1d96d90
child 438328 a5c6e3c69ef2d105505c560105de5249e470a626
push id35679
push userbmo:timdream@gmail.com
push dateMon, 14 Nov 2016 09:29:38 +0000
reviewersfroydnj
bugs1316529
milestone52.0a1
Bug 1316529. Part 1 - Remove TaskQueue::mIsFlushing. r=froydnj MozReview-Commit-ID: 3x4OO7B2htB
xpcom/threads/TaskQueue.cpp
xpcom/threads/TaskQueue.h
--- a/xpcom/threads/TaskQueue.cpp
+++ b/xpcom/threads/TaskQueue.cpp
@@ -65,17 +65,16 @@ NS_IMPL_ISUPPORTS(TaskQueue::EventTarget
 TaskQueue::TaskQueue(already_AddRefed<nsIEventTarget> aTarget,
                      bool aRequireTailDispatch)
   : AbstractThread(aRequireTailDispatch)
   , mTarget(aTarget)
   , mQueueMonitor("TaskQueue::Queue")
   , mTailDispatcher(nullptr)
   , mIsRunning(false)
   , mIsShutdown(false)
-  , mIsFlushing(false)
 {
   MOZ_COUNT_CTOR(TaskQueue);
 }
 
 TaskQueue::~TaskQueue()
 {
   MonitorAutoLock mon(mQueueMonitor);
   MOZ_ASSERT(mIsShutdown);
@@ -99,19 +98,16 @@ TaskQueue::DispatchLocked(nsCOMPtr<nsIRu
 {
   AbstractThread* currentThread;
   if (aReason != TailDispatch && (currentThread = GetCurrent()) && RequiresTailDispatch(currentThread)) {
     currentThread->TailDispatcher().AddTask(this, aRunnable.forget(), aFailureHandling);
     return NS_OK;
   }
 
   mQueueMonitor.AssertCurrentThreadOwns();
-  if (mIsFlushing && aMode == AbortIfFlushing) {
-    return NS_ERROR_ABORT;
-  }
   if (mIsShutdown) {
     return NS_ERROR_FAILURE;
   }
   mTasks.push(aRunnable.forget());
   if (mIsRunning) {
     return NS_OK;
   }
   RefPtr<nsIRunnable> runner(new Runner(this));
--- a/xpcom/threads/TaskQueue.h
+++ b/xpcom/threads/TaskQueue.h
@@ -184,19 +184,16 @@ protected:
   // True if we've dispatched an event to the target to execute events from
   // the queue.
   bool mIsRunning;
 
   // True if we've started our shutdown process.
   bool mIsShutdown;
   MozPromiseHolder<ShutdownPromise> mShutdownPromise;
 
-  // True if we're flushing; we reject new tasks if we're flushing.
-  bool mIsFlushing;
-
   class Runner : public Runnable {
   public:
     explicit Runner(TaskQueue* aQueue)
       : mQueue(aQueue)
     {
     }
     NS_IMETHOD Run() override;
   private: