Bug 1371117 - Convert NS_GetCurrentThread usage in PBackground (r=bevis)
authorBill McCloskey <billm@mozilla.com>
Wed, 31 May 2017 16:23:18 -0700
changeset 412329 41073f956bfb
parent 412328 ccc624eb77e1
child 412330 c87f5cf65bc8
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbevis
bugs1371117
milestone56.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 1371117 - Convert NS_GetCurrentThread usage in PBackground (r=bevis) MozReview-Commit-ID: 1DHvWR8P3Oo
ipc/glue/BackgroundImpl.cpp
--- a/ipc/glue/BackgroundImpl.cpp
+++ b/ipc/glue/BackgroundImpl.cpp
@@ -328,54 +328,54 @@ class ChildImpl final : public Backgroun
   // that are in the process of construction.
   static StaticAutoPtr<nsTArray<nsCOMPtr<nsIEventTarget>>> sPendingTargets;
 
   // This is only modified on the main thread. It prevents us from trying to
   // create the background thread after application shutdown has started.
   static bool sShutdownHasStarted;
 
 #if defined(DEBUG) || !defined(RELEASE_OR_BETA)
-  nsIThread* mBoundThread;
+  nsISerialEventTarget* mBoundEventTarget;
 #endif
 
 #ifdef DEBUG
   bool mActorDestroyed;
 #endif
 
 public:
   static bool
   OpenProtocolOnMainThread(nsIEventTarget* aEventTarget);
 
   static void
   Shutdown();
 
   void
   AssertIsOnBoundThread()
   {
-    THREADSAFETY_ASSERT(mBoundThread);
+    THREADSAFETY_ASSERT(mBoundEventTarget);
 
 #ifdef RELEASE_OR_BETA
     DebugOnly<bool> current;
 #else
     bool current;
 #endif
     THREADSAFETY_ASSERT(
-      NS_SUCCEEDED(mBoundThread->IsOnCurrentThread(&current)));
+      NS_SUCCEEDED(mBoundEventTarget->IsOnCurrentThread(&current)));
     THREADSAFETY_ASSERT(current);
   }
 
   void
   AssertActorDestroyed()
   {
     MOZ_ASSERT(mActorDestroyed, "ChildImpl::ActorDestroy not called in time");
   }
 
   ChildImpl()
 #if defined(DEBUG) || !defined(RELEASE_OR_BETA)
-  : mBoundThread(nullptr)
+  : mBoundEventTarget(nullptr)
 #endif
 #ifdef DEBUG
   , mActorDestroyed(false)
 #endif
   {
     AssertIsOnMainThread();
   }
 
@@ -442,23 +442,23 @@ private:
   ~ChildImpl()
   {
     AssertActorDestroyed();
   }
 
   void
   SetBoundThread()
   {
-    THREADSAFETY_ASSERT(!mBoundThread);
+    THREADSAFETY_ASSERT(!mBoundEventTarget);
 
 #if defined(DEBUG) || !defined(RELEASE_OR_BETA)
-    mBoundThread = NS_GetCurrentThread();
+    mBoundEventTarget = GetCurrentThreadSerialEventTarget();
 #endif
 
-    THREADSAFETY_ASSERT(mBoundThread);
+    THREADSAFETY_ASSERT(mBoundEventTarget);
   }
 
   // Only called by IPDL.
   virtual void
   ActorDestroy(ActorDestroyReason aWhy) override;
 
   static already_AddRefed<nsIIPCBackgroundChildCreateCallback>
   GetNextCallback();