Bug 1571223 - Sprinkle around some RefPtrs in ContentParent.cpp. r=kmag a=lizzard DEVEDITION_70_0b9_BUILD1 DEVEDITION_70_0b9_RELEASE FIREFOX_70_0b9_BUILD1 FIREFOX_70_0b9_RELEASE
authorAndrew McCreight <continuation@gmail.com>
Wed, 21 Aug 2019 01:45:00 +0300
changeset 555281 48e74f990086920697ec7b6d3a6ff95554de390f
parent 555280 679a27d4348ab9dfeb5b6199aa2bd894332f122a
child 555282 9af146817a5258a6275ae369939d04ea5cc79cfe
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag, lizzard
bugs1571223
milestone70.0
Bug 1571223 - Sprinkle around some RefPtrs in ContentParent.cpp. r=kmag a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D42735
dom/ipc/BrowserParent.h
dom/ipc/ContentParent.cpp
--- a/dom/ipc/BrowserParent.h
+++ b/dom/ipc/BrowserParent.h
@@ -983,16 +983,16 @@ struct MOZ_STACK_CLASS BrowserParent::Au
   }
 
   ~AutoUseNewTab() {
     mNewTab->mCreatingWindow = false;
     *mURLToLoad = mNewTab->mDelayedURL;
   }
 
  private:
-  BrowserParent* mNewTab;
+  RefPtr<BrowserParent> mNewTab;
   nsCString* mURLToLoad;
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_BrowserParent_h
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -4696,18 +4696,18 @@ mozilla::ipc::IPCResult ContentParent::C
   // not a window should be private - the parent will do that.
   const uint32_t badFlags = nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW |
                             nsIWebBrowserChrome::CHROME_NON_PRIVATE_WINDOW |
                             nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME;
   if (!!(aChromeFlags & badFlags)) {
     return IPC_FAIL(this, "Forbidden aChromeFlags passed");
   }
 
-  BrowserParent* thisBrowserParent = BrowserParent::GetFrom(aThisTab);
-  BrowserHost* thisBrowserHost =
+  RefPtr<BrowserParent> thisBrowserParent = BrowserParent::GetFrom(aThisTab);
+  RefPtr<BrowserHost> thisBrowserHost =
       thisBrowserParent ? thisBrowserParent->GetBrowserHost() : nullptr;
   MOZ_ASSERT(!thisBrowserParent == !thisBrowserHost);
 
   // The content process should not have set its remote or fission flags if the
   // parent doesn't also have these set.
   if (thisBrowserHost) {
     nsCOMPtr<nsILoadContext> context = thisBrowserHost->GetLoadContext();
 
@@ -4837,18 +4837,18 @@ mozilla::ipc::IPCResult ContentParent::C
   aResult = pwwatch->OpenWindowWithRemoteTab(
       thisBrowserHost, aFeatures, aCalledFromJS, aFullZoom, aNextRemoteTabId,
       !aSetOpener, getter_AddRefs(aNewRemoteTab));
   if (NS_WARN_IF(NS_FAILED(aResult))) {
     return IPC_OK();
   }
 
   MOZ_ASSERT(aNewRemoteTab);
-  BrowserHost* newBrowserHost = BrowserHost::GetFrom(aNewRemoteTab.get());
-  BrowserParent* newBrowserParent = newBrowserHost->GetActor();
+  RefPtr<BrowserHost> newBrowserHost = BrowserHost::GetFrom(aNewRemoteTab.get());
+  RefPtr<BrowserParent> newBrowserParent = newBrowserHost->GetActor();
 
   // At this point, it's possible the inserted frameloader hasn't gone through
   // layout yet. To ensure that the dimensions that we send down when telling
   // the frameloader to display will be correct (instead of falling back to a
   // 10x10 default), we force layout if necessary to get the most up-to-date
   // dimensions. See bug 1358712 for details.
   //
   // This involves doing a bit of gymnastics in order to get at the FrameLoader,
@@ -4918,17 +4918,17 @@ mozilla::ipc::IPCResult ContentParent::R
   // Make sure to resolve the resolver when this function exits, even if we
   // failed to generate a valid response.
   auto resolveOnExit = MakeScopeExit([&] {
     // Copy over the nsresult, and then resolve.
     cwi.rv() = rv;
     aResolve(cwi);
   });
 
-  BrowserParent* newTab = BrowserParent::GetFrom(aNewTab);
+  RefPtr<BrowserParent> newTab = BrowserParent::GetFrom(aNewTab);
   MOZ_ASSERT(newTab);
 
   auto destroyNewTabOnError = MakeScopeExit([&] {
     // We always expect to open a new window here. If we don't, it's an error.
     if (!cwi.windowOpened() || NS_FAILED(rv)) {
       if (newTab) {
         newTab->Destroy();
       }