зеркало из https://github.com/mozilla/gecko-dev.git
Split InProcessCompositorBridge to its own file. (bug 1282348 part 2, r=mattwoodrow)
--HG-- rename : gfx/ipc/CompositorSession.cpp => gfx/ipc/InProcessCompositorSession.cpp
This commit is contained in:
Родитель
9e653f7da3
Коммит
8760583973
|
@ -14,46 +14,9 @@ namespace layers {
|
|||
|
||||
using namespace widget;
|
||||
|
||||
class InProcessCompositorSession final : public CompositorSession
|
||||
{
|
||||
public:
|
||||
InProcessCompositorSession(widget::CompositorWidget* aWidget,
|
||||
CompositorBridgeChild* aChild,
|
||||
CompositorBridgeParent* aParent);
|
||||
|
||||
CompositorBridgeParent* GetInProcessBridge() const override;
|
||||
void SetContentController(GeckoContentController* aController) override;
|
||||
uint64_t RootLayerTreeId() const override;
|
||||
already_AddRefed<APZCTreeManager> GetAPZCTreeManager() const override;
|
||||
void Shutdown() override;
|
||||
|
||||
private:
|
||||
RefPtr<CompositorBridgeParent> mCompositorBridgeParent;
|
||||
RefPtr<CompositorWidget> mCompositorWidget;
|
||||
};
|
||||
|
||||
RefPtr<CompositorSession>
|
||||
CompositorSession::CreateInProcess(nsIWidget* aWidget,
|
||||
ClientLayerManager* aLayerManager,
|
||||
CSSToLayoutDeviceScale aScale,
|
||||
bool aUseAPZ,
|
||||
bool aUseExternalSurfaceSize,
|
||||
const gfx::IntSize& aSurfaceSize)
|
||||
{
|
||||
CompositorWidgetInitData initData;
|
||||
aWidget->GetCompositorWidgetInitData(&initData);
|
||||
|
||||
RefPtr<CompositorWidget> widget = CompositorWidget::CreateLocal(initData, aWidget);
|
||||
RefPtr<CompositorBridgeChild> child = new CompositorBridgeChild(aLayerManager);
|
||||
RefPtr<CompositorBridgeParent> parent =
|
||||
child->InitSameProcess(widget, aScale, aUseAPZ, aUseExternalSurfaceSize, aSurfaceSize);
|
||||
|
||||
return new InProcessCompositorSession(widget, child, parent);
|
||||
}
|
||||
|
||||
CompositorSession::CompositorSession(CompositorWidgetDelegate* aDelegate,
|
||||
CompositorBridgeChild* aChild)
|
||||
: mCompositorWidgetDelegate(nullptr),
|
||||
: mCompositorWidgetDelegate(aDelegate),
|
||||
mCompositorBridgeChild(aChild)
|
||||
{
|
||||
}
|
||||
|
@ -68,51 +31,5 @@ CompositorSession::GetCompositorBridgeChild()
|
|||
return mCompositorBridgeChild;
|
||||
}
|
||||
|
||||
InProcessCompositorSession::InProcessCompositorSession(widget::CompositorWidget* aWidget,
|
||||
CompositorBridgeChild* aChild,
|
||||
CompositorBridgeParent* aParent)
|
||||
: CompositorSession(aWidget->AsDelegate(), aChild),
|
||||
mCompositorBridgeParent(aParent),
|
||||
mCompositorWidget(aWidget)
|
||||
{
|
||||
}
|
||||
|
||||
CompositorBridgeParent*
|
||||
InProcessCompositorSession::GetInProcessBridge() const
|
||||
{
|
||||
return mCompositorBridgeParent;
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorSession::SetContentController(GeckoContentController* aController)
|
||||
{
|
||||
mCompositorBridgeParent->SetControllerForLayerTree(RootLayerTreeId(), aController);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
InProcessCompositorSession::RootLayerTreeId() const
|
||||
{
|
||||
return mCompositorBridgeParent->RootLayerTreeId();
|
||||
}
|
||||
|
||||
already_AddRefed<APZCTreeManager>
|
||||
InProcessCompositorSession::GetAPZCTreeManager() const
|
||||
{
|
||||
return mCompositorBridgeParent->GetAPZCTreeManager(RootLayerTreeId());
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorSession::Shutdown()
|
||||
{
|
||||
// Destroy will synchronously wait for the parent to acknowledge shutdown,
|
||||
// at which point CBP will defer a Release on the compositor thread. We
|
||||
// can safely release our reference now, and let the destructor run on either
|
||||
// thread.
|
||||
mCompositorBridgeChild->Destroy();
|
||||
mCompositorBridgeChild = nullptr;
|
||||
mCompositorBridgeParent = nullptr;
|
||||
mCompositorWidget = nullptr;
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
#define _include_mozilla_gfx_ipc_CompositorSession_h_
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "Units.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "mozilla/gfx/Point.h"
|
||||
|
||||
class nsIWidget;
|
||||
|
||||
|
@ -69,14 +67,6 @@ protected:
|
|||
CompositorBridgeChild* aChild);
|
||||
virtual ~CompositorSession();
|
||||
|
||||
static RefPtr<CompositorSession> CreateInProcess(
|
||||
nsIWidget* aWidget,
|
||||
ClientLayerManager* aLayerManager,
|
||||
CSSToLayoutDeviceScale aScale,
|
||||
bool aUseAPZ,
|
||||
bool aUseExternalSurfaceSize,
|
||||
const gfx::IntSize& aSurfaceSize);
|
||||
|
||||
protected:
|
||||
CompositorWidgetDelegate* mCompositorWidgetDelegate;
|
||||
RefPtr<CompositorBridgeChild> mCompositorBridgeChild;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "GPUProcessManager.h"
|
||||
#include "GPUProcessHost.h"
|
||||
#include "mozilla/layers/CompositorSession.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/layers/InProcessCompositorSession.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -157,7 +157,7 @@ GPUProcessManager::CreateTopLevelCompositor(nsIWidget* aWidget,
|
|||
bool aUseExternalSurfaceSize,
|
||||
const gfx::IntSize& aSurfaceSize)
|
||||
{
|
||||
return CompositorSession::CreateInProcess(
|
||||
return InProcessCompositorSession::Create(
|
||||
aWidget,
|
||||
aLayerManager,
|
||||
aScale,
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
/* -*- 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/. */
|
||||
|
||||
#include "InProcessCompositorSession.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
InProcessCompositorSession::InProcessCompositorSession(widget::CompositorWidget* aWidget,
|
||||
CompositorBridgeChild* aChild,
|
||||
CompositorBridgeParent* aParent)
|
||||
: CompositorSession(aWidget->AsDelegate(), aChild),
|
||||
mCompositorBridgeParent(aParent),
|
||||
mCompositorWidget(aWidget)
|
||||
{
|
||||
}
|
||||
|
||||
/* static */ RefPtr<InProcessCompositorSession>
|
||||
InProcessCompositorSession::Create(nsIWidget* aWidget,
|
||||
ClientLayerManager* aLayerManager,
|
||||
CSSToLayoutDeviceScale aScale,
|
||||
bool aUseAPZ,
|
||||
bool aUseExternalSurfaceSize,
|
||||
const gfx::IntSize& aSurfaceSize)
|
||||
{
|
||||
CompositorWidgetInitData initData;
|
||||
aWidget->GetCompositorWidgetInitData(&initData);
|
||||
|
||||
RefPtr<CompositorWidget> widget = CompositorWidget::CreateLocal(initData, aWidget);
|
||||
RefPtr<CompositorBridgeChild> child = new CompositorBridgeChild(aLayerManager);
|
||||
RefPtr<CompositorBridgeParent> parent =
|
||||
child->InitSameProcess(widget, aScale, aUseAPZ, aUseExternalSurfaceSize, aSurfaceSize);
|
||||
|
||||
return new InProcessCompositorSession(widget, child, parent);
|
||||
}
|
||||
|
||||
CompositorBridgeParent*
|
||||
InProcessCompositorSession::GetInProcessBridge() const
|
||||
{
|
||||
return mCompositorBridgeParent;
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorSession::SetContentController(GeckoContentController* aController)
|
||||
{
|
||||
mCompositorBridgeParent->SetControllerForLayerTree(RootLayerTreeId(), aController);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
InProcessCompositorSession::RootLayerTreeId() const
|
||||
{
|
||||
return mCompositorBridgeParent->RootLayerTreeId();
|
||||
}
|
||||
|
||||
already_AddRefed<APZCTreeManager>
|
||||
InProcessCompositorSession::GetAPZCTreeManager() const
|
||||
{
|
||||
return mCompositorBridgeParent->GetAPZCTreeManager(RootLayerTreeId());
|
||||
}
|
||||
|
||||
void
|
||||
InProcessCompositorSession::Shutdown()
|
||||
{
|
||||
// Destroy will synchronously wait for the parent to acknowledge shutdown,
|
||||
// at which point CBP will defer a Release on the compositor thread. We
|
||||
// can safely release our reference now, and let the destructor run on either
|
||||
// thread.
|
||||
mCompositorBridgeChild->Destroy();
|
||||
mCompositorBridgeChild = nullptr;
|
||||
mCompositorBridgeParent = nullptr;
|
||||
mCompositorWidget = nullptr;
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
|
@ -0,0 +1,48 @@
|
|||
/* -*- 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/. */
|
||||
#ifndef _include_mozilla_gfx_ipc_InProcessCompositorSession_h_
|
||||
#define _include_mozilla_gfx_ipc_InProcessCompositorSession_h_
|
||||
|
||||
#include "CompositorSession.h"
|
||||
#include "mozilla/gfx/Point.h"
|
||||
#include "Units.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
// A CompositorSession where both the child and parent CompositorBridge reside
|
||||
// in the same process.
|
||||
class InProcessCompositorSession final : public CompositorSession
|
||||
{
|
||||
public:
|
||||
static RefPtr<InProcessCompositorSession> Create(
|
||||
nsIWidget* aWidget,
|
||||
ClientLayerManager* aLayerManager,
|
||||
CSSToLayoutDeviceScale aScale,
|
||||
bool aUseAPZ,
|
||||
bool aUseExternalSurfaceSize,
|
||||
const gfx::IntSize& aSurfaceSize);
|
||||
|
||||
CompositorBridgeParent* GetInProcessBridge() const override;
|
||||
void SetContentController(GeckoContentController* aController) override;
|
||||
uint64_t RootLayerTreeId() const override;
|
||||
already_AddRefed<APZCTreeManager> GetAPZCTreeManager() const override;
|
||||
void Shutdown() override;
|
||||
|
||||
private:
|
||||
InProcessCompositorSession(widget::CompositorWidget* aWidget,
|
||||
CompositorBridgeChild* aChild,
|
||||
CompositorBridgeParent* aParent);
|
||||
|
||||
private:
|
||||
RefPtr<CompositorBridgeParent> mCompositorBridgeParent;
|
||||
RefPtr<CompositorWidget> mCompositorWidget;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // _include_mozilla_gfx_ipc_InProcessCompositorSession_h_
|
|
@ -20,6 +20,7 @@ EXPORTS.mozilla.gfx += [
|
|||
|
||||
EXPORTS.mozilla.layers += [
|
||||
'CompositorSession.h',
|
||||
'InProcessCompositorSession.h',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
|
@ -40,6 +41,7 @@ UNIFIED_SOURCES += [
|
|||
'GPUProcessHost.cpp',
|
||||
'GPUProcessImpl.cpp',
|
||||
'GPUProcessManager.cpp',
|
||||
'InProcessCompositorSession.cpp',
|
||||
'SharedDIB.cpp',
|
||||
]
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче