зеркало из https://github.com/mozilla/gecko-dev.git
Move layers ID allocation to GPUProcessManager. (bug 1282348 part 3, r=mattwoodrow)
This commit is contained in:
Родитель
8760583973
Коммит
2daec996e9
|
@ -14,10 +14,13 @@ namespace layers {
|
|||
|
||||
using namespace widget;
|
||||
|
||||
|
||||
CompositorSession::CompositorSession(CompositorWidgetDelegate* aDelegate,
|
||||
CompositorBridgeChild* aChild)
|
||||
CompositorBridgeChild* aChild,
|
||||
const uint64_t& aRootLayerTreeId)
|
||||
: mCompositorWidgetDelegate(aDelegate),
|
||||
mCompositorBridgeChild(aChild)
|
||||
mCompositorBridgeChild(aChild),
|
||||
mRootLayerTreeId(aRootLayerTreeId)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -48,9 +48,6 @@ public:
|
|||
// Set the GeckoContentController for the root of the layer tree.
|
||||
virtual void SetContentController(GeckoContentController* aController) = 0;
|
||||
|
||||
// Return the id of the root layer tree.
|
||||
virtual uint64_t RootLayerTreeId() const = 0;
|
||||
|
||||
// Return the Async Pan/Zoom Tree Manager for this compositor.
|
||||
virtual already_AddRefed<APZCTreeManager> GetAPZCTreeManager() const = 0;
|
||||
|
||||
|
@ -62,14 +59,21 @@ public:
|
|||
return mCompositorWidgetDelegate;
|
||||
}
|
||||
|
||||
// Return the id of the root layer tree.
|
||||
uint64_t RootLayerTreeId() const {
|
||||
return mRootLayerTreeId;
|
||||
}
|
||||
|
||||
protected:
|
||||
CompositorSession(CompositorWidgetDelegate* aDelegate,
|
||||
CompositorBridgeChild* aChild);
|
||||
CompositorBridgeChild* aChild,
|
||||
const uint64_t& aRootLayerTreeId);
|
||||
virtual ~CompositorSession();
|
||||
|
||||
protected:
|
||||
CompositorWidgetDelegate* mCompositorWidgetDelegate;
|
||||
RefPtr<CompositorBridgeChild> mCompositorBridgeChild;
|
||||
uint64_t mRootLayerTreeId;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CompositorSession);
|
||||
|
|
|
@ -36,7 +36,8 @@ GPUProcessManager::Shutdown()
|
|||
}
|
||||
|
||||
GPUProcessManager::GPUProcessManager()
|
||||
: mProcess(nullptr),
|
||||
: mNextLayerTreeId(0),
|
||||
mProcess(nullptr),
|
||||
mGPUChild(nullptr)
|
||||
{
|
||||
mObserver = new Observer(this);
|
||||
|
@ -157,9 +158,12 @@ GPUProcessManager::CreateTopLevelCompositor(nsIWidget* aWidget,
|
|||
bool aUseExternalSurfaceSize,
|
||||
const gfx::IntSize& aSurfaceSize)
|
||||
{
|
||||
uint64_t layerTreeId = AllocateLayerTreeId();
|
||||
|
||||
return InProcessCompositorSession::Create(
|
||||
aWidget,
|
||||
aLayerManager,
|
||||
layerTreeId,
|
||||
aScale,
|
||||
aUseAPZ,
|
||||
aUseExternalSurfaceSize,
|
||||
|
@ -182,7 +186,8 @@ GPUProcessManager::GetAPZCTreeManagerForLayers(uint64_t aLayersId)
|
|||
uint64_t
|
||||
GPUProcessManager::AllocateLayerTreeId()
|
||||
{
|
||||
return CompositorBridgeParent::AllocateLayerTreeId();
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return ++mNextLayerTreeId;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -141,6 +141,7 @@ private:
|
|||
|
||||
private:
|
||||
RefPtr<Observer> mObserver;
|
||||
uint64_t mNextLayerTreeId;
|
||||
GPUProcessHost* mProcess;
|
||||
GPUChild* mGPUChild;
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace layers {
|
|||
InProcessCompositorSession::InProcessCompositorSession(widget::CompositorWidget* aWidget,
|
||||
CompositorBridgeChild* aChild,
|
||||
CompositorBridgeParent* aParent)
|
||||
: CompositorSession(aWidget->AsDelegate(), aChild),
|
||||
: CompositorSession(aWidget->AsDelegate(), aChild, aParent->RootLayerTreeId()),
|
||||
mCompositorBridgeParent(aParent),
|
||||
mCompositorWidget(aWidget)
|
||||
{
|
||||
|
@ -21,6 +21,7 @@ InProcessCompositorSession::InProcessCompositorSession(widget::CompositorWidget*
|
|||
/* static */ RefPtr<InProcessCompositorSession>
|
||||
InProcessCompositorSession::Create(nsIWidget* aWidget,
|
||||
ClientLayerManager* aLayerManager,
|
||||
const uint64_t& aRootLayerTreeId,
|
||||
CSSToLayoutDeviceScale aScale,
|
||||
bool aUseAPZ,
|
||||
bool aUseExternalSurfaceSize,
|
||||
|
@ -32,7 +33,7 @@ InProcessCompositorSession::Create(nsIWidget* aWidget,
|
|||
RefPtr<CompositorWidget> widget = CompositorWidget::CreateLocal(initData, aWidget);
|
||||
RefPtr<CompositorBridgeChild> child = new CompositorBridgeChild(aLayerManager);
|
||||
RefPtr<CompositorBridgeParent> parent =
|
||||
child->InitSameProcess(widget, aScale, aUseAPZ, aUseExternalSurfaceSize, aSurfaceSize);
|
||||
child->InitSameProcess(widget, aRootLayerTreeId, aScale, aUseAPZ, aUseExternalSurfaceSize, aSurfaceSize);
|
||||
|
||||
return new InProcessCompositorSession(widget, child, parent);
|
||||
}
|
||||
|
@ -46,19 +47,13 @@ InProcessCompositorSession::GetInProcessBridge() const
|
|||
void
|
||||
InProcessCompositorSession::SetContentController(GeckoContentController* aController)
|
||||
{
|
||||
mCompositorBridgeParent->SetControllerForLayerTree(RootLayerTreeId(), aController);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
InProcessCompositorSession::RootLayerTreeId() const
|
||||
{
|
||||
return mCompositorBridgeParent->RootLayerTreeId();
|
||||
mCompositorBridgeParent->SetControllerForLayerTree(mRootLayerTreeId, aController);
|
||||
}
|
||||
|
||||
already_AddRefed<APZCTreeManager>
|
||||
InProcessCompositorSession::GetAPZCTreeManager() const
|
||||
{
|
||||
return mCompositorBridgeParent->GetAPZCTreeManager(RootLayerTreeId());
|
||||
return mCompositorBridgeParent->GetAPZCTreeManager(mRootLayerTreeId);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
static RefPtr<InProcessCompositorSession> Create(
|
||||
nsIWidget* aWidget,
|
||||
ClientLayerManager* aLayerManager,
|
||||
const uint64_t& aRootLayerTreeId,
|
||||
CSSToLayoutDeviceScale aScale,
|
||||
bool aUseAPZ,
|
||||
bool aUseExternalSurfaceSize,
|
||||
|
@ -28,7 +29,6 @@ public:
|
|||
|
||||
CompositorBridgeParent* GetInProcessBridge() const override;
|
||||
void SetContentController(GeckoContentController* aController) override;
|
||||
uint64_t RootLayerTreeId() const override;
|
||||
already_AddRefed<APZCTreeManager> GetAPZCTreeManager() const override;
|
||||
void Shutdown() override;
|
||||
|
||||
|
|
|
@ -191,6 +191,7 @@ CompositorBridgeChild::Create(Transport* aTransport, ProcessId aOtherPid)
|
|||
|
||||
CompositorBridgeParent*
|
||||
CompositorBridgeChild::InitSameProcess(widget::CompositorWidget* aWidget,
|
||||
const uint64_t& aLayerTreeId,
|
||||
CSSToLayoutDeviceScale aScale,
|
||||
bool aUseAPZ,
|
||||
bool aUseExternalSurface,
|
||||
|
@ -204,7 +205,7 @@ CompositorBridgeChild::InitSameProcess(widget::CompositorWidget* aWidget,
|
|||
ipc::ChildSide);
|
||||
MOZ_RELEASE_ASSERT(mCanSend);
|
||||
|
||||
mCompositorBridgeParent->InitSameProcess(aWidget, aUseAPZ);
|
||||
mCompositorBridgeParent->InitSameProcess(aWidget, aLayerTreeId, aUseAPZ);
|
||||
return mCompositorBridgeParent;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ public:
|
|||
*/
|
||||
CompositorBridgeParent* InitSameProcess(
|
||||
widget::CompositorWidget* aWidget,
|
||||
const uint64_t& aLayerTreeId,
|
||||
CSSToLayoutDeviceScale aScale,
|
||||
bool aUseAPZ,
|
||||
bool aUseExternalSurface,
|
||||
|
|
|
@ -601,7 +601,7 @@ CompositorBridgeParent::CompositorBridgeParent(CSSToLayoutDeviceScale aScale,
|
|||
, mPauseCompositionMonitor("PauseCompositionMonitor")
|
||||
, mResumeCompositionMonitor("ResumeCompositionMonitor")
|
||||
, mResetCompositorMonitor("ResetCompositorMonitor")
|
||||
, mRootLayerTreeID(AllocateLayerTreeId())
|
||||
, mRootLayerTreeID(0)
|
||||
, mOverrideComposeReadiness(false)
|
||||
, mForceCompositionTask(nullptr)
|
||||
, mCompositorThreadHolder(CompositorThreadHolder::GetSingleton())
|
||||
|
@ -615,9 +615,12 @@ CompositorBridgeParent::CompositorBridgeParent(CSSToLayoutDeviceScale aScale,
|
|||
}
|
||||
|
||||
void
|
||||
CompositorBridgeParent::InitSameProcess(widget::CompositorWidget* aWidget, bool aUseAPZ)
|
||||
CompositorBridgeParent::InitSameProcess(widget::CompositorWidget* aWidget,
|
||||
const uint64_t& aLayerTreeId,
|
||||
bool aUseAPZ)
|
||||
{
|
||||
mWidget = aWidget;
|
||||
mRootLayerTreeID = aLayerTreeId;
|
||||
if (aUseAPZ) {
|
||||
mApzcTreeManager = new APZCTreeManager();
|
||||
}
|
||||
|
@ -662,6 +665,7 @@ CompositorBridgeParent::Initialize()
|
|||
uint64_t
|
||||
CompositorBridgeParent::RootLayerTreeId()
|
||||
{
|
||||
MOZ_ASSERT(mRootLayerTreeID);
|
||||
return mRootLayerTreeID;
|
||||
}
|
||||
|
||||
|
@ -1680,15 +1684,6 @@ CompositorBridgeParent::RecvAdoptChild(const uint64_t& child)
|
|||
return true;
|
||||
}
|
||||
|
||||
/*static*/ uint64_t
|
||||
CompositorBridgeParent::AllocateLayerTreeId()
|
||||
{
|
||||
MOZ_ASSERT(CompositorLoop());
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
static uint64_t ids = 0;
|
||||
return ++ids;
|
||||
}
|
||||
|
||||
static void
|
||||
EraseLayerState(uint64_t aId)
|
||||
{
|
||||
|
|
|
@ -219,7 +219,9 @@ public:
|
|||
// Must only be called by CompositorBridgeChild. After invoking this, the
|
||||
// IPC channel is active and RecvWillStop/ActorDestroy must be called to
|
||||
// free the compositor.
|
||||
void InitSameProcess(widget::CompositorWidget* aWidget, bool aUseAPZ);
|
||||
void InitSameProcess(widget::CompositorWidget* aWidget,
|
||||
const uint64_t& aLayerTreeId,
|
||||
bool aUseAPZ);
|
||||
|
||||
virtual bool RecvGetFrameUniformity(FrameUniformityData* aOutData) override;
|
||||
virtual bool RecvRequestOverfill() override;
|
||||
|
@ -493,13 +495,6 @@ private:
|
|||
*/
|
||||
static already_AddRefed<APZCTreeManager> GetAPZCTreeManager(uint64_t aLayersId);
|
||||
|
||||
/**
|
||||
* Allocate an ID that can be used to refer to a layer tree and
|
||||
* associated resources that live only on the compositor thread.
|
||||
*
|
||||
* Must run on the content main thread.
|
||||
*/
|
||||
static uint64_t AllocateLayerTreeId();
|
||||
/**
|
||||
* Release compositor-thread resources referred to by |aID|.
|
||||
*
|
||||
|
@ -612,7 +607,7 @@ protected:
|
|||
mozilla::Monitor mResetCompositorMonitor;
|
||||
|
||||
uint64_t mCompositorID;
|
||||
const uint64_t mRootLayerTreeID;
|
||||
uint64_t mRootLayerTreeID;
|
||||
|
||||
bool mOverrideComposeReadiness;
|
||||
RefPtr<CancelableRunnable> mForceCompositionTask;
|
||||
|
|
Загрузка…
Ссылка в новой задаче