Enable APZ for all Desktop windows if E10s is enabled. (bug 1163115, r=kats)
authorDavid Anderson <danderson@mozilla.com>
Tue, 12 May 2015 01:26:01 -0400
changeset 274224 f26a086ff828d40fe6f624176026481fde089a81
parent 274223 a0a7ad859a667d4bc1a76cf79c9dd064b715a8c8
child 274225 d74ae8fcaac94d37c6c07036bd0afd80dcfcfc8b
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1163115
milestone40.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
Enable APZ for all Desktop windows if E10s is enabled. (bug 1163115, r=kats)
gfx/layers/ipc/CompositorParent.cpp
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
widget/nsBaseWidget.cpp
widget/nsBaseWidget.h
widget/nsIWidget.h
widget/nsWidgetInitData.h
xpfe/appshell/nsAppShellService.cpp
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -44,16 +44,17 @@
 #include "mozilla/Telemetry.h"
 #ifdef MOZ_WIDGET_GTK
 #include "basic/X11BasicCompositor.h" // for X11BasicCompositor
 #endif
 #include "nsCOMPtr.h"                   // for already_AddRefed
 #include "nsDebug.h"                    // for NS_ASSERTION, etc
 #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR, etc
 #include "nsIWidget.h"                  // for nsIWidget
+#include "nsIXULRuntime.h"              // for mozilla::BrowserTabsRemoteAutostart
 #include "nsTArray.h"                   // for nsTArray
 #include "nsThreadUtils.h"              // for NS_IsMainThread
 #include "nsXULAppAPI.h"                // for XRE_GetIOMessageLoop
 #ifdef XP_WIN
 #include "mozilla/layers/CompositorD3D11.h"
 #include "mozilla/layers/CompositorD3D9.h"
 #endif
 #include "GeckoProfiler.h"
@@ -659,20 +660,20 @@ CompositorParent::CompositorParent(nsIWi
   { // scope lock
     MonitorAutoLock lock(*sIndirectLayerTreesLock);
     sIndirectLayerTrees[mRootLayerTreeID].mParent = this;
   }
 
   if (gfxPrefs::AsyncPanZoomEnabled() &&
 #if !defined(MOZ_B2G) && !defined(MOZ_WIDGET_ANDROID)
       // For XUL applications (everything but B2G on mobile and desktop, and
-      // Firefox on Android) we only want to use APZ in e10s-enabled windows.
-      // If we ever get input events off the main thread we can consider
-      // relaxing this requirement.
-      aWidget->IsMultiProcessWindow() &&
+      // Firefox on Android) we only want to use APZ when E10S is enabled. If
+      // we ever get input events off the main thread we can consider relaxing
+      // this requirement.
+      mozilla::BrowserTabsRemoteAutostart() &&
 #endif
       (aWidget->WindowType() == eWindowType_toplevel || aWidget->WindowType() == eWindowType_child)) {
     mApzcTreeManager = new APZCTreeManager();
   }
 
   if (UseVsyncComposition()) {
     NS_WARNING("Enabling vsync compositor");
     mCompositorScheduler = new CompositorVsyncScheduler(this, aWidget);
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -482,17 +482,16 @@ public:
   void WillPaintWindow();
   bool PaintWindow(nsIntRegion aRegion);
 
 #ifdef ACCESSIBILITY
   already_AddRefed<mozilla::a11y::Accessible> GetDocumentAccessible();
 #endif
 
   virtual void CreateCompositor() override;
-  virtual bool IsMultiProcessWindow() override;
   virtual void PrepareWindowEffects() override;
   virtual void CleanupWindowEffects() override;
   virtual bool PreRender(LayerManagerComposite* aManager) override;
   virtual void PostRender(LayerManagerComposite* aManager) override;
   virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) override;
 
   virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
 
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -1924,26 +1924,16 @@ void
 nsChildView::CreateCompositor()
 {
   nsBaseWidget::CreateCompositor();
   if (mCompositorChild) {
     [(ChildView *)mView setUsingOMTCompositor:true];
   }
 }
 
-bool
-nsChildView::IsMultiProcessWindow()
-{
-  // On OS X the XULWindowWidget object gets the widget's init-data, which
-  // is what has the electrolysis window flag. So here in the child view
-  // we need to get the flag from that window instead.
-  nsCocoaWindow* parent = GetXULWindowWidget();
-  return parent ? parent->IsMultiProcessWindow() : false;
-}
-
 void
 nsChildView::ConfigureAPZCTreeManager()
 {
   nsBaseWidget::ConfigureAPZCTreeManager();
 
   if (gfxPrefs::AsyncPanZoomSeparateEventThread()) {
     if (gNumberOfWidgetsNeedingEventThread == 0) {
       [EventThreadRunner start];
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -290,17 +290,16 @@ void nsBaseWidget::BaseCreate(nsIWidget 
   }
 
   // keep a reference to the device context
   if (nullptr != aInitData) {
     mWindowType = aInitData->mWindowType;
     mBorderStyle = aInitData->mBorderStyle;
     mPopupLevel = aInitData->mPopupLevel;
     mPopupType = aInitData->mPopupHint;
-    mMultiProcessWindow = aInitData->mMultiProcessWindow;
   }
 
   if (aParent) {
     aParent->AddChild(this);
   }
 }
 
 NS_IMETHODIMP nsBaseWidget::CaptureMouse(bool aCapture)
@@ -948,21 +947,16 @@ public:
         mTreeManager.get(), &APZCTreeManager::ContentReceivedInputBlock,
         aInputBlockId, aPreventDefault));
   }
 
 private:
   nsRefPtr<APZCTreeManager> mTreeManager;
 };
 
