Bug 1408333 Get rid of nsIIPCBackgroundChildCreateCallback - part 19 - ContentChild, r=billm, r=asuth
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 24 Oct 2017 12:02:41 +0200
changeset 438602 8f657b9623fb25776c074651abc4a4d7e8cffea0
parent 438601 ef23e447c4fabc816520cd223010c2cb66b0f663
child 438603 1530143d1c549fad261f0e885e556a452ce2fe1b
push id8114
push userjlorenzo@mozilla.com
push dateThu, 02 Nov 2017 16:33:21 +0000
treeherdermozilla-beta@73e0d89a540f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm, asuth
bugs1408333
milestone58.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 1408333 Get rid of nsIIPCBackgroundChildCreateCallback - part 19 - ContentChild, r=billm, r=asuth
dom/ipc/ContentChild.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -102,17 +102,16 @@
 
 #include "mozInlineSpellChecker.h"
 #include "nsDocShell.h"
 #include "nsIConsoleListener.h"
 #include "nsIContentViewer.h"
 #include "nsICycleCollectorListener.h"
 #include "nsIIdlePeriod.h"
 #include "nsIDragService.h"
-#include "nsIIPCBackgroundChildCreateCallback.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIMemoryReporter.h"
 #include "nsIMemoryInfoDumper.h"
 #include "nsIMutable.h"
 #include "nsIObserverService.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsMemoryInfoDumper.h"
 #include "nsServiceManagerUtils.h"
@@ -463,41 +462,16 @@ ConsoleListener::Observe(nsIConsoleMessa
 
   nsString msg;
   nsresult rv = aMessage->GetMessageMoz(getter_Copies(msg));
   NS_ENSURE_SUCCESS(rv, rv);
   mChild->SendConsoleMessage(msg);
   return NS_OK;
 }
 
-class BackgroundChildPrimer final :
-  public nsIIPCBackgroundChildCreateCallback
-{
-public:
-  BackgroundChildPrimer()
-  { }
-
-  NS_DECL_ISUPPORTS
-
-private:
-  ~BackgroundChildPrimer() = default;
-
-  void
-  ActorCreated(PBackgroundChild* aActor) override
-  {
-    MOZ_ASSERT(aActor, "Failed to create a PBackgroundChild actor!");
-  }
-
-  void
-  ActorFailed() override
-  {
-    MOZ_CRASH("Failed to create a PBackgroundChild actor!");
-  }
-};
-
 #ifdef NIGHTLY_BUILD
 /**
  * The singleton of this class is registered with the HangMonitor as an
  * annotator, so that the hang monitor can record whether or not there were
  * pending input events when the thread hung.
  */
 class PendingInputEventHangAnnotator final
   : public HangMonitor::Annotator
@@ -511,18 +485,16 @@ public:
     }
   }
 
   static PendingInputEventHangAnnotator sSingleton;
 };
 PendingInputEventHangAnnotator PendingInputEventHangAnnotator::sSingleton;
 #endif
 
-NS_IMPL_ISUPPORTS(BackgroundChildPrimer, nsIIPCBackgroundChildCreateCallback)
-
 class ContentChild::ShutdownCanary final
 { };
 
 ContentChild* ContentChild::sSingleton;
 StaticAutoPtr<ContentChild::ShutdownCanary> ContentChild::sShutdownCanary;
 
 ContentChild::ContentChild()
  : mID(uint64_t(-1))
@@ -1162,19 +1134,18 @@ ContentChild::InitXPCOM(const XPCOMInitD
   for (unsigned int i = 0; i < aXPCOMInit.prefs().Length(); i++) {
     Preferences::SetPreference(aXPCOMInit.prefs().ElementAt(i));
   }
   SET_PREF_PHASE(pref_initPhase::END_ALL_PREFS);
   // Do this as early as possible to get the parent process to initialize the
   // background thread since we'll likely need database information very soon.
   BackgroundChild::Startup();
 
-  nsCOMPtr<nsIIPCBackgroundChildCreateCallback> callback =
-    new BackgroundChildPrimer();
-  if (!BackgroundChild::GetOrCreateForCurrentThread(callback)) {
+  PBackgroundChild* actorChild = BackgroundChild::GetOrCreateForCurrentThread();
+  if (NS_WARN_IF(!actorChild)) {
     MOZ_CRASH("Failed to create PBackgroundChild!");
   }
 
   nsCOMPtr<nsIConsoleService> svc(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
   if (!svc) {
     NS_WARNING("Couldn't acquire console service");
     return;
   }