Bug 1296021 - Forward DeallocateLayerTreeId to GPU process if there is one. r=dvander
MozReview-Commit-ID: 12JtwGqLyy4
--- a/gfx/ipc/GPUParent.cpp
+++ b/gfx/ipc/GPUParent.cpp
@@ -139,16 +139,23 @@ GPUParent::RecvNewContentImageBridge(End
}
bool
GPUParent::RecvNewContentVRManager(Endpoint<PVRManagerParent>&& aEndpoint)
{
return VRManagerParent::CreateForContent(Move(aEndpoint));
}
+bool
+GPUParent::RecvDeallocateLayerTreeId(const uint64_t& aLayersId)
+{
+ CompositorBridgeParent::DeallocateLayerTreeId(aLayersId);
+ return true;
+}
+
void
GPUParent::ActorDestroy(ActorDestroyReason aWhy)
{
if (AbnormalShutdown == aWhy) {
NS_WARNING("Shutting down GPU process early due to a crash!");
ProcessChild::QuickExit();
}
--- a/gfx/ipc/GPUParent.h
+++ b/gfx/ipc/GPUParent.h
@@ -35,16 +35,17 @@ public:
Endpoint<PCompositorBridgeParent>&& aEndpoint,
const CSSToLayoutDeviceScale& aScale,
const TimeDuration& aVsyncRate,
const bool& aUseExternalSurface,
const IntSize& aSurfaceSize) override;
bool RecvNewContentCompositorBridge(Endpoint<PCompositorBridgeParent>&& aEndpoint) override;
bool RecvNewContentImageBridge(Endpoint<PImageBridgeParent>&& aEndpoint) override;
bool RecvNewContentVRManager(Endpoint<PVRManagerParent>&& aEndpoint) override;
+ bool RecvDeallocateLayerTreeId(const uint64_t& aLayersId) override;
void ActorDestroy(ActorDestroyReason aWhy) override;
private:
RefPtr<VsyncBridgeParent> mVsyncBridge;
};
} // namespace gfx
--- a/gfx/ipc/GPUProcessManager.cpp
+++ b/gfx/ipc/GPUProcessManager.cpp
@@ -499,16 +499,20 @@ GPUProcessManager::AllocateLayerTreeId()
{
MOZ_ASSERT(NS_IsMainThread());
return ++mNextLayerTreeId;
}
void
GPUProcessManager::DeallocateLayerTreeId(uint64_t aLayersId)
{
+ if (mGPUChild) {
+ mGPUChild->SendDeallocateLayerTreeId(aLayersId);
+ return;
+ }
CompositorBridgeParent::DeallocateLayerTreeId(aLayersId);
}
void
GPUProcessManager::RequestNotifyLayerTreeReady(uint64_t aLayersId, CompositorUpdateObserver* aObserver)
{
CompositorBridgeParent::RequestNotifyLayerTreeReady(aLayersId, aObserver);
}
--- a/gfx/ipc/PGPU.ipdl
+++ b/gfx/ipc/PGPU.ipdl
@@ -48,12 +48,14 @@ parent:
TimeDuration vsyncRate,
bool useExternalSurface,
IntSize surfaceSize);
// Create a new content-process compositor bridge.
async NewContentCompositorBridge(Endpoint<PCompositorBridgeParent> endpoint);
async NewContentImageBridge(Endpoint<PImageBridgeParent> endpoint);
async NewContentVRManager(Endpoint<PVRManagerParent> endpoint);
+
+ async DeallocateLayerTreeId(uint64_t layersId);
};
} // namespace gfx
} // namespace mozilla
--- a/gfx/layers/ipc/CompositorBridgeParent.h
+++ b/gfx/layers/ipc/CompositorBridgeParent.h
@@ -43,16 +43,17 @@ class nsIWidget;
namespace mozilla {
class CancelableRunnable;
namespace gfx {
class DrawTarget;
class GPUProcessManager;
+class GPUParent;
} // namespace gfx
namespace ipc {
class Shmem;
} // namespace ipc
namespace layers {
@@ -205,16 +206,17 @@ class CompositorBridgeParent final : pub
public ShadowLayersManager,
public CompositorBridgeParentIPCAllocator,
public ShmemAllocator
{
friend class CompositorVsyncScheduler;
friend class CompositorThreadHolder;
friend class InProcessCompositorSession;
friend class gfx::GPUProcessManager;
+ friend class gfx::GPUParent;
public:
explicit CompositorBridgeParent(CSSToLayoutDeviceScale aScale,
const TimeDuration& aVsyncRate,
bool aUseExternalSurfaceSize,
const gfx::IntSize& aSurfaceSize);
// Must only be called by CompositorBridgeChild. After invoking this, the