Bug 1480244: Part 1a - Rename ProcessGlobal to ContentProcessMessageManager. r=bz draft
authorKris Maglione <maglione.k@gmail.com>
Thu, 02 Aug 2018 15:03:50 -0700
changeset 828425 7fc0798d582c20ac12bc6fc70f8adf0293c18e4b
parent 828424 b4cc655e0ae8660046eca4200381c108b2e7923d
child 828426 02a79251d27d575cf034d117ff046d1873e667e2
push id118679
push usermaglione.k@gmail.com
push dateFri, 10 Aug 2018 21:19:41 +0000
reviewersbz
bugs1480244
milestone63.0a1
Bug 1480244: Part 1a - Rename ProcessGlobal to ContentProcessMessageManager. r=bz After these patches, these objects will no longer be globals, which would make their current names misleading. Parts 1a-1c give more appropriate names to the bindings which will cease to be globals. MozReview-Commit-ID: L8GolQaHnO5
dom/base/ContentProcessMessageManager.cpp
dom/base/ContentProcessMessageManager.h
dom/base/PlacesWeakCallbackWrapper.cpp
dom/base/ProcessGlobal.cpp
dom/base/ProcessGlobal.h
dom/base/moz.build
dom/base/nsCCUncollectableMarker.cpp
dom/base/nsFrameMessageManager.cpp
dom/base/nsWrapperCache.h
dom/bindings/Bindings.conf
dom/ipc/ContentChild.cpp
dom/ipc/SharedMap.cpp
toolkit/components/places/History.cpp
toolkit/recordreplay/ipc/ParentIPC.cpp
rename from dom/base/ProcessGlobal.cpp
rename to dom/base/ContentProcessMessageManager.cpp
--- a/dom/base/ProcessGlobal.cpp
+++ b/dom/base/ContentProcessMessageManager.cpp
@@ -1,169 +1,170 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "ProcessGlobal.h"
+#include "ContentProcessMessageManager.h"
 
 #include "nsContentCID.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/MessageManagerBinding.h"
+#include "mozilla/dom/ParentProcessMessageManager.h"
 #include "mozilla/dom/ResolveSystemBinding.h"
 #include "mozilla/dom/ipc/SharedMap.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
-bool ProcessGlobal::sWasCreated = false;
+bool ContentProcessMessageManager::sWasCreated = false;
 
-ProcessGlobal::ProcessGlobal(nsFrameMessageManager* aMessageManager)
+ContentProcessMessageManager::ContentProcessMessageManager(nsFrameMessageManager* aMessageManager)
  : MessageManagerGlobal(aMessageManager),
    mInitialized(false)
 {
   mozilla::HoldJSObjects(this);
 }
 
-ProcessGlobal::~ProcessGlobal()
+ContentProcessMessageManager::~ContentProcessMessageManager()
 {
   mAnonymousGlobalScopes.Clear();
   mozilla::DropJSObjects(this);
 }
 
 bool
-ProcessGlobal::DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
-                         JS::Handle<jsid> aId,
-                         JS::MutableHandle<JS::PropertyDescriptor> aDesc)
+ContentProcessMessageManager::DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
+                                        JS::Handle<jsid> aId,
+                                        JS::MutableHandle<JS::PropertyDescriptor> aDesc)
 {
     bool found;
     if (!SystemGlobalResolve(aCx, aObj, aId, &found)) {
       return false;
     }
     if (found) {
       FillPropertyDescriptor(aDesc, aObj, JS::UndefinedValue(), false);
     }
     return true;
 }
 
 /* static */
 bool
-ProcessGlobal::MayResolve(jsid aId)
+ContentProcessMessageManager::MayResolve(jsid aId)
 {
   return MayResolveAsSystemBindingName(aId);
 }
 
 void
-ProcessGlobal::GetOwnPropertyNames(JSContext* aCx, JS::AutoIdVector& aNames,
-                                   bool aEnumerableOnly, ErrorResult& aRv)
+ContentProcessMessageManager::GetOwnPropertyNames(JSContext* aCx, JS::AutoIdVector& aNames,
+                                                  bool aEnumerableOnly, ErrorResult& aRv)
 {
   JS::Rooted<JSObject*> thisObj(aCx, GetWrapper());
   GetSystemBindingNames(aCx, thisObj, aNames, aEnumerableOnly, aRv);
 }
 
