From bb2cbc24f4cb9bee50a46ba7a520b9016d5207a5 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 17 May 2016 22:33:21 -0700 Subject: [PATCH] Remove nsBaseWidget::NewCompositorBridgeParent. (bug 1272472 part 1, r=kats) --- widget/android/nsWindow.cpp | 13 ------------- widget/android/nsWindow.h | 7 ++++--- widget/gonk/nsWindow.cpp | 12 ------------ widget/gonk/nsWindow.h | 6 ++++-- widget/nsBaseWidget.cpp | 26 +++++++++++--------------- widget/nsBaseWidget.h | 6 +++++- 6 files changed, 24 insertions(+), 46 deletions(-) diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index e6453e66b2af..899f9cefe585 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -3569,19 +3569,6 @@ nsWindow::NeedsPaint() return nsIWidget::NeedsPaint(); } -CompositorBridgeParent* -nsWindow::NewCompositorBridgeParent(int aSurfaceWidth, int aSurfaceHeight) -{ - if (!mCompositorWidgetProxy) { - mCompositorWidgetProxy = NewCompositorWidgetProxy(); - } - return new CompositorBridgeParent(mCompositorWidgetProxy, - GetDefaultScale(), - UseAPZ(), - true, - aSurfaceWidth, aSurfaceHeight); -} - void nsWindow::ConfigureAPZControllerThread() { diff --git a/widget/android/nsWindow.h b/widget/android/nsWindow.h index ccf857589d46..0ad477b7ecdc 100644 --- a/widget/android/nsWindow.h +++ b/widget/android/nsWindow.h @@ -177,9 +177,6 @@ public: virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, LayoutDeviceIntRect aRect) override; virtual void DrawWindowOverlay(LayerManagerComposite* aManager, LayoutDeviceIntRect aRect) override; - virtual mozilla::layers::CompositorBridgeParent* NewCompositorBridgeParent( - int aSurfaceWidth, int aSurfaceHeight) override; - static bool IsCompositionPaused(); static void InvalidateAndScheduleComposite(); static void SchedulePauseComposition(); @@ -239,6 +236,10 @@ protected: virtual nsresult NotifyIMEInternal( const IMENotification& aIMENotification) override; + bool UseExternalCompositingSurface() const override { + return true; + } + static void DumpWindows(); static void DumpWindows(const nsTArray& wins, int indent = 0); static void LogWindow(nsWindow *win, int index, int indent); diff --git a/widget/gonk/nsWindow.cpp b/widget/gonk/nsWindow.cpp index ffec3cc88f2c..61e999046be8 100644 --- a/widget/gonk/nsWindow.cpp +++ b/widget/gonk/nsWindow.cpp @@ -720,18 +720,6 @@ nsWindow::DestroyCompositor() nsBaseWidget::DestroyCompositor(); } -CompositorBridgeParent* -nsWindow::NewCompositorBridgeParent(int aSurfaceWidth, int aSurfaceHeight) -{ - if (!mCompositorWidgetProxy) { - mCompositorWidgetProxy = NewCompositorWidgetProxy(); - } - return new CompositorBridgeParent(mCompositorWidgetProxy, - GetDefaultScale(), - UseAPZ(), - true, aSurfaceWidth, aSurfaceHeight); -} - void nsWindow::BringToTop() { diff --git a/widget/gonk/nsWindow.h b/widget/gonk/nsWindow.h index 74cecc66b6b2..98edfff4c934 100644 --- a/widget/gonk/nsWindow.h +++ b/widget/gonk/nsWindow.h @@ -117,8 +117,6 @@ public: bool* aAllowRetaining = nullptr); virtual void DestroyCompositor(); - virtual CompositorBridgeParent* NewCompositorBridgeParent(int aSurfaceWidth, int aSurfaceHeight); - NS_IMETHOD_(void) SetInputContext(const InputContext& aContext, const InputContextAction& aAction); NS_IMETHOD_(InputContext) GetInputContext(); @@ -148,6 +146,10 @@ protected: // event (like a keypress or mouse click). void UserActivity(); + bool UseExternalCompositingSurface() const override { + return true; + } + private: // This is used by SynthesizeNativeTouchPoint to maintain state between // multiple synthesized points diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp index bb6f6092fe39..e4c1fa4f57dd 100644 --- a/widget/nsBaseWidget.cpp +++ b/widget/nsBaseWidget.cpp @@ -937,20 +937,6 @@ nsBaseWidget::UseAPZ() (WindowType() == eWindowType_toplevel || WindowType() == eWindowType_child)); } -CompositorBridgeParent* -nsBaseWidget::NewCompositorBridgeParent(int aSurfaceWidth, - int aSurfaceHeight) -{ - if (!mCompositorWidgetProxy) { - mCompositorWidgetProxy = NewCompositorWidgetProxy(); - } - return new CompositorBridgeParent(mCompositorWidgetProxy, - GetDefaultScale(), - UseAPZ(), - false, - aSurfaceWidth, aSurfaceHeight); -} - void nsBaseWidget::CreateCompositor() { LayoutDeviceIntRect rect; @@ -1286,7 +1272,17 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight) } CreateCompositorVsyncDispatcher(); - mCompositorBridgeParent = NewCompositorBridgeParent(aWidth, aHeight); + + if (!mCompositorWidgetProxy) { + mCompositorWidgetProxy = NewCompositorWidgetProxy(); + } + + mCompositorBridgeParent = new CompositorBridgeParent( + mCompositorWidgetProxy, + GetDefaultScale(), + UseAPZ(), + UseExternalCompositingSurface(), + aWidth, aHeight); RefPtr lm = new ClientLayerManager(this); mCompositorBridgeChild = new CompositorBridgeChild(lm); mCompositorBridgeChild->OpenSameProcess(mCompositorBridgeParent); diff --git a/widget/nsBaseWidget.h b/widget/nsBaseWidget.h index 09624e50cce0..37afbd425a80 100644 --- a/widget/nsBaseWidget.h +++ b/widget/nsBaseWidget.h @@ -170,7 +170,6 @@ public: mozilla::CompositorVsyncDispatcher* GetCompositorVsyncDispatcher(); void CreateCompositorVsyncDispatcher(); - virtual CompositorBridgeParent* NewCompositorBridgeParent(int aSurfaceWidth, int aSurfaceHeight); virtual void CreateCompositor(); virtual void CreateCompositor(int aWidth, int aHeight); virtual void PrepareWindowEffects() override {} @@ -538,6 +537,11 @@ protected: bool UseAPZ(); protected: + // Returns whether compositing should use an external surface size. + virtual bool UseExternalCompositingSurface() const { + return false; + } + /** * Starts the OMTC compositor destruction sequence. *