Bug 1371117 - Convert NS_GetCurrentThread usage in PBackground (r=bevis)
authorBill McCloskey <billm@mozilla.com>
Wed, 31 May 2017 16:23:18 -0700
changeset 414731 41073f956bfb54c7d5d9d6d483e26896b8806c30
parent 414730 ccc624eb77e1ccf5bd099fd2363010838ad429e4
child 414732 c87f5cf65bc8ab528328395ced6c5e36a9dd2aac
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [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();