-ProcessGlobal*
-ProcessGlobal::Get()
+ContentProcessMessageManager*
+ContentProcessMessageManager::Get()
 {
   nsCOMPtr<nsIGlobalObject> service = do_GetService(NS_CHILDPROCESSMESSAGEMANAGER_CONTRACTID);
   if (!service) {
     return nullptr;
   }
-  ProcessGlobal* global = static_cast<ProcessGlobal*>(service.get());
+  ContentProcessMessageManager* global = static_cast<ContentProcessMessageManager*>(service.get());
   if (global) {
     sWasCreated = true;
   }
   return global;
 }
 
 already_AddRefed<mozilla::dom::ipc::SharedMap>
-ProcessGlobal::SharedData()
+ContentProcessMessageManager::SharedData()
 {
   if (ContentChild* child = ContentChild::GetSingleton()) {
     return do_AddRef(child->SharedData());
   }
   auto* ppmm = nsFrameMessageManager::sParentProcessManager;
   return do_AddRef(ppmm->SharedData()->GetReadOnly());
 }
 
 bool
-ProcessGlobal::WasCreated()
+ContentProcessMessageManager::WasCreated()
 {
   return sWasCreated;
 }
 
 void
-ProcessGlobal::MarkForCC()
+ContentProcessMessageManager::MarkForCC()
 {
   MarkScopesForCC();
   MessageManagerGlobal::MarkForCC();
 }
 
-NS_IMPL_CYCLE_COLLECTION_CLASS(ProcessGlobal)
+NS_IMPL_CYCLE_COLLECTION_CLASS(ContentProcessMessageManager)
 
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(ProcessGlobal)
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(ContentProcessMessageManager)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMessageManager)
   tmp->TraverseHostObjectURIs(cb);
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
-NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(ProcessGlobal)
+NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(ContentProcessMessageManager)
   NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
   tmp->nsMessageManagerScriptExecutor::Trace(aCallbacks, aClosure);
 NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ProcessGlobal)
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ContentProcessMessageManager)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mMessageManager)
   tmp->nsMessageManagerScriptExecutor::Unlink();
   tmp->UnlinkHostObjectURIs();
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ProcessGlobal)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ContentProcessMessageManager)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMessageSender)
   NS_INTERFACE_MAP_ENTRY(nsIMessageSender)
   NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
   NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
 NS_INTERFACE_MAP_END
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(ProcessGlobal)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(ProcessGlobal)
+NS_IMPL_CYCLE_COLLECTING_ADDREF(ContentProcessMessageManager)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(ContentProcessMessageManager)
 
 bool
-ProcessGlobal::Init()
+ContentProcessMessageManager::Init()
 {
   if (mInitialized) {
     return true;
   }
   mInitialized = true;
 
   return InitChildGlobalInternal(NS_LITERAL_CSTRING("processChildGlobal"));
 }
 
 bool
-ProcessGlobal::WrapGlobalObject(JSContext* aCx,
-                                JS::RealmOptions& aOptions,
-                                JS::MutableHandle<JSObject*> aReflector)
+ContentProcessMessageManager::WrapGlobalObject(JSContext* aCx,
+                                               JS::RealmOptions& aOptions,
+                                               JS::MutableHandle<JSObject*> aReflector)
 {
   bool ok = ContentProcessMessageManager_Binding::Wrap(aCx, this, this, aOptions,
-                                                         nsJSPrincipals::get(mPrincipal),
-                                                         true, aReflector);
+                                                       nsJSPrincipals::get(mPrincipal),
+                                                       true, aReflector);
   if (ok) {
     // Since we can't rewrap we have to preserve the global's wrapper here.
     PreserveWrapper(ToSupports(this));
   }
   return ok;
 }
 
 void
-ProcessGlobal::LoadScript(const nsAString& aURL)
+ContentProcessMessageManager::LoadScript(const nsAString& aURL)
 {
   Init();
   JS::Rooted<JSObject*> global(mozilla::dom::RootingCx(), GetWrapper());
   LoadScriptInternal(global, aURL, false);
 }
 
 void
-ProcessGlobal::SetInitialProcessData(JS::HandleValue aInitialData)
+ContentProcessMessageManager::SetInitialProcessData(JS::HandleValue aInitialData)
 {
   mMessageManager->SetInitialProcessData(aInitialData);
 }
