Bug 1576714 - Part 2: Remove mIPCOpen from PBrowserBridge actors, r=kmag
☠☠ backed out by e966603209bb ☠ ☠
authorNika Layzell <nika@thelayzells.com>
Thu, 03 Oct 2019 21:40:22 +0000
changeset 496245 7dce423417d8fdf37955b6facdfe900b2aac0472
parent 496244 9a5072019168f59cc503570c39d698b2082d4c30
child 496246 ebda40f9688438654a50190c8b91ffa1091ce476
push id36647
push usernerli@mozilla.com
push dateFri, 04 Oct 2019 04:09:18 +0000
treeherdermozilla-central@678d4d2c3c4d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1576714
milestone71.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 1576714 - Part 2: Remove mIPCOpen from PBrowserBridge actors, r=kmag Differential Revision: https://phabricator.services.mozilla.com/D47309
dom/ipc/BrowserBridgeChild.cpp
dom/ipc/BrowserBridgeChild.h
dom/ipc/BrowserBridgeParent.cpp
dom/ipc/BrowserBridgeParent.h
--- a/dom/ipc/BrowserBridgeChild.cpp
+++ b/dom/ipc/BrowserBridgeChild.cpp
@@ -30,32 +30,28 @@ using namespace mozilla::ipc;
 namespace mozilla {
 namespace dom {
 
 BrowserBridgeChild::BrowserBridgeChild(nsFrameLoader* aFrameLoader,
                                        BrowsingContext* aBrowsingContext,
                                        TabId aId)
     : mId{aId},
       mLayersId{0},
-      mIPCOpen(false),
       mFrameLoader(aFrameLoader),
       mBrowsingContext(aBrowsingContext) {}
 
 BrowserBridgeChild::~BrowserBridgeChild() {
 #if defined(ACCESSIBILITY) && defined(XP_WIN)
   if (mEmbeddedDocAccessible) {
     mEmbeddedDocAccessible->Shutdown();
   }
 #endif
 }
 
 already_AddRefed<BrowserBridgeHost> BrowserBridgeChild::FinishInit() {
-  MOZ_ASSERT(!mIPCOpen);
-  mIPCOpen = true;
-
   RefPtr<Element> owner = mFrameLoader->GetOwnerContent();
   nsCOMPtr<nsIDocShell> docShell = do_GetInterface(owner->GetOwnerGlobal());
   MOZ_DIAGNOSTIC_ASSERT(docShell);
 
   nsDocShell::Cast(docShell)->OOPChildLoadStarted(this);
 
 #if defined(ACCESSIBILITY)
   if (a11y::DocAccessible* docAcc =
@@ -241,18 +237,16 @@ mozilla::ipc::IPCResult BrowserBridgeChi
       return IPC_FAIL(this, "Remoteness change failed");
     }
   }
 
   return IPC_OK();
 }
 
 void BrowserBridgeChild::ActorDestroy(ActorDestroyReason aWhy) {
-  mIPCOpen = false;
-
   // Ensure we unblock our document's 'load' event (in case the OOP-iframe has
   // been removed before it finished loading, or its subprocess crashed):
   UnblockOwnerDocsLoadEvent();
 }
 
 void BrowserBridgeChild::UnblockOwnerDocsLoadEvent() {
   if (!mHadInitialLoad) {
     mHadInitialLoad = true;
--- a/dom/ipc/BrowserBridgeChild.h
+++ b/dom/ipc/BrowserBridgeChild.h
@@ -28,17 +28,17 @@ class BrowserBridgeHost;
  */
 class BrowserBridgeChild : public PBrowserBridgeChild {
  public:
   typedef mozilla::layers::LayersId LayersId;
 
   NS_INLINE_DECL_REFCOUNTING(BrowserBridgeChild, final);
 
   BrowserChild* Manager() {
-    MOZ_ASSERT(mIPCOpen);
+    MOZ_ASSERT(CanSend());
     return static_cast<BrowserChild*>(PBrowserBridgeChild::Manager());
   }
 
   TabId GetTabId() { return mId; }
 
   LayersId GetLayersId() { return mLayersId; }
 
   nsFrameLoader* GetFrameLoader() const { return mFrameLoader; }
@@ -101,17 +101,16 @@ class BrowserBridgeChild : public PBrows
 
  private:
   ~BrowserBridgeChild();
 
   void UnblockOwnerDocsLoadEvent();
 
   TabId mId;
   LayersId mLayersId;
-  bool mIPCOpen;
   bool mHadInitialLoad = false;
   RefPtr<nsFrameLoader> mFrameLoader;
   RefPtr<BrowsingContext> mBrowsingContext;
 #if defined(ACCESSIBILITY) && defined(XP_WIN)
   RefPtr<a11y::RemoteIframeDocProxyAccessibleWrap> mEmbeddedDocAccessible;
 #endif
 };
 
--- a/dom/ipc/BrowserBridgeParent.cpp
+++ b/dom/ipc/BrowserBridgeParent.cpp
@@ -18,32 +18,24 @@
 
 using namespace mozilla::ipc;
 using namespace mozilla::layout;
 using namespace mozilla::hal;
 
 namespace mozilla {
 namespace dom {
 
-BrowserBridgeParent::BrowserBridgeParent()
-    :
-#ifdef ACCESSIBILITY
-      mEmbedderAccessibleID(0),
-#endif
-      mIPCOpen(false) {
-}
+BrowserBridgeParent::BrowserBridgeParent() {}
 
 BrowserBridgeParent::~BrowserBridgeParent() { Destroy(); }
 
 nsresult BrowserBridgeParent::Init(const nsString& aPresentationURL,
                                    const nsString& aRemoteType,
                                    const WindowGlobalInit& aWindowInit,
                                    const uint32_t& aChromeFlags, TabId aTabId) {
-  mIPCOpen = true;
-
   RefPtr<CanonicalBrowsingContext> browsingContext =
       aWindowInit.browsingContext()->Canonical();
 
   // We can inherit most TabContext fields for the new BrowserParent actor from
   // our Manager BrowserParent.
   MutableTabContext tabContext;
   tabContext.SetTabContext(false, Manager()->ChromeOuterWindowID(),
                            Manager()->ShowFocusRings(),
@@ -115,17 +107,17 @@ nsresult BrowserBridgeParent::Init(const
   return NS_OK;
 }
 
 CanonicalBrowsingContext* BrowserBridgeParent::GetBrowsingContext() {
   return mBrowserParent->GetBrowsingContext();
 }
 
 BrowserParent* BrowserBridgeParent::Manager() {
-  MOZ_ASSERT(mIPCOpen);
+  MOZ_ASSERT(CanSend());
   return static_cast<BrowserParent*>(PBrowserBridgeParent::Manager());
 }
 
 void BrowserBridgeParent::Destroy() {
   if (mBrowserParent) {
     mBrowserParent->Destroy();
     mBrowserParent->SetBrowserBridgeParent(nullptr);
     mBrowserParent = nullptr;
@@ -226,15 +218,12 @@ IPCResult BrowserBridgeParent::RecvSetEm
     PDocAccessibleParent* aDoc, uint64_t aID) {
 #ifdef ACCESSIBILITY
   mEmbedderAccessibleDoc = static_cast<a11y::DocAccessibleParent*>(aDoc);
   mEmbedderAccessibleID = aID;
 #endif
   return IPC_OK();
 }
 
-void BrowserBridgeParent::ActorDestroy(ActorDestroyReason aWhy) {
-  mIPCOpen = false;
-  Destroy();
-}
+void BrowserBridgeParent::ActorDestroy(ActorDestroyReason aWhy) { Destroy(); }
 
 }  // namespace dom
 }  // namespace mozilla
--- a/dom/ipc/BrowserBridgeParent.h
+++ b/dom/ipc/BrowserBridgeParent.h
@@ -93,17 +93,16 @@ class BrowserBridgeParent : public PBrow
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
  private:
   ~BrowserBridgeParent();
 
   RefPtr<BrowserParent> mBrowserParent;
 #if defined(ACCESSIBILITY)
   RefPtr<a11y::DocAccessibleParent> mEmbedderAccessibleDoc;
-  uint64_t mEmbedderAccessibleID;
+  uint64_t mEmbedderAccessibleID = 0;
 #endif  // defined(ACCESSIBILITY)
-  bool mIPCOpen;
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // !defined(mozilla_dom_BrowserBridgeParent_h)