зеркало из https://github.com/mozilla/gecko-dev.git
Move CompositorWidget construction out of nsIWidget. (bug 1281998 part 5, r=jimm)
This commit is contained in:
Родитель
f0edea202e
Коммит
6562af780a
|
@ -6,6 +6,7 @@
|
|||
#include "CompositorSession.h"
|
||||
#include "mozilla/layers/CompositorBridgeChild.h"
|
||||
#include "mozilla/layers/CompositorBridgeParent.h"
|
||||
#include "mozilla/widget/PlatformWidgetTypes.h"
|
||||
#include "base/process_util.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -73,7 +74,10 @@ InProcessCompositorSession::InProcessCompositorSession(nsIWidget* aWidget,
|
|||
bool aUseExternalSurfaceSize,
|
||||
const gfx::IntSize& aSurfaceSize)
|
||||
{
|
||||
mCompositorWidget = aWidget->NewCompositorWidget();
|
||||
CompositorWidgetInitData initData;
|
||||
aWidget->GetCompositorWidgetInitData(&initData);
|
||||
mCompositorWidget = CompositorWidget::CreateLocal(initData, aWidget);
|
||||
|
||||
mCompositorBridgeParent = new CompositorBridgeParent(
|
||||
mCompositorWidget,
|
||||
aScale,
|
||||
|
|
|
@ -34,6 +34,7 @@ class CompositorSession
|
|||
{
|
||||
friend class gfx::GPUProcessManager;
|
||||
|
||||
protected:
|
||||
typedef widget::CompositorWidget CompositorWidget;
|
||||
|
||||
public:
|
||||
|
|
|
@ -29,6 +29,7 @@ class SourceSurface;
|
|||
namespace widget {
|
||||
|
||||
class WinCompositorWidget;
|
||||
class CompositorWidgetInitData;
|
||||
|
||||
/**
|
||||
* Access to a widget from the compositor is restricted to these methods.
|
||||
|
@ -38,6 +39,12 @@ class CompositorWidget
|
|||
public:
|
||||
NS_INLINE_DECL_REFCOUNTING(mozilla::widget::CompositorWidget)
|
||||
|
||||
/**
|
||||
* Create an in-process compositor widget. aWidget may be ignored if the
|
||||
* platform does not require it.
|
||||
*/
|
||||
static RefPtr<CompositorWidget> CreateLocal(const CompositorWidgetInitData& aInitData, nsIWidget* aWidget);
|
||||
|
||||
/**
|
||||
* Called before rendering using OMTC. Returns false when the widget is
|
||||
* not ready to be rendered (for example while the window is closed).
|
||||
|
|
|
@ -3,10 +3,22 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "InProcessCompositorWidget.h"
|
||||
#include "nsBaseWidget.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
// Platforms with no OOP compositor process support use
|
||||
// InProcessCompositorWidget by default.
|
||||
#if !defined(XP_WIN)
|
||||
/* static */ RefPtr<CompositorWidget>
|
||||
CompositorWidget::CreateLocal(const CompositorWidgetInitData& aInitData, nsIWidget* aWidget)
|
||||
{
|
||||
MOZ_ASSERT(aWidget);
|
||||
return new InProcessCompositorWidget(static_cast<nsBaseWidget*>(aWidget));
|
||||
}
|
||||
#endif
|
||||
|
||||
InProcessCompositorWidget::InProcessCompositorWidget(nsBaseWidget* aWidget)
|
||||
: mWidget(aWidget)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=99: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// This file is a stub, for platforms that do not yet support out-of-process
|
||||
// compositing or do not need specialized types to do so.
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
struct CompositorWidgetInitData
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
|
@ -279,12 +279,6 @@ protected:
|
|||
virtual nsresult NotifyIMEInternal(
|
||||
const IMENotification& aIMENotification) override;
|
||||
|
||||
// PuppetWidgets do not create compositors.
|
||||
widget::CompositorWidget* NewCompositorWidget() override {
|
||||
MOZ_ASSERT_UNREACHABLE("PuppetWidgets should not have widget proxies");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
nsresult Paint();
|
||||
|
||||
|
|
|
@ -353,10 +353,6 @@ public:
|
|||
|
||||
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent) override;
|
||||
|
||||
CompositorWidget* NewCompositorWidget() override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~nsCocoaWindow();
|
||||
|
||||
|
|
|
@ -242,6 +242,15 @@ LOCAL_INCLUDES += [
|
|||
'/widget',
|
||||
]
|
||||
|
||||
if toolkit == 'windows':
|
||||
IPDL_SOURCES = [
|
||||
'windows/PlatformWidgetTypes.ipdlh',
|
||||
]
|
||||
else:
|
||||
IPDL_SOURCES = [
|
||||
'PlatformWidgetTypes.ipdlh',
|
||||
]
|
||||
|
||||
widget_dir = toolkit
|
||||
if widget_dir in ('gtk3', 'gtk2'):
|
||||
# gtk3 shares includes with gtk2
|
||||
|
|
|
@ -72,7 +72,6 @@
|
|||
#endif
|
||||
#include "gfxConfig.h"
|
||||
#include "mozilla/layers/CompositorSession.h"
|
||||
#include "InProcessCompositorWidget.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "nsIObserver.h"
|
||||
|
@ -1415,12 +1414,6 @@ nsBaseWidget::GetGLFrameBufferFormat()
|
|||
return LOCAL_GL_RGBA;
|
||||
}
|
||||
|
||||
mozilla::widget::CompositorWidget*
|
||||
nsBaseWidget::NewCompositorWidget()
|
||||
{
|
||||
return new mozilla::widget::InProcessCompositorWidget(this);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Destroy the window
|
||||
|
|
|
@ -354,8 +354,6 @@ public:
|
|||
|
||||
void Shutdown();
|
||||
|
||||
virtual mozilla::widget::CompositorWidget* NewCompositorWidget() override;
|
||||
|
||||
protected:
|
||||
// These are methods for CompositorWidgetWrapper, and should only be
|
||||
// accessed from that class. Derived widgets can choose which methods to
|
||||
|
|
|
@ -66,6 +66,7 @@ namespace widget {
|
|||
class TextEventDispatcher;
|
||||
class TextEventDispatcherListener;
|
||||
class CompositorWidget;
|
||||
class CompositorWidgetInitData;
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -1627,8 +1628,10 @@ class nsIWidget : public nsISupports
|
|||
|
||||
virtual void StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics) = 0;
|
||||
|
||||
// Return a new CompositorWidget for this widget.
|
||||
virtual mozilla::widget::CompositorWidget* NewCompositorWidget() = 0;
|
||||
// If this widget supports out-of-process compositing, it can override
|
||||
// this method to provide additional information to the compositor.
|
||||
virtual void GetCompositorWidgetInitData(mozilla::widget::CompositorWidgetInitData* aInitData)
|
||||
{}
|
||||
|
||||
private:
|
||||
class LongTapInfo
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=99: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// This file is a stub, for platforms that do not yet support out-of-process
|
||||
// compositing or do not need specialized types to do so.
|
||||
|
||||
using mozilla::WindowsHandle from "ipc/IPCMessageUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
struct CompositorWidgetInitData
|
||||
{
|
||||
WindowsHandle hWnd;
|
||||
uintptr_t widgetKey;
|
||||
int32_t transparencyMode;
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
|
@ -7,20 +7,25 @@
|
|||
#include "nsWindow.h"
|
||||
#include "VsyncDispatcher.h"
|
||||
#include "mozilla/gfx/Point.h"
|
||||
#include "mozilla/widget/PlatformWidgetTypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
WinCompositorWidget::WinCompositorWidget(HWND aWnd,
|
||||
uintptr_t aWidgetKey,
|
||||
nsTransparencyMode aMode,
|
||||
/* static */ RefPtr<CompositorWidget>
|
||||
CompositorWidget::CreateLocal(const CompositorWidgetInitData& aInitData, nsIWidget* aWidget)
|
||||
{
|
||||
return new WinCompositorWidget(aInitData, static_cast<nsWindow*>(aWidget));
|
||||
}
|
||||
|
||||
WinCompositorWidget::WinCompositorWidget(const CompositorWidgetInitData& aInitData,
|
||||
nsWindow* aWindow)
|
||||
: mWindow(aWindow),
|
||||
mWidgetKey(aWidgetKey),
|
||||
mWnd(aWnd),
|
||||
mTransparencyMode(aMode),
|
||||
mWidgetKey(aInitData.widgetKey()),
|
||||
mWnd(reinterpret_cast<HWND>(aInitData.hWnd())),
|
||||
mTransparencyMode(static_cast<nsTransparencyMode>(aInitData.transparencyMode())),
|
||||
mMemoryDC(nullptr),
|
||||
mCompositeDC(nullptr),
|
||||
mLockedBackBufferData(nullptr)
|
||||
|
|
|
@ -21,9 +21,7 @@ namespace widget {
|
|||
class WinCompositorWidget: public CompositorWidget
|
||||
{
|
||||
public:
|
||||
WinCompositorWidget(HWND aWnd,
|
||||
uintptr_t aWidgetKey,
|
||||
nsTransparencyMode aMode,
|
||||
WinCompositorWidget(const CompositorWidgetInitData& aInitData,
|
||||
nsWindow* aWindow = nullptr);
|
||||
|
||||
bool PreRender(layers::LayerManagerComposite*) override;
|
||||
|
|
|
@ -136,6 +136,7 @@
|
|||
#include "mozilla/TextEvents.h" // For WidgetKeyboardEvent
|
||||
#include "mozilla/TextEventDispatcherListener.h"
|
||||
#include "mozilla/widget/WinNativeEventData.h"
|
||||
#include "mozilla/widget/PlatformWidgetTypes.h"
|
||||
#include "nsThemeConstants.h"
|
||||
#include "nsBidiKeyboard.h"
|
||||
#include "nsThemeConstants.h"
|
||||
|
@ -3621,11 +3622,11 @@ nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager,
|
|||
|
||||
// Ensure we have a widget proxy even if we're not using the compositor,
|
||||
// since all our transparent window handling lives there.
|
||||
mCompositorWidget = new WinCompositorWidget(
|
||||
mWnd,
|
||||
reinterpret_cast<uintptr_t>(this),
|
||||
mTransparencyMode,
|
||||
this);
|
||||
CompositorWidgetInitData initData(
|
||||
reinterpret_cast<uintptr_t>(mWnd),
|
||||
reinterpret_cast<uintptr_t>(static_cast<nsIWidget*>(this)),
|
||||
mTransparencyMode);
|
||||
mCompositorWidget = new WinCompositorWidget(initData, this);
|
||||
mLayerManager = CreateBasicLayerManager();
|
||||
}
|
||||
|
||||
|
@ -3686,16 +3687,6 @@ nsWindow::OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
mozilla::widget::CompositorWidget*
|
||||
nsWindow::NewCompositorWidget()
|
||||
{
|
||||
return new WinCompositorWidget(
|
||||
mWnd,
|
||||
reinterpret_cast<uintptr_t>(this),
|
||||
mTransparencyMode,
|
||||
this);
|
||||
}
|
||||
|
||||
mozilla::widget::WinCompositorWidget*
|
||||
nsWindow::GetCompositorWidget()
|
||||
{
|
||||
|
@ -7825,3 +7816,11 @@ DWORD ChildWindow::WindowStyle()
|
|||
VERIFY_WINDOW_STYLE(style);
|
||||
return style;
|
||||
}
|
||||
|
||||
void
|
||||
nsWindow::GetCompositorWidgetInitData(mozilla::widget::CompositorWidgetInitData* aInitData)
|
||||
{
|
||||
aInitData->hWnd() = reinterpret_cast<uintptr_t>(mWnd);
|
||||
aInitData->widgetKey() = reinterpret_cast<uintptr_t>(static_cast<nsIWidget*>(this));
|
||||
aInitData->transparencyMode() = mTransparencyMode;
|
||||
}
|
||||
|
|
|
@ -312,7 +312,7 @@ public:
|
|||
const mozilla::NativeEventData& aKeyEventData,
|
||||
nsIKeyEventInPluginCallback* aCallback) override;
|
||||
|
||||
mozilla::widget::CompositorWidget* NewCompositorWidget() override;
|
||||
void GetCompositorWidgetInitData(mozilla::widget::CompositorWidgetInitData* aInitData) override;
|
||||
|
||||
protected:
|
||||
virtual ~nsWindow();
|
||||
|
|
Загрузка…
Ссылка в новой задаче