rename from dom/base/ProcessGlobal.h
rename to dom/base/ContentProcessMessageManager.h
--- a/dom/base/ProcessGlobal.h
+++ b/dom/base/ContentProcessMessageManager.h
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef mozilla_dom_ProcessGlobal_h
-#define mozilla_dom_ProcessGlobal_h
+#ifndef mozilla_dom_ContentProcessMessageManager_h
+#define mozilla_dom_ContentProcessMessageManager_h
 
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/MessageManagerGlobal.h"
 #include "nsCOMPtr.h"
 #include "nsFrameMessageManager.h"
 #include "nsIScriptContext.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIScriptContext.h"
@@ -24,46 +24,53 @@
 
 namespace mozilla {
 namespace dom {
 
 namespace ipc {
   class SharedMap;
 }
 
-class ProcessGlobal :
+/**
+ * This class implements a singleton process message manager for content
+ * processes. Each child process has exactly one instance of this class, which
+ * hosts the process's process scripts, and may exchange messages with its
+ * corresponding ParentProcessMessageManager on the parent side.
+ */
+
+class ContentProcessMessageManager :
   public nsIMessageSender,
   public nsMessageManagerScriptExecutor,
   public nsIGlobalObject,
   public nsIScriptObjectPrincipal,
   public nsSupportsWeakReference,
   public ipc::MessageManagerCallback,
   public MessageManagerGlobal,
   public nsWrapperCache
 {
 public:
-  explicit ProcessGlobal(nsFrameMessageManager* aMessageManager);
+  explicit ContentProcessMessageManager(nsFrameMessageManager* aMessageManager);
 
   bool DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
                  JS::Handle<jsid> aId,
                  JS::MutableHandle<JS::PropertyDescriptor> aDesc);
   static bool MayResolve(jsid aId);
   void GetOwnPropertyNames(JSContext* aCx, JS::AutoIdVector& aNames,
                            bool aEnumerableOnly, ErrorResult& aRv);
 
   using ipc::MessageManagerCallback::GetProcessMessageManager;
   using MessageManagerGlobal::GetProcessMessageManager;
 
   bool Init();
 
-  static ProcessGlobal* Get();
+  static ContentProcessMessageManager* Get();
   static bool WasCreated();
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(ProcessGlobal, nsIMessageSender)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(ContentProcessMessageManager, nsIMessageSender)
 
   void MarkForCC();
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aGivenProto) override
   {
     MOZ_CRASH("We should never get here!");
   }
@@ -103,20 +110,20 @@ public:
   bool IsProcessScoped() const override
   {
     return true;
   }
 
   void SetInitialProcessData(JS::HandleValue aInitialData);
 
 protected:
-  virtual ~ProcessGlobal();
+  virtual ~ContentProcessMessageManager();
 
 private:
   bool mInitialized;
 
   static bool sWasCreated;
 };
 
 } // namespace dom
 } // namespace mozilla
 
-#endif // mozilla_dom_ProcessGlobal_h
+#endif // mozilla_dom_ContentProcessMessageManager_h
--- a/dom/base/PlacesWeakCallbackWrapper.cpp
+++ b/dom/base/PlacesWeakCallbackWrapper.cpp
@@ -2,17 +2,17 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/PlacesWeakCallbackWrapper.h"
 
 #include "mozilla/HoldDropJSObjects.h"