-bool nsBaseWidget::IsMultiProcessWindow()
-{
-  return mMultiProcessWindow;
-}
-
 void nsBaseWidget::ConfigureAPZCTreeManager()
 {
   MOZ_ASSERT(mAPZC);
 
   ConfigureAPZControllerThread();
 
   mAPZC->SetDPI(GetDPI());
   mAPZEventState = new APZEventState(this,
--- a/widget/nsBaseWidget.h
+++ b/widget/nsBaseWidget.h
@@ -149,17 +149,16 @@ public:
                                           LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
                                           bool* aAllowRetaining = nullptr) override;
 
   CompositorVsyncDispatcher* GetCompositorVsyncDispatcher() override;
   void            CreateCompositorVsyncDispatcher();
   virtual CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight);
   virtual void            CreateCompositor();
   virtual void            CreateCompositor(int aWidth, int aHeight);
-  virtual bool            IsMultiProcessWindow() override;
   virtual void            PrepareWindowEffects() override {}
   virtual void            CleanupWindowEffects() override {}
   virtual bool            PreRender(LayerManagerComposite* aManager) override { return true; }
   virtual void            PostRender(LayerManagerComposite* aManager) override {}
   virtual void            DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) override {}
   virtual void            DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) override {}
   virtual mozilla::TemporaryRef<mozilla::gfx::DrawTarget> StartRemoteDrawing() override;
   virtual void            EndRemoteDrawing() override { };
@@ -477,17 +476,16 @@ protected:
   nsRefPtr<APZEventState> mAPZEventState;
   nsRefPtr<SetAllowedTouchBehaviorCallback> mSetAllowedTouchBehaviorCallback;
   nsRefPtr<WidgetShutdownObserver> mShutdownObserver;
   nsRefPtr<TextEventDispatcher> mTextEventDispatcher;
   nsCursor          mCursor;
   bool              mUpdateCursor;
   nsBorderStyle     mBorderStyle;
   bool              mUseLayersAcceleration;
-  bool              mMultiProcessWindow;
   bool              mUseAttachedEvents;
   nsIntRect         mBounds;
   nsIntRect*        mOriginalBounds;
   // When this pointer is null, the widget is not clipped
   nsAutoArrayPtr<nsIntRect> mClipRects;
   uint32_t          mClipRectCount;
   nsSizeMode        mSizeMode;
   nsPopupLevel      mPopupLevel;
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -1746,18 +1746,16 @@ class nsIWidget : public nsISupports {
 
     /**
      * Dispatches an event to the widget
      *
      */
     NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* event,
                              nsEventStatus & aStatus) = 0;
 
-    virtual bool IsMultiProcessWindow() = 0;
-
     /**
      * Dispatches an event that must be handled by APZ first, when APZ is
      * enabled. If invoked in the child process, it is forwarded to the
      * parent process synchronously.
      */
     virtual nsEventStatus DispatchAPZAwareEvent(mozilla::WidgetInputEvent* aEvent) = 0;
 
     /**
--- a/widget/nsWidgetInitData.h
+++ b/widget/nsWidgetInitData.h
@@ -100,18 +100,17 @@ struct nsWidgetInitData {
       mDropShadow(false),
       mListenForResizes(false),
       mUnicode(true),
       mRTL(false),
       mNoAutoHide(false),
       mIsDragPopup(false),
       mIsAnimationSuppressed(false),
       mSupportTranslucency(false),
-      mMouseTransparent(false),
-      mMultiProcessWindow(false)
+      mMouseTransparent(false)
   {
   }
 
   nsWindowType  mWindowType;
   nsBorderStyle mBorderStyle;
   nsPopupType   mPopupHint;
   nsPopupLevel  mPopupLevel;
   // B2G multi-screen support. Screen ID is for differentiating screens of
@@ -127,13 +126,11 @@ struct nsWidgetInitData {
   bool          mIsDragPopup;  // true for drag feedback panels
   // true if window creation animation is suppressed, e.g. for session restore
   bool          mIsAnimationSuppressed;
   // true if the window should support an alpha channel, if available.
   bool          mSupportTranslucency;
   // true if the window should be transparent to mouse events. Currently this is
   // only valid for eWindowType_popup widgets
   bool          mMouseTransparent;
-  // This flag designates windows with out-of-process tabs.
-  bool          mMultiProcessWindow;
 };
 
 #endif // nsWidgetInitData_h__
--- a/xpfe/appshell/nsAppShellService.cpp
+++ b/xpfe/appshell/nsAppShellService.cpp
@@ -529,19 +529,16 @@ nsAppShellService::JustCreateTopWindow(n
       eWindowType_dialog : eWindowType_toplevel;
 
   if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_POPUP)
     widgetInitData.mWindowType = eWindowType_popup;
 
   if (aChromeMask & nsIWebBrowserChrome::CHROME_MAC_SUPPRESS_ANIMATION)
     widgetInitData.mIsAnimationSuppressed = true;
 
-  if (aChromeMask & nsIWebBrowserChrome::CHROME_REMOTE_WINDOW)
-    widgetInitData.mMultiProcessWindow = true;
-
 #ifdef XP_MACOSX
   // Mac OS X sheet support
   // Adding CHROME_OPENAS_CHROME to sheetMask makes modal windows opened from
   // nsGlobalWindow::ShowModalDialog() be dialogs (not sheets), while modal
   // windows opened from nsPromptService::DoDialog() still are sheets.  This
   // fixes bmo bug 395465 (see nsCocoaWindow::StandardCreate() and
   // nsCocoaWindow::SetModal()).
   uint32_t sheetMask = nsIWebBrowserChrome::CHROME_OPENAS_DIALOG |