Bug 1354080 - Stop doing needless work in the parent process every time the refresh driver ticks. r?kats draft
authorMike Conley <mconley@mozilla.com>
Thu, 06 Apr 2017 18:11:34 -0400
changeset 557478 8482a739b596d027fb1489e160c0ab419a793c05
parent 556960 950612071c4e5cbd61af6c0f66ed0bc40c35e39c
child 558367 9fa8d463a876bb644da43aadb6f34d0fd0ff2278
push id52743
push usermconley@mozilla.com
push dateThu, 06 Apr 2017 22:15:24 +0000
reviewerskats
bugs1354080, 1153023
milestone55.0a1
Bug 1354080 - Stop doing needless work in the parent process every time the refresh driver ticks. r?kats When we're animating, we tick the refresh driver. If that occurs in the parent process when e10s is enabled, then we currently run TabParent::DidRefresh which does some dimensions calculations and might send a message to the content process if the dimensions have changed. This was originally added to fix a B2G bug in bug 1153023. We don't need to do it anymore, since we don't set CSS transforms on content browser windows. MozReview-Commit-ID: JJ7AJHlSyWn
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -298,20 +298,16 @@ TabParent::AddWindowListeners()
   if (mFrameElement && mFrameElement->OwnerDoc()) {
     if (nsCOMPtr<nsPIDOMWindowOuter> window = mFrameElement->OwnerDoc()->GetWindow()) {
       nsCOMPtr<EventTarget> eventTarget = window->GetTopWindowRoot();
       if (eventTarget) {
         eventTarget->AddEventListener(NS_LITERAL_STRING("MozUpdateWindowPos"),
                                       this, false, false);
       }
     }
-    if (nsIPresShell* shell = mFrameElement->OwnerDoc()->GetShell()) {
-      mPresShellWithRefreshListener = shell;
-      shell->AddPostRefreshObserver(this);
-    }
 
     RefPtr<AudioChannelService> acs = AudioChannelService::GetOrCreate();
     if (acs) {
       acs->RegisterTabParent(this);
     }
   }
 }
 
@@ -321,36 +317,24 @@ TabParent::RemoveWindowListeners()
   if (mFrameElement && mFrameElement->OwnerDoc()->GetWindow()) {
     nsCOMPtr<nsPIDOMWindowOuter> window = mFrameElement->OwnerDoc()->GetWindow();
     nsCOMPtr<EventTarget> eventTarget = window->GetTopWindowRoot();
     if (eventTarget) {
       eventTarget->RemoveEventListener(NS_LITERAL_STRING("MozUpdateWindowPos"),
                                        this, false);
     }
   }
-  if (mPresShellWithRefreshListener) {
-    mPresShellWithRefreshListener->RemovePostRefreshObserver(this);
-    mPresShellWithRefreshListener = nullptr;
-  }
 
   RefPtr<AudioChannelService> acs = AudioChannelService::GetOrCreate();
   if (acs) {
     acs->UnregisterTabParent(this);
   }
 }
 
 void
-TabParent::DidRefresh()
-{
-  if (mChromeOffset != -GetChildProcessOffset()) {
-    UpdatePosition();
-  }
-}
-
-void
 TabParent::GetAppType(nsAString& aOut)
 {
   aOut.Truncate();
   nsCOMPtr<Element> elem = do_QueryInterface(mFrameElement);
   if (!elem) {
     return;
   }
 
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -85,17 +85,16 @@ class StructuredCloneData;
 class TabParent final : public PBrowserParent
                       , public nsIDOMEventListener
                       , public nsITabParent
                       , public nsIAuthPromptProvider
                       , public nsISecureBrowserUI
                       , public nsIKeyEventInPluginCallback
                       , public nsSupportsWeakReference
                       , public TabContext
-                      , public nsAPostRefreshObserver
                       , public nsIWebBrowserPersistable
                       , public LiveResizeListener
 {
   typedef mozilla::dom::ClonedMessageData ClonedMessageData;
 
   virtual ~TabParent();
 
 public:
@@ -153,18 +152,16 @@ public:
   nsIXULBrowserWindow* GetXULBrowserWindow();
 
   void Destroy();
 
   void RemoveWindowListeners();
 
   void AddWindowListeners();
 
-  void DidRefresh() override;
-
   virtual mozilla::ipc::IPCResult RecvMoveFocus(const bool& aForward,
                                                 const bool& aForDocumentNavigation) override;
 
   virtual mozilla::ipc::IPCResult RecvSizeShellTo(const uint32_t& aFlags,
                                                   const int32_t& aWidth,
                                                   const int32_t& aHeight,
                                                   const int32_t& aShellItemWidth,
                                                   const int32_t& aShellItemHeight) override;
@@ -745,18 +742,16 @@ private:
   nsCursor mCursor;
   nsCOMPtr<imgIContainer> mCustomCursor;
   uint32_t mCustomCursorHotspotX, mCustomCursorHotspotY;
 
   // True if the cursor changes from the TabChild should change the widget
   // cursor.  This happens whenever the cursor is in the tab's region.
   bool mTabSetsCursor;
 
-  RefPtr<nsIPresShell> mPresShellWithRefreshListener;
-
   bool mHasContentOpener;
 
 #ifdef DEBUG
   int32_t mActiveSupressDisplayportCount;
 #endif
 
   ShowInfo GetShowInfo();