Bug 1548939 - Rearrange state on BrowserParent to logical groups. r=nika
authorRyan Hunt <rhunt@eqrion.net>
Mon, 29 Apr 2019 16:50:29 -0500
changeset 472885 cd87583bb3abe9d62b442ab1200f2ccfbe4aabbb
parent 472884 411729b65f07f47d08b0d4cffb2b2a4bad8d2ea2
child 472886 09a84bebb63ffed84b93fcb270a9724d57539b3e
push id35982
push userncsoregi@mozilla.com
push dateTue, 07 May 2019 21:45:14 +0000
treeherdermozilla-central@63bc837753d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika
bugs1548939
milestone68.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 1548939 - Rearrange state on BrowserParent to logical groups. r=nika This is the followup to the previous patch, and attempts to organize state to be a bit more logical. Differential Revision: https://phabricator.services.mozilla.com/D30154
dom/ipc/BrowserParent.cpp
dom/ipc/BrowserParent.h
--- a/dom/ipc/BrowserParent.cpp
+++ b/dom/ipc/BrowserParent.cpp
@@ -168,53 +168,64 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(BrowserP
 NS_IMPL_CYCLE_COLLECTING_RELEASE(BrowserParent)
 
 BrowserParent::BrowserParent(ContentParent* aManager, const TabId& aTabId,
                              const TabContext& aContext,
                              CanonicalBrowsingContext* aBrowsingContext,
                              uint32_t aChromeFlags,
                              BrowserBridgeParent* aBrowserBridgeParent)
     : TabContext(aContext),
+      mTabId(aTabId),
+      mManager(aManager),
+      mBrowsingContext(aBrowsingContext),
+      mLoadContext(nullptr),
       mFrameElement(nullptr),
+      mBrowserDOMWindow(nullptr),
+      mFrameLoader(nullptr),
+      mChromeFlags(aChromeFlags),
+      mBrowserBridgeParent(aBrowserBridgeParent),
       mContentCache(*this),
+      mRenderFrame{},
+      mLayerTreeEpoch{1},
+      mChildToParentConversionMatrix{},
       mRect(0, 0, 0, 0),
       mDimensions(0, 0),
       mOrientation(0),
       mDPI(0),
       mRounding(0),
       mDefaultScale(0),
       mUpdatedDimensions(false),
       mSizeMode(nsSizeMode_Normal),
-      mManager(aManager),
+      mClientOffset{},
+      mChromeOffset{},
+      mInitialDataTransferItems{},
+      mDnDVisualization{},
+      mDragValid(false),
+      mDragRect{},
+      mDragPrincipal{},
+      mCreatingWindow(false),
+      mDelayedURL{},
+      mDelayedFrameScripts{},
+      mCursor(eCursorInvalid),
+      mCustomCursor{},
+      mCustomCursorHotspotX(0),
+      mCustomCursorHotspotY(0),
+      mVerifyDropLinks{},
       mDocShellIsActive(false),
       mMarkedDestroying(false),
       mIsDestroyed(false),
-      mChromeFlags(aChromeFlags),
-      mDragValid(false),
-      mBrowsingContext(aBrowsingContext),
-      mBrowserBridgeParent(aBrowserBridgeParent),
-      mTabId(aTabId),
-      mCreatingWindow(false),
-      mCursor(eCursorInvalid),
-      mCustomCursorHotspotX(0),
-      mCustomCursorHotspotY(0),
       mTabSetsCursor(false),
-      mHasContentOpener(false)
-#ifdef DEBUG
-      ,
-      mActiveSupressDisplayportCount(0)
-#endif
-      ,
-      mLayerTreeEpoch{1},
+      mHasContentOpener(false),
       mPreserveLayers(false),
       mRenderLayers(true),
       mActiveInPriorityManager(false),
       mHasLayers(false),
       mHasPresented(false),
       mHasBeforeUnload(false),
+      mIsReadyToHandleInputEvents(false),
       mIsMouseEnterIntoWidgetEventSuppressed(false),
       mIsActiveRecordReplayTab(false) {
   MOZ_ASSERT(aManager);
   // When the input event queue is disabled, we don't need to handle the case
   // that some input events are dispatched before PBrowserConstructor.
   mIsReadyToHandleInputEvents = !ContentParent::IsInputEventQueueSupported();
 }
 
--- a/dom/ipc/BrowserParent.h
+++ b/dom/ipc/BrowserParent.h
@@ -641,19 +641,16 @@ class BrowserParent final : public PBrow
   mozilla::ipc::IPCResult RecvAsyncAuthPrompt(const nsCString& aUri,
                                               const nsString& aRealm,
                                               const uint64_t& aCallbackId);
 
   virtual mozilla::ipc::IPCResult Recv__delete__() override;
 
   virtual void ActorDestroy(ActorDestroyReason why) override;
 
-  nsCOMPtr<Element> mFrameElement;
-  nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
-
   mozilla::ipc::IPCResult RecvRemotePaintIsReady();
 
   mozilla::ipc::IPCResult RecvNotifyCompositorTransaction();
 
   mozilla::ipc::IPCResult RecvRemoteIsReadyToHandleInputEvents();
 
   mozilla::ipc::IPCResult RecvPaintWhileInterruptingJSNoOp(
       const LayersObserverEpoch& aEpoch);
@@ -722,68 +719,61 @@ class BrowserParent final : public PBrow
 
   // Keeps track of which BrowserParent has keyboard focus
   static StaticAutoPtr<nsTArray<BrowserParent*>> sFocusStack;
 
   static void PushFocus(BrowserParent* aBrowserParent);
 
   static void PopFocus(BrowserParent* aBrowserParent);
 
+  TabId mTabId;
+
+  RefPtr<ContentParent> mManager;
+  // The root browsing context loaded in this BrowserParent.
+  RefPtr<CanonicalBrowsingContext> mBrowsingContext;
+  nsCOMPtr<nsILoadContext> mLoadContext;
+  nsCOMPtr<Element> mFrameElement;
+  nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
+  // We keep a strong reference to the frameloader after we've sent the
+  // Destroy message and before we've received __delete__. This allows us to
+  // dispatch message manager messages during this time.
+  RefPtr<nsFrameLoader> mFrameLoader;
+  uint32_t mChromeFlags;
+
+  // Pointer back to BrowserBridgeParent if there is one associated with
+  // this BrowserParent. This is non-owning to avoid cycles and is managed
+  // by the BrowserBridgeParent instance, which has the strong reference
+  // to this BrowserParent.
+  BrowserBridgeParent* mBrowserBridgeParent;
+
   ContentCacheInParent mContentCache;
 
+  layout::RenderFrame mRenderFrame;
+  LayersObserverEpoch mLayerTreeEpoch;
+
+  Maybe<LayoutDeviceToLayoutDeviceMatrix4x4> mChildToParentConversionMatrix;
+
   nsIntRect mRect;
   ScreenIntSize mDimensions;
   hal::ScreenOrientation mOrientation;
   float mDPI;
   int32_t mRounding;
   CSSToLayoutDeviceScale mDefaultScale;
   bool mUpdatedDimensions;
   nsSizeMode mSizeMode;
   LayoutDeviceIntPoint mClientOffset;
   LayoutDeviceIntPoint mChromeOffset;
 
-  RefPtr<ContentParent> mManager;
-
-  // Cached value indicating the docshell active state of the remote browser.
-  bool mDocShellIsActive;
-
-  // When true, we've initiated normal shutdown and notified our managing
-  // PContent.
-  bool mMarkedDestroying;
-  // When true, the BrowserParent is invalid and we should not send IPC messages
-  // anymore.
-  bool mIsDestroyed;
-
-  uint32_t mChromeFlags;
-
   nsTArray<nsTArray<IPCDataTransferItem>> mInitialDataTransferItems;
 
   RefPtr<gfx::DataSourceSurface> mDnDVisualization;
   bool mDragValid;
   LayoutDeviceIntRect mDragRect;
   nsCOMPtr<nsIPrincipal> mDragPrincipal;
 
-  nsCOMPtr<nsILoadContext> mLoadContext;
-
-  // We keep a strong reference to the frameloader after we've sent the
-  // Destroy message and before we've received __delete__. This allows us to
-  // dispatch message manager messages during this time.
-  RefPtr<nsFrameLoader> mFrameLoader;
-
-  // The root browsing context loaded in this BrowserParent.
-  RefPtr<CanonicalBrowsingContext> mBrowsingContext;
-
-  // Pointer back to BrowserBridgeParent if there is one associated with
-  // this BrowserParent. This is non-owning to avoid cycles and is managed
-  // by the BrowserBridgeParent instance, which has the strong reference
-  // to this BrowserParent.
-  BrowserBridgeParent* mBrowserBridgeParent;
-
-  TabId mTabId;
-
   // When loading a new tab or window via window.open, the child is
   // responsible for loading the URL it wants into the new BrowserChild. When
   // the parent receives the CreateWindow message, though, it sends a LoadURL
   // message, usually for about:blank. It's important for the about:blank load
   // to get processed because the Firefox frontend expects every new window to
   // immediately start loading something (see bug 1123090). However, we want
   // the child to process the LoadURL message before it returns from
   // ProvideWindow so that the URL sent from the parent doesn't override the
@@ -808,33 +798,37 @@ class BrowserParent final : public PBrow
   nsTArray<FrameScriptInfo> mDelayedFrameScripts;
 
   // Cached cursor setting from BrowserChild.  When the cursor is over the tab,
   // it should take this appearance.
   nsCursor mCursor;
   nsCOMPtr<imgIContainer> mCustomCursor;
   uint32_t mCustomCursorHotspotX, mCustomCursorHotspotY;
 
+  nsTArray<nsString> mVerifyDropLinks;
+
+#ifdef DEBUG
+  int32_t mActiveSupressDisplayportCount = 0;
+#endif
+
+  // Cached value indicating the docshell active state of the remote browser.
+  bool mDocShellIsActive;
+
+  // When true, we've initiated normal shutdown and notified our managing
+  // PContent.
+  bool mMarkedDestroying;
+  // When true, the BrowserParent is invalid and we should not send IPC messages
+  // anymore.
+  bool mIsDestroyed;
   // True if the cursor changes from the BrowserChild should change the widget
   // cursor.  This happens whenever the cursor is in the tab's region.
   bool mTabSetsCursor;
 
   bool mHasContentOpener;
 
-  nsTArray<nsString> mVerifyDropLinks;
-
-#ifdef DEBUG
-  int32_t mActiveSupressDisplayportCount;
-#endif
-
-  layout::RenderFrame mRenderFrame;
-  LayersObserverEpoch mLayerTreeEpoch;
-
-  Maybe<LayoutDeviceToLayoutDeviceMatrix4x4> mChildToParentConversionMatrix;
-
   // If this flag is set, then the tab's layers will be preserved even when
   // the tab's docshell is inactive.
   bool mPreserveLayers;
 
   // Holds the most recent value passed to the RenderLayers function. This
   // does not necessarily mean that the layers have finished rendering
   // and have uploaded - for that, use mHasLayers.
   bool mRenderLayers;