Bug 1529399 Remove unnecessary wrapper runnable from CreateDirectTaskDrainer() for stable state runnables r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Mon, 25 Feb 2019 10:50:19 +0000
changeset 518868 2051c2dbfeda3d801446d6c5b6ab25d7f1586e06
parent 518867 7f034553129d9dc4a7e634edb58aee2ed32ee7dc
child 518869 3740242a0860d26b10940d38f9440a3c85185c44
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, 1144486, 1314833
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 unnecessary wrapper runnable from CreateDirectTaskDrainer() for stable state runnables r=padenot The original DrainDirectTask() call was added for reasons described in https://bugzilla.mozilla.org/show_bug.cgi?id=1144486#c16 which should now be unnecessary since https://hg.mozilla.org/integration/autoland/rev/ed7c9d7a635d The code being removed here was rework to use an appropriate AbstractThread: https://hg.mozilla.org/mozilla-central/rev/02e5708a75fcdd9e8e4b065995f00b29896fb4b5#l9.32 https://bugzilla.mozilla.org/show_bug.cgi?id=1314833#c76 Differential Revision: https://phabricator.services.mozilla.com/D20604
dom/media/MediaStreamGraph.cpp
xpcom/threads/AbstractThread.cpp
xpcom/threads/AbstractThread.h
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -3851,19 +3851,18 @@ already_AddRefed<MediaInputPort> MediaSt
     }
   }
   return nullptr;
 }
 
 void MediaStreamGraph::DispatchToMainThreadStableState(
     already_AddRefed<nsIRunnable> aRunnable) {
   AssertOnGraphThreadOrNotRunning();
-  *static_cast<MediaStreamGraphImpl*>(this)
-       ->mPendingUpdateRunnables.AppendElement() =
-      AbstractMainThread()->CreateDirectTaskDrainer(std::move(aRunnable));
+  static_cast<MediaStreamGraphImpl*>(this)
+      ->mPendingUpdateRunnables.AppendElement(std::move(aRunnable));
 }
 
 Watchable<mozilla::GraphTime>& MediaStreamGraphImpl::CurrentTime() {
   MOZ_ASSERT(NS_IsMainThread());
   return mMainThreadGraphTime;
 }
 
 }  // namespace mozilla
--- a/xpcom/threads/AbstractThread.cpp
+++ b/xpcom/threads/AbstractThread.cpp
@@ -94,23 +94,16 @@ class EventTargetWrapper : public Abstra
 
   virtual nsIEventTarget* AsEventTarget() override { return mTarget; }
 
  private:
   nsCOMPtr<nsIThread> mRunningThread;
   RefPtr<nsIEventTarget> mTarget;
   Maybe<AutoTaskDispatcher> mTailDispatcher;
 
-  virtual already_AddRefed<nsIRunnable> CreateDirectTaskDrainer(
-      already_AddRefed<nsIRunnable> aRunnable) override {
-    RefPtr<Runner> runner =
-        new Runner(this, std::move(aRunnable), /* aDrainDirectTasks */ true);
-    return runner.forget();
-  }
-
   class Runner : public CancelableRunnable {
     class MOZ_STACK_CLASS AutoTaskGuard final {
      public:
       explicit AutoTaskGuard(EventTargetWrapper* aThread)
           : mLastCurrentThread(nullptr) {
         MOZ_ASSERT(aThread);
         mLastCurrentThread = sCurrentThreadTLS.get();
         sCurrentThreadTLS.set(aThread);
--- a/xpcom/threads/AbstractThread.h
+++ b/xpcom/threads/AbstractThread.h
@@ -115,23 +115,16 @@ class AbstractThread : public nsISerialE
   // Must be called exactly once during startup.
   static void InitTLS();
   static void InitMainThread();
 
   void DispatchStateChange(already_AddRefed<nsIRunnable> aRunnable);
 
   static void DispatchDirectTask(already_AddRefed<nsIRunnable> aRunnable);
 
-  // Create a runnable that will run |aRunnable| and drain the direct tasks
-  // generated by it.
-  virtual already_AddRefed<nsIRunnable> CreateDirectTaskDrainer(
-      already_AddRefed<nsIRunnable> aRunnable) {
-    MOZ_CRASH("Not support!");
-  }
-
   struct AutoEnter {
     explicit AutoEnter(AbstractThread* aThread) {
       mLastCurrentThread = sCurrentThreadTLS.get();
       sCurrentThreadTLS.set(aThread);
     }
 
     ~AutoEnter() { sCurrentThreadTLS.set(mLastCurrentThread); }