mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Move InProcessCompositorWidget to its own file. (bug 1281998 part 3, r=jimm)
--HG-- rename : widget/CompositorWidget.cpp => widget/InProcessCompositorWidget.cpp extra : rebase_source : d885b1ec9c30e8c5558c31c6caadfc645e7ed567
This commit is contained in:
parent
804c1ee06f
commit
b4551c49b7
@ -11,6 +11,8 @@
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
using namespace widget;
|
||||
|
||||
class InProcessCompositorSession final : public CompositorSession
|
||||
{
|
||||
public:
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "mozilla/layers/CompositorOGL.h" // for CompositorOGL
|
||||
#include "mozilla/layers/CompositorTypes.h"
|
||||
#include "mozilla/layers/LayerManagerComposite.h"
|
||||
#include "mozilla/widget/InProcessCompositorWidget.h"
|
||||
#include "nsBaseWidget.h"
|
||||
#include "GLContext.h"
|
||||
#include "GLContextProvider.h"
|
||||
@ -157,7 +158,7 @@ static std::vector<LayerManagerData> GetLayerManagers(std::vector<LayersBackend>
|
||||
auto backend = aBackends[i];
|
||||
|
||||
RefPtr<MockWidget> widget = new MockWidget();
|
||||
RefPtr<widget::CompositorWidget> proxy = widget->NewCompositorWidget();
|
||||
RefPtr<widget::CompositorWidget> proxy = new widget::InProcessCompositorWidget(widget);
|
||||
RefPtr<Compositor> compositor = CreateTestCompositor(backend, proxy);
|
||||
|
||||
RefPtr<LayerManagerComposite> layerManager = new LayerManagerComposite(compositor);
|
||||
|
@ -70,117 +70,5 @@ CompositorWidget::GetGLFrameBufferFormat()
|
||||
return LOCAL_GL_RGBA;
|
||||
}
|
||||
|
||||
InProcessCompositorWidget::InProcessCompositorWidget(nsBaseWidget* aWidget)
|
||||
: mWidget(aWidget)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
InProcessCompositorWidget::PreRender(layers::LayerManagerComposite* aManager)
|
||||
{
|
||||
return mWidget->PreRender(aManager);
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorWidget::PostRender(layers::LayerManagerComposite* aManager)
|
||||
{
|
||||
mWidget->PostRender(aManager);
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorWidget::DrawWindowUnderlay(layers::LayerManagerComposite* aManager,
|
||||
LayoutDeviceIntRect aRect)
|
||||
{
|
||||
mWidget->DrawWindowUnderlay(aManager, aRect);
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorWidget::DrawWindowOverlay(layers::LayerManagerComposite* aManager,
|
||||
LayoutDeviceIntRect aRect)
|
||||
{
|
||||
mWidget->DrawWindowOverlay(aManager, aRect);
|
||||
}
|
||||
|
||||
already_AddRefed<gfx::DrawTarget>
|
||||
InProcessCompositorWidget::StartRemoteDrawing()
|
||||
{
|
||||
return mWidget->StartRemoteDrawing();
|
||||
}
|
||||
|
||||
already_AddRefed<gfx::DrawTarget>
|
||||
InProcessCompositorWidget::StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion,
|
||||
layers::BufferMode* aBufferMode)
|
||||
{
|
||||
return mWidget->StartRemoteDrawingInRegion(aInvalidRegion, aBufferMode);
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorWidget::EndRemoteDrawing()
|
||||
{
|
||||
mWidget->EndRemoteDrawing();
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorWidget::EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget,
|
||||
LayoutDeviceIntRegion& aInvalidRegion)
|
||||
{
|
||||
mWidget->EndRemoteDrawingInRegion(aDrawTarget, aInvalidRegion);
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorWidget::CleanupRemoteDrawing()
|
||||
{
|
||||
mWidget->CleanupRemoteDrawing();
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorWidget::CleanupWindowEffects()
|
||||
{
|
||||
mWidget->CleanupWindowEffects();
|
||||
}
|
||||
|
||||
bool
|
||||
InProcessCompositorWidget::InitCompositor(layers::Compositor* aCompositor)
|
||||
{
|
||||
return mWidget->InitCompositor(aCompositor);
|
||||
}
|
||||
|
||||
LayoutDeviceIntSize
|
||||
InProcessCompositorWidget::GetClientSize()
|
||||
{
|
||||
return mWidget->GetClientSize();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
InProcessCompositorWidget::GetGLFrameBufferFormat()
|
||||
{
|
||||
return mWidget->GetGLFrameBufferFormat();
|
||||
}
|
||||
|
||||
layers::Composer2D*
|
||||
InProcessCompositorWidget::GetComposer2D()
|
||||
{
|
||||
return mWidget->GetComposer2D();
|
||||
}
|
||||
|
||||
uintptr_t
|
||||
InProcessCompositorWidget::GetWidgetKey()
|
||||
{
|
||||
return reinterpret_cast<uintptr_t>(mWidget);
|
||||
}
|
||||
|
||||
nsIWidget*
|
||||
InProcessCompositorWidget::RealWidget()
|
||||
{
|
||||
return mWidget;
|
||||
}
|
||||
|
||||
already_AddRefed<CompositorVsyncDispatcher>
|
||||
InProcessCompositorWidget::GetCompositorVsyncDispatcher()
|
||||
{
|
||||
RefPtr<CompositorVsyncDispatcher> cvd = mWidget->GetCompositorVsyncDispatcher();
|
||||
return cvd.forget();
|
||||
}
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
@ -211,42 +211,6 @@ protected:
|
||||
RefPtr<gfx::DrawTarget> mLastBackBuffer;
|
||||
};
|
||||
|
||||
// This version of CompositorWidget implements a wrapper around
|
||||
// nsBaseWidget.
|
||||
class InProcessCompositorWidget : public CompositorWidget
|
||||
{
|
||||
public:
|
||||
explicit InProcessCompositorWidget(nsBaseWidget* aWidget);
|
||||
|
||||
virtual bool PreRender(layers::LayerManagerComposite* aManager) override;
|
||||
virtual void PostRender(layers::LayerManagerComposite* aManager) override;
|
||||
virtual void DrawWindowUnderlay(layers::LayerManagerComposite* aManager,
|
||||
LayoutDeviceIntRect aRect) override;
|
||||
virtual void DrawWindowOverlay(layers::LayerManagerComposite* aManager,
|
||||
LayoutDeviceIntRect aRect) override;
|
||||
virtual already_AddRefed<gfx::DrawTarget> StartRemoteDrawing() override;
|
||||
virtual already_AddRefed<gfx::DrawTarget>
|
||||
StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion,
|
||||
layers::BufferMode* aBufferMode) override;
|
||||
virtual void EndRemoteDrawing() override;
|
||||
virtual void EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget,
|
||||
LayoutDeviceIntRegion& aInvalidRegion) override;
|
||||
virtual void CleanupRemoteDrawing() override;
|
||||
virtual void CleanupWindowEffects() override;
|
||||
virtual bool InitCompositor(layers::Compositor* aCompositor) override;
|
||||
virtual LayoutDeviceIntSize GetClientSize() override;
|
||||
virtual uint32_t GetGLFrameBufferFormat() override;
|
||||
virtual layers::Composer2D* GetComposer2D() override;
|
||||
virtual already_AddRefed<CompositorVsyncDispatcher> GetCompositorVsyncDispatcher() override;
|
||||
virtual uintptr_t GetWidgetKey() override;
|
||||
|
||||
// If you can override this method, inherit from CompositorWidget instead.
|
||||
nsIWidget* RealWidget() override;
|
||||
|
||||
private:
|
||||
nsBaseWidget* mWidget;
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
|
124
widget/InProcessCompositorWidget.cpp
Normal file
124
widget/InProcessCompositorWidget.cpp
Normal file
@ -0,0 +1,124 @@
|
||||
/* 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/. */
|
||||
|
||||
#include "InProcessCompositorWidget.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
InProcessCompositorWidget::InProcessCompositorWidget(nsBaseWidget* aWidget)
|
||||
: mWidget(aWidget)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
InProcessCompositorWidget::PreRender(layers::LayerManagerComposite* aManager)
|
||||
{
|
||||
return mWidget->PreRender(aManager);
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorWidget::PostRender(layers::LayerManagerComposite* aManager)
|
||||
{
|
||||
mWidget->PostRender(aManager);
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorWidget::DrawWindowUnderlay(layers::LayerManagerComposite* aManager,
|
||||
LayoutDeviceIntRect aRect)
|
||||
{
|
||||
mWidget->DrawWindowUnderlay(aManager, aRect);
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorWidget::DrawWindowOverlay(layers::LayerManagerComposite* aManager,
|
||||
LayoutDeviceIntRect aRect)
|
||||
{
|
||||
mWidget->DrawWindowOverlay(aManager, aRect);
|
||||
}
|
||||
|
||||
already_AddRefed<gfx::DrawTarget>
|
||||
InProcessCompositorWidget::StartRemoteDrawing()
|
||||
{
|
||||
return mWidget->StartRemoteDrawing();
|
||||
}
|
||||
|
||||
already_AddRefed<gfx::DrawTarget>
|
||||
InProcessCompositorWidget::StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion,
|
||||
layers::BufferMode* aBufferMode)
|
||||
{
|
||||
return mWidget->StartRemoteDrawingInRegion(aInvalidRegion, aBufferMode);
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorWidget::EndRemoteDrawing()
|
||||
{
|
||||
mWidget->EndRemoteDrawing();
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorWidget::EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget,
|
||||
LayoutDeviceIntRegion& aInvalidRegion)
|
||||
{
|
||||
mWidget->EndRemoteDrawingInRegion(aDrawTarget, aInvalidRegion);
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorWidget::CleanupRemoteDrawing()
|
||||
{
|
||||
mWidget->CleanupRemoteDrawing();
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorWidget::CleanupWindowEffects()
|
||||
{
|
||||
mWidget->CleanupWindowEffects();
|
||||
}
|
||||
|
||||
bool
|
||||
InProcessCompositorWidget::InitCompositor(layers::Compositor* aCompositor)
|
||||
{
|
||||
return mWidget->InitCompositor(aCompositor);
|
||||
}
|
||||
|
||||
LayoutDeviceIntSize
|
||||
InProcessCompositorWidget::GetClientSize()
|
||||
{
|
||||
return mWidget->GetClientSize();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
InProcessCompositorWidget::GetGLFrameBufferFormat()
|
||||
{
|
||||
return mWidget->GetGLFrameBufferFormat();
|
||||
}
|
||||
|
||||
layers::Composer2D*
|
||||
InProcessCompositorWidget::GetComposer2D()
|
||||
{
|
||||
return mWidget->GetComposer2D();
|
||||
}
|
||||
|
||||
uintptr_t
|
||||
InProcessCompositorWidget::GetWidgetKey()
|
||||
{
|
||||
return reinterpret_cast<uintptr_t>(mWidget);
|
||||
}
|
||||
|
||||
nsIWidget*
|
||||
InProcessCompositorWidget::RealWidget()
|
||||
{
|
||||
return mWidget;
|
||||
}
|
||||
|
||||
already_AddRefed<CompositorVsyncDispatcher>
|
||||
InProcessCompositorWidget::GetCompositorVsyncDispatcher()
|
||||
{
|
||||
RefPtr<CompositorVsyncDispatcher> cvd = mWidget->GetCompositorVsyncDispatcher();
|
||||
return cvd.forget();
|
||||
}
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
52
widget/InProcessCompositorWidget.h
Normal file
52
widget/InProcessCompositorWidget.h
Normal file
@ -0,0 +1,52 @@
|
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_widget_InProcessCompositorWidget_h__
|
||||
#define mozilla_widget_InProcessCompositorWidget_h__
|
||||
|
||||
#include "CompositorWidget.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
// This version of CompositorWidget implements a wrapper around
|
||||
// nsBaseWidget.
|
||||
class InProcessCompositorWidget : public CompositorWidget
|
||||
{
|
||||
public:
|
||||
explicit InProcessCompositorWidget(nsBaseWidget* aWidget);
|
||||
|
||||
virtual bool PreRender(layers::LayerManagerComposite* aManager) override;
|
||||
virtual void PostRender(layers::LayerManagerComposite* aManager) override;
|
||||
virtual void DrawWindowUnderlay(layers::LayerManagerComposite* aManager,
|
||||
LayoutDeviceIntRect aRect) override;
|
||||
virtual void DrawWindowOverlay(layers::LayerManagerComposite* aManager,
|
||||
LayoutDeviceIntRect aRect) override;
|
||||
virtual already_AddRefed<gfx::DrawTarget> StartRemoteDrawing() override;
|
||||
virtual already_AddRefed<gfx::DrawTarget>
|
||||
StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion,
|
||||
layers::BufferMode* aBufferMode) override;
|
||||
virtual void EndRemoteDrawing() override;
|
||||
virtual void EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget,
|
||||
LayoutDeviceIntRegion& aInvalidRegion) override;
|
||||
virtual void CleanupRemoteDrawing() override;
|
||||
virtual void CleanupWindowEffects() override;
|
||||
virtual bool InitCompositor(layers::Compositor* aCompositor) override;
|
||||
virtual LayoutDeviceIntSize GetClientSize() override;
|
||||
virtual uint32_t GetGLFrameBufferFormat() override;
|
||||
virtual layers::Composer2D* GetComposer2D() override;
|
||||
virtual already_AddRefed<CompositorVsyncDispatcher> GetCompositorVsyncDispatcher() override;
|
||||
virtual uintptr_t GetWidgetKey() override;
|
||||
|
||||
// If you can override this method, inherit from CompositorWidget instead.
|
||||
nsIWidget* RealWidget() override;
|
||||
|
||||
private:
|
||||
nsBaseWidget* mWidget;
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
@ -130,6 +130,7 @@ EXPORTS.mozilla += [
|
||||
EXPORTS.mozilla.widget += [
|
||||
'CompositorWidget.h',
|
||||
'IMEData.h',
|
||||
'InProcessCompositorWidget.h',
|
||||
'PuppetBidiKeyboard.h',
|
||||
'WidgetMessageUtils.h',
|
||||
]
|
||||
@ -141,6 +142,7 @@ UNIFIED_SOURCES += [
|
||||
'GfxInfoBase.cpp',
|
||||
'GfxInfoCollector.cpp',
|
||||
'GfxInfoWebGL.cpp',
|
||||
'InProcessCompositorWidget.cpp',
|
||||
'InputData.cpp',
|
||||
'nsBaseAppShell.cpp',
|
||||
'nsBaseScreen.cpp',
|
||||
|
@ -72,6 +72,7 @@
|
||||
#endif
|
||||
#include "gfxConfig.h"
|
||||
#include "mozilla/layers/CompositorSession.h"
|
||||
#include "InProcessCompositorWidget.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "nsIObserver.h"
|
||||
|
Loading…
Reference in New Issue
Block a user