-#include "mozilla/dom/ProcessGlobal.h"
+#include "mozilla/dom/ContentProcessMessageManager.h"
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(PlacesWeakCallbackWrapper, mParent, mCallback)
 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(PlacesWeakCallbackWrapper, AddRef)
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(PlacesWeakCallbackWrapper, Release)
 
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -147,16 +147,17 @@ EXPORTS.mozilla.dom += [
     'ChildIterator.h',
     'ChildProcessMessageManager.h',
     'ChromeMessageBroadcaster.h',
     'ChromeMessageSender.h',
     'ChromeNodeList.h',
     'ChromeUtils.h',
     'Comment.h',
     'ContentFrameMessageManager.h',
+    'ContentProcessMessageManager.h',
     'CustomElementRegistry.h',
     'DirectionalityUtils.h',
     'DispatcherTrait.h',
     'DocGroup.h',
     'DocumentFragment.h',
     'DocumentOrShadowRoot.h',
     'DocumentType.h',
     'DOMError.h',
@@ -200,17 +201,16 @@ EXPORTS.mozilla.dom += [
     'NodeInfoInlines.h',
     'NodeIterator.h',
     'ParentProcessMessageManager.h',
     'PlacesEvent.h',
     'PlacesObservers.h',
     'PlacesVisit.h',
     'PlacesWeakCallbackWrapper.h',
     'Pose.h',
-    'ProcessGlobal.h',
     'ProcessMessageManager.h',
     'ResponsiveImageSelector.h',
     'SameProcessMessageQueue.h',
     'ScreenLuminance.h',
     'ScreenOrientation.h',
     'Selection.h',
     'ShadowRoot.h',
     'StructuredCloneBlob.h',
@@ -243,16 +243,17 @@ UNIFIED_SOURCES += [
     'BorrowedAttrInfo.cpp',
     'CharacterData.cpp',
     'ChildIterator.cpp',
     'ChromeMessageBroadcaster.cpp',
     'ChromeMessageSender.cpp',
     'ChromeNodeList.cpp',
     'ChromeUtils.cpp',
     'Comment.cpp',
+    'ContentProcessMessageManager.cpp',
     'Crypto.cpp',
     'CustomElementRegistry.cpp',
     'DirectionalityUtils.cpp',
     'DispatcherTrait.cpp',
     'DocGroup.cpp',
     'DocumentFragment.cpp',
     'DocumentOrShadowRoot.cpp',
     'DocumentType.cpp',
@@ -351,17 +352,16 @@ UNIFIED_SOURCES += [
     'nsWindowRoot.cpp',
     'nsWrapperCache.cpp',
     'nsXHTMLContentSerializer.cpp',
     'nsXMLContentSerializer.cpp',
     'nsXMLNameSpaceMap.cpp',
     'ParentProcessMessageManager.cpp',
     'Pose.cpp',
     'PostMessageEvent.cpp',
-    'ProcessGlobal.cpp',
     'ProcessMessageManager.cpp',
     'ResponsiveImageSelector.cpp',
     'SameProcessMessageQueue.cpp',
     'ScreenLuminance.cpp',
     'ScreenOrientation.cpp',
     'Selection.cpp',
     'SelectionChangeListener.cpp',
     'ShadowRoot.cpp',
--- a/dom/base/nsCCUncollectableMarker.cpp
+++ b/dom/base/nsCCUncollectableMarker.cpp
@@ -27,19 +27,19 @@
 #include "nsJSEnvironment.h"
 #include "nsInProcessTabChildGlobal.h"
 #include "nsFrameLoader.h"
 #include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/CycleCollectedJSRuntime.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/dom/ChromeMessageBroadcaster.h"
 #include "mozilla/dom/ContentFrameMessageManager.h"
+#include "mozilla/dom/ContentProcessMessageManager.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/ParentProcessMessageManager.h"
-#include "mozilla/dom/ProcessGlobal.h"
 #include "mozilla/dom/TabChild.h"
 #include "mozilla/dom/TimeoutManager.h"
 #include "xpcpublic.h"
 #include "nsObserverService.h"
 #include "nsFocusManager.h"
 #include "nsIInterfaceRequestorUtils.h"
 
 using namespace mozilla;
@@ -132,18 +132,18 @@ MarkChildMessageManagers(MessageBroadcas
     }
   }
 }
 
 static void
 MarkMessageManagers()
 {
   if (nsFrameMessageManager::GetChildProcessManager()) {
-    // ProcessGlobal's MarkForCC marks also ChildProcessManager.
-    ProcessGlobal* pg = ProcessGlobal::Get();
+    // ContentProcessMessageManager's MarkForCC also marks ChildProcessManager.
+    ContentProcessMessageManager* pg = ContentProcessMessageManager::Get();
     if (pg) {
       pg->MarkForCC();
     }
   }
 
   // The global message manager only exists in the root process.
   if (!XRE_IsParentProcess()) {
     return;
@@ -466,18 +466,19 @@ mozilla::dom::TraceBlackJS(JSTracer* aTr
     }
   }
 #endif
 
   if (!nsCCUncollectableMarker::sGeneration) {
     return;
   }
 
-  if (ProcessGlobal::WasCreated() && nsFrameMessageManager::GetChildProcessManager()) {
-    ProcessGlobal* pg = ProcessGlobal::Get();
+  if (ContentProcessMessageManager::WasCreated() &&
+      nsFrameMessageManager::GetChildProcessManager()) {
+    auto* pg = ContentProcessMessageManager::Get();
     if (pg) {
       mozilla::TraceScriptHolder(ToSupports(pg), aTrc);
     }
   }
 
   // Mark globals of active windows black.
   nsGlobalWindowOuter::OuterWindowByIdTable* windowsById =
     nsGlobalWindowOuter::GetWindowsTable();
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -35,19 +35,19 @@
 #include "mozilla/ScriptPreloader.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/dom/ChildProcessMessageManager.h"
 #include "mozilla/dom/ChromeMessageBroadcaster.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/MessageManagerBinding.h"
 #include "mozilla/dom/MessagePort.h"
 #include "mozilla/dom/ContentParent.h"
+#include "mozilla/dom/ContentProcessMessageManager.h"
 #include "mozilla/dom/ParentProcessMessageManager.h"
 #include "mozilla/dom/PermissionMessageUtils.h"
-#include "mozilla/dom/ProcessGlobal.h"
 #include "mozilla/dom/ProcessMessageManager.h"
 #include "mozilla/dom/ResolveSystemBinding.h"
 #include "mozilla/dom/SameProcessMessageQueue.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/ToJSValue.h"
 #include "mozilla/dom/ipc/SharedMap.h"
 #include "mozilla/dom/ipc/StructuredCloneData.h"
 #include "mozilla/dom/DOMStringList.h"
@@ -1526,17 +1526,17 @@ public:
   ~SameParentProcessMessageManagerCallback() override
   {
     MOZ_COUNT_DTOR(SameParentProcessMessageManagerCallback);
   }
 
   bool DoLoadMessageManagerScript(const nsAString& aURL,
                                   bool aRunInGlobalScope) override
   {
-    ProcessGlobal* global = ProcessGlobal::Get();
+    auto* global = ContentProcessMessageManager::Get();
     MOZ_ASSERT(!aRunInGlobalScope);
     global->LoadScript(aURL);
     return true;
   }
 
   nsresult DoSendAsyncMessage(JSContext* aCx,
                               const nsAString& aMessage,
                               StructuredCloneData& aData,
@@ -1755,17 +1755,17 @@ NS_NewChildProcessMessageManager(nsISupp
   if (XRE_IsParentProcess()) {
     cb = new SameChildProcessMessageManagerCallback();
   } else {
     cb = new ChildProcessMessageManagerCallback();
     RegisterStrongMemoryReporter(new MessageManagerReporter());
   }
   auto* mm = new ChildProcessMessageManager(cb);
   nsFrameMessageManager::SetChildProcessManager(mm);
-  RefPtr<ProcessGlobal> global = new ProcessGlobal(mm);
+  auto global = MakeRefPtr<ContentProcessMessageManager>(mm);
   NS_ENSURE_TRUE(global->Init(), NS_ERROR_UNEXPECTED);
   return CallQueryInterface(global, aResult);
 }
 
 void
 nsFrameMessageManager::MarkForCC()
 {
   for (auto iter = mListeners.Iter(); !iter.Done(); iter.Next()) {
--- a/dom/base/nsWrapperCache.h
+++ b/dom/base/nsWrapperCache.h
@@ -11,18 +11,18 @@
 #include "mozilla/Assertions.h"
 #include "js/Id.h"          // must come before js/RootingAPI.h
 #include "js/Value.h"       // must come before js/RootingAPI.h
 #include "js/RootingAPI.h"
 #include "js/TracingAPI.h"
 
 namespace mozilla {
 namespace dom {
+class ContentProcessMessageManager;
 class TabChildGlobal;
-class ProcessGlobal;
 } // namespace dom
 } // namespace mozilla
 class SandboxPrivate;
 class nsInProcessTabChildGlobal;
 class nsWindowRoot;
 
 #define NS_WRAPPERCACHE_IID \
 { 0x6f3179a1, 0x36f7, 0x4a5c, \
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -150,20 +150,16 @@ DOMInterfaces = {
 'console': {
     'nativeType': 'mozilla::dom::Console',
 },
 
 'ConsoleInstance': {
     'implicitJSContext': ['clear', 'count', 'countReset', 'groupEnd', 'time', 'timeEnd'],
 },
 
-'ContentProcessMessageManager': {
-    'nativeType': 'mozilla::dom::ProcessGlobal'
-},
-
 'ConvolverNode': {
     'implicitJSContext': [ 'buffer' ],
 },
 
 'Coordinates': {
     'headerFile': 'nsGeoPosition.h'
 },
 
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -25,28 +25,28 @@
 #include "mozilla/TelemetryIPC.h"
 #include "mozilla/devtools/HeapSnapshotTempFileHelperChild.h"
 #include "mozilla/docshell/OfflineCacheUpdateChild.h"
 #include "mozilla/dom/ClientManager.h"
 #include "mozilla/dom/ClientOpenWindowOpActors.h"
 #include "mozilla/dom/ChildProcessMessageManager.h"
 #include "mozilla/dom/ContentBridgeChild.h"
 #include "mozilla/dom/ContentBridgeParent.h"
+#include "mozilla/dom/ContentProcessMessageManager.h"
 #include "mozilla/dom/DOMPrefs.h"
 #include "mozilla/dom/VideoDecoderManagerChild.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/DataTransfer.h"
 #include "mozilla/dom/DocGroup.h"
 #include "mozilla/dom/ExternalHelperAppChild.h"
 #include "mozilla/dom/FileCreatorHelper.h"
 #include "mozilla/dom/GetFilesHelper.h"
 #include "mozilla/dom/IPCBlobUtils.h"
 #include "mozilla/dom/MemoryReportRequest.h"
 #include "mozilla/dom/PLoginReputationChild.h"
-#include "mozilla/dom/ProcessGlobal.h"
 #include "mozilla/dom/PushNotifier.h"
 #include "mozilla/dom/ServiceWorkerManager.h"
 #include "mozilla/dom/TabGroup.h"
 #include "mozilla/dom/nsIContentChild.h"
 #include "mozilla/dom/URLClassifierChild.h"
 #include "mozilla/dom/WorkerDebugger.h"
 #include "mozilla/dom/WorkerDebuggerManager.h"
 #include "mozilla/dom/ipc/SharedMap.h"
@@ -1283,17 +1283,17 @@ ContentChild::InitXPCOM(const XPCOMInitD
     ErrorResult rv;
     JS::RootedValue data(jsapi.cx());
     mozilla::dom::ipc::StructuredCloneData id;
     id.Copy(aInitialData);
     id.Read(jsapi.cx(), &data, rv);
     if (NS_WARN_IF(rv.Failed())) {
       MOZ_CRASH();
     }
-    ProcessGlobal* global = ProcessGlobal::Get();
+    auto* global = ContentProcessMessageManager::Get();
     global->SetInitialProcessData(data);
   }
 
   // The stylesheet cache is not ready yet. Store this URL for future use.
   nsCOMPtr<nsIURI> ucsURL = DeserializeURI(aXPCOMInit.userContentSheetURL());
   nsLayoutStylesheetCache::SetUserContentCSSURL(ucsURL);
 
   GfxInfoBase::SetFeatureStatus(aXPCOMInit.gfxFeatureStatus());
@@ -2544,17 +2544,17 @@ ContentChild::RecvNotifyVisited(nsTArray
     }
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvLoadProcessScript(const nsString& aURL)
 {
-  ProcessGlobal* global = ProcessGlobal::Get();
+  auto* global = ContentProcessMessageManager::Get();
   global->LoadScript(aURL);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvAsyncMessage(const nsString& aMsg,
                                InfallibleTArray<CpowEntry>&& aCpows,
                                const IPC::Principal& aPrincipal,
@@ -2600,17 +2600,17 @@ ContentChild::RecvUpdateSharedData(const
     blobImpls.AppendElement(IPCBlobUtils::Deserialize(ipcBlob));
   }
 
   if (mSharedData) {
     mSharedData->Update(aMapFile, aMapSize,
                         std::move(blobImpls),
                         std::move(aChangedKeys));
   } else {
-    mSharedData = new SharedMap(ProcessGlobal::Get(), aMapFile,
+    mSharedData = new SharedMap(ContentProcessMessageManager::Get(), aMapFile,
                                 aMapSize, std::move(blobImpls));
   }
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvGeolocationUpdate(nsIDOMGeoPosition* aPosition)
--- a/dom/ipc/SharedMap.cpp
+++ b/dom/ipc/SharedMap.cpp
@@ -6,18 +6,18 @@
 
 #include "SharedMap.h"
 #include "SharedMapChangeEvent.h"
 
 #include "MemMapSnapshot.h"
 #include "ScriptPreloader-inl.h"
 
 #include "mozilla/dom/ContentParent.h"
+#include "mozilla/dom/ContentProcessMessageManager.h"
 #include "mozilla/dom/IPCBlobUtils.h"
-#include "mozilla/dom/ProcessGlobal.h"
 #include "mozilla/dom/ScriptSettings.h"
 
 using namespace mozilla::loader;
 
 namespace mozilla {
 
 using namespace ipc;
 
@@ -280,18 +280,18 @@ WritableSharedMap::WritableSharedMap()
   MOZ_RELEASE_ASSERT(mMap.initialized());
 }
 
 SharedMap*
 WritableSharedMap::GetReadOnly()
 {
   if (!mReadOnly) {
     nsTArray<RefPtr<BlobImpl>> blobs(mBlobImpls);
-    mReadOnly = new SharedMap(ProcessGlobal::Get(), CloneMapFile(),
-                              MapSize(), std::move(blobs));
+    mReadOnly = new SharedMap(ContentProcessMessageManager::Get(),
+                              CloneMapFile(), MapSize(), std::move(blobs));
   }
   return mReadOnly;
 }
 
 Result<Ok, nsresult>
 WritableSharedMap::Serialize()
 {
   // Serializes a new snapshot of the map, initializes a new read-only shared
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -30,20 +30,20 @@
 #include "nsIXPConnect.h"
 #include "mozilla/Unused.h"
 #include "nsContentUtils.h" // for nsAutoScriptBlocker
 #include "nsJSUtils.h"
 #include "mozilla/ipc/URIUtils.h"
 #include "nsPrintfCString.h"
 #include "nsTHashtable.h"
 #include "jsapi.h"
+#include "mozilla/dom/ContentProcessMessageManager.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/PlacesObservers.h"
 #include "mozilla/dom/PlacesVisit.h"
-#include "mozilla/dom/ProcessGlobal.h"
 #include "mozilla/dom/ScriptSettings.h"
 
 // Initial size for the cache holding visited status observers.
 #define VISIT_OBSERVERS_INITIAL_CACHE_LENGTH 64
 
 using namespace mozilla::dom;
 using namespace mozilla::ipc;
 using mozilla::Unused;
--- a/toolkit/recordreplay/ipc/ParentIPC.cpp
+++ b/toolkit/recordreplay/ipc/ParentIPC.cpp
@@ -7,17 +7,17 @@
 // This file has the logic which the middleman process uses to communicate with
 // the parent process and with the replayed process.
 
 #include "ParentInternal.h"
 
 #include "base/task.h"
 #include "ipc/Channel.h"
 #include "js/Proxy.h"
-#include "mozilla/dom/ProcessGlobal.h"
+#include "mozilla/dom/ContentProcessMessageManager.h"
 #include "InfallibleVector.h"
 #include "Monitor.h"
 #include "ProcessRecordReplay.h"
 #include "ProcessRedirect.h"
 
 #include <algorithm>
 
 using std::min;
@@ -677,17 +677,17 @@ MaybeCreateCheckpointInRecordingChild()
 }
 
 // Send a message to the message manager in the UI process. This is consumed by
 // various tests.
 static void
 SendMessageToUIProcess(const char* aMessage)
 {
   AutoSafeJSContext cx;
-  dom::ProcessGlobal* cpmm = dom::ProcessGlobal::Get();
+  auto* cpmm = dom::ContentProcessMessageManager::Get();
   ErrorResult err;
   nsAutoString message;
   message.Append(NS_ConvertUTF8toUTF16(aMessage));
   JS::Rooted<JS::Value> undefined(cx);
   cpmm->SendAsyncMessage(cx, message, undefined, nullptr, nullptr, undefined, err);
   MOZ_RELEASE_ASSERT(!err.Failed());
   err.SuppressException();
 }