bug 1529399 remove now-unnecessary aDrainDirectTasks parameter from EventTargetWrapper::Runner constructor r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Mon, 25 Feb 2019 10:50:02 +0000
changeset 518869 3740242a0860d26b10940d38f9440a3c85185c44
parent 518868 2051c2dbfeda3d801446d6c5b6ab25d7f1586e06
child 518870 bda89c19aff646fdec451217bb418d225c0cee4b
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1529399
milestone67.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 1529399 remove now-unnecessary aDrainDirectTasks parameter from EventTargetWrapper::Runner constructor r=padenot Differential Revision: https://phabricator.services.mozilla.com/D20605
xpcom/threads/AbstractThread.cpp
--- a/xpcom/threads/AbstractThread.cpp
+++ b/xpcom/threads/AbstractThread.cpp
@@ -48,19 +48,17 @@ class EventTargetWrapper : public Abstra
                             DispatchReason aReason = NormalDispatch) override {
     AbstractThread* currentThread;
     if (aReason != TailDispatch && (currentThread = GetCurrent()) &&
         RequiresTailDispatch(currentThread)) {
       return currentThread->TailDispatcher().AddTask(this,
                                                      std::move(aRunnable));
     }
 
-    RefPtr<nsIRunnable> runner(
-        new Runner(this, std::move(aRunnable),
-                   false /* already drained by TaskGroupRunnable  */));
+    RefPtr<nsIRunnable> runner = new Runner(this, std::move(aRunnable));
     return mTarget->Dispatch(runner.forget(), NS_DISPATCH_NORMAL);
   }
 
   // Prevent a GCC warning about the other overload of Dispatch being hidden.
   using AbstractThread::Dispatch;
 
   virtual bool IsCurrentThreadIn() const override {
     return mTarget->IsOnCurrentThread();
@@ -112,35 +110,27 @@ class EventTargetWrapper : public Abstra
       ~AutoTaskGuard() { sCurrentThreadTLS.set(mLastCurrentThread); }
 
      private:
       AbstractThread* mLastCurrentThread;
     };
 
    public:
     explicit Runner(EventTargetWrapper* aThread,
-                    already_AddRefed<nsIRunnable> aRunnable,
-                    bool aDrainDirectTasks)
+                    already_AddRefed<nsIRunnable> aRunnable)
         : CancelableRunnable("EventTargetWrapper::Runner"),
           mThread(aThread),
-          mRunnable(aRunnable),
-          mDrainDirectTasks(aDrainDirectTasks) {}
+          mRunnable(aRunnable) {}
 
     NS_IMETHOD Run() override {
       AutoTaskGuard taskGuard(mThread);
 
       MOZ_ASSERT(mThread == AbstractThread::GetCurrent());
       MOZ_ASSERT(mThread->IsCurrentThreadIn());
-      nsresult rv = mRunnable->Run();
-
-      if (mDrainDirectTasks) {
-        mThread->TailDispatcher().DrainDirectTasks();
-      }
-
-      return rv;
+      return mRunnable->Run();
     }
 
     nsresult Cancel() override {
       // Set the TLS during Cancel() just in case it calls Run().
       AutoTaskGuard taskGuard(mThread);
 
       nsresult rv = NS_OK;
 
@@ -167,17 +157,16 @@ class EventTargetWrapper : public Abstra
       }
       return NS_OK;
     }
 #endif
 
    private:
     RefPtr<EventTargetWrapper> mThread;
     RefPtr<nsIRunnable> mRunnable;
-    bool mDrainDirectTasks;
   };
 };
 
 NS_IMPL_ISUPPORTS(AbstractThread, nsIEventTarget, nsISerialEventTarget)
 
 NS_IMETHODIMP_(bool)
 AbstractThread::IsOnCurrentThreadInfallible() { return IsCurrentThreadIn(); }