Backed out changeset fdee8d1538b0 (bug 1288618)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 15 Sep 2016 16:34:10 +0200
changeset 314093 deb400c9f16225d12f9203ef9ee8bca96cdc4194
parent 314092 c8d1c359469ef02fa1bf46b9011467da5316434f
child 314094 975f2a57e36d36ce84b857749dfab2c58e86915f
push id30705
push userkwierso@gmail.com
push dateThu, 15 Sep 2016 23:29:32 +0000
treeherdermozilla-central@7ad3c6ebc11a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1288618
milestone51.0a1
backs outfdee8d1538b02a69595f2c715cb9b93e9747c008
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
Backed out changeset fdee8d1538b0 (bug 1288618)
xpcom/threads/AbstractThread.cpp
xpcom/threads/AbstractThread.h
xpcom/threads/TaskQueue.cpp
--- a/xpcom/threads/AbstractThread.cpp
+++ b/xpcom/threads/AbstractThread.cpp
@@ -89,45 +89,23 @@ public:
 
       nsCOMPtr<nsIRunnable> event = NewRunnableMethod(this, &XPCOMThreadWrapper::FireTailDispatcher);
       nsContentUtils::RunInStableState(event.forget());
     }
 
     return mTailDispatcher.ref();
   }
 
-  virtual bool MightHaveTailTasks() override
-  {
-    return mTailDispatcher.isSome();
-  }
-
   virtual nsIThread* AsXPCOMThread() override { return mTarget; }
 
 private:
   RefPtr<nsIThread> mTarget;
   Maybe<AutoTaskDispatcher> mTailDispatcher;
 };
 
-void
-AbstractThread::TailDispatchTasksFor(AbstractThread* aThread)
-{
-  if (MightHaveTailTasks()) {
-    TailDispatcher().DispatchTasksFor(aThread);
-  }
-}
-
-bool
-AbstractThread::HasTailTasksFor(AbstractThread* aThread)
-{
-  if (!MightHaveTailTasks()) {
-    return false;
-  }
-  return TailDispatcher().HasTasksFor(aThread);
-}
-
 bool
 AbstractThread::RequiresTailDispatch(AbstractThread* aThread) const
 {
   MOZ_ASSERT(aThread);
   // We require tail dispatch if both the source and destination
   // threads support it.
   return SupportsTailDispatch() && aThread->SupportsTailDispatch();
 }
--- a/xpcom/threads/AbstractThread.h
+++ b/xpcom/threads/AbstractThread.h
@@ -61,26 +61,16 @@ public:
 
   // Returns a TaskDispatcher that will dispatch its tasks when the currently-
   // running tasks pops off the stack.
   //
   // May only be called when running within the it is invoked up, and only on
   // threads which support it.
   virtual TaskDispatcher& TailDispatcher() = 0;
 
-  // Returns true if we have tail tasks scheduled, or if this isn't known.
-  // Returns false if we definitely don't have any tail tasks.
-  virtual bool MightHaveTailTasks() { return true; }
-
-  // Helper functions for methods on the tail TasklDispatcher. These check
-  // HasTailTasks to avoid allocating a TailDispatcher if it isn't
-  // needed.
-  void TailDispatchTasksFor(AbstractThread* aThread);
-  bool HasTailTasksFor(AbstractThread* aThread);
-
   // Returns true if this supports the tail dispatcher.
   bool SupportsTailDispatch() const { return mSupportsTailDispatch; }
 
   // Returns true if this thread requires all dispatches originating from
   // aThread go through the tail dispatcher.
   bool RequiresTailDispatch(AbstractThread* aThread) const;
   bool RequiresTailDispatchFromCurrentThread() const;
 
--- a/xpcom/threads/TaskQueue.cpp
+++ b/xpcom/threads/TaskQueue.cpp
@@ -133,48 +133,48 @@ TaskQueue::AwaitIdle()
 }
 
 void
 TaskQueue::AwaitIdleLocked()
 {
   // Make sure there are no tasks for this queue waiting in the caller's tail
   // dispatcher.
   MOZ_ASSERT_IF(AbstractThread::GetCurrent(),
-                !AbstractThread::GetCurrent()->HasTailTasksFor(this));
+                !AbstractThread::GetCurrent()->TailDispatcher().HasTasksFor(this));
 
   mQueueMonitor.AssertCurrentThreadOwns();
   MOZ_ASSERT(mIsRunning || mTasks.empty());
   while (mIsRunning) {
     mQueueMonitor.Wait();
   }
 }
 
 void
 TaskQueue::AwaitShutdownAndIdle()
 {
   MOZ_ASSERT(!IsCurrentThreadIn());
   // Make sure there are no tasks for this queue waiting in the caller's tail
   // dispatcher.
   MOZ_ASSERT_IF(AbstractThread::GetCurrent(),
-                !AbstractThread::GetCurrent()->HasTailTasksFor(this));
+                !AbstractThread::GetCurrent()->TailDispatcher().HasTasksFor(this));
 
   MonitorAutoLock mon(mQueueMonitor);
   while (!mIsShutdown) {
     mQueueMonitor.Wait();
   }
   AwaitIdleLocked();
 }
 
 RefPtr<ShutdownPromise>
 TaskQueue::BeginShutdown()
 {
   // Dispatch any tasks for this queue waiting in the caller's tail dispatcher,
   // since this is the last opportunity to do so.
   if (AbstractThread* currentThread = AbstractThread::GetCurrent()) {
-    currentThread->TailDispatchTasksFor(this);
+    currentThread->TailDispatcher().DispatchTasksFor(this);
   }
 
   MonitorAutoLock mon(mQueueMonitor);
   mIsShutdown = true;
   RefPtr<ShutdownPromise> p = mShutdownPromise.Ensure(__func__);
   MaybeResolveShutdown();
   mon.NotifyAll();
   return p;