mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1280110 - Make sure compositor and layer resources are cleared when shutting down CompositorBridgeParent. r=sotaro
This commit is contained in:
parent
900ff3581c
commit
878a16fd7f
@ -669,11 +669,16 @@ CompositorBridgeParent::ForceIsFirstPaint()
|
||||
mCompositionManager->ForceIsFirstPaint();
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorBridgeParent::RecvWillClose()
|
||||
void
|
||||
CompositorBridgeParent::StopAndClearResources()
|
||||
{
|
||||
CancelCurrentCompositeTask();
|
||||
if (mForceCompositionTask) {
|
||||
mForceCompositionTask->Cancel();
|
||||
mForceCompositionTask = nullptr;
|
||||
}
|
||||
|
||||
mPaused = true;
|
||||
RemoveCompositor(mCompositorID);
|
||||
|
||||
// Ensure that the layer manager is destroyed before CompositorBridgeChild.
|
||||
if (mLayerManager) {
|
||||
@ -693,7 +698,12 @@ CompositorBridgeParent::RecvWillClose()
|
||||
mCompositor->Destroy();
|
||||
mCompositor = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorBridgeParent::RecvWillClose()
|
||||
{
|
||||
StopAndClearResources();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -848,29 +858,10 @@ CompositorBridgeParent::UpdateVisibleRegion(const VisibilityCounter& aCounter,
|
||||
void
|
||||
CompositorBridgeParent::ActorDestroy(ActorDestroyReason why)
|
||||
{
|
||||
CancelCurrentCompositeTask();
|
||||
if (mForceCompositionTask) {
|
||||
mForceCompositionTask->Cancel();
|
||||
mForceCompositionTask = nullptr;
|
||||
}
|
||||
mPaused = true;
|
||||
StopAndClearResources();
|
||||
|
||||
RemoveCompositor(mCompositorID);
|
||||
|
||||
if (mLayerManager) {
|
||||
mLayerManager->Destroy();
|
||||
mLayerManager = nullptr;
|
||||
}
|
||||
|
||||
{ // scope lock
|
||||
MonitorAutoLock lock(*sIndirectLayerTreesLock);
|
||||
sIndirectLayerTrees.erase(mRootLayerTreeID);
|
||||
}
|
||||
|
||||
if (mCompositor) {
|
||||
mCompositor->Destroy();
|
||||
mCompositor = nullptr;
|
||||
}
|
||||
|
||||
mCompositionManager = nullptr;
|
||||
|
||||
if (mApzcTreeManager) {
|
||||
@ -880,6 +871,11 @@ CompositorBridgeParent::ActorDestroy(ActorDestroyReason why)
|
||||
|
||||
mCompositorScheduler->Destroy();
|
||||
|
||||
{ // scope lock
|
||||
MonitorAutoLock lock(*sIndirectLayerTreesLock);
|
||||
sIndirectLayerTrees.erase(mRootLayerTreeID);
|
||||
}
|
||||
|
||||
// There are chances that the ref count reaches zero on the main thread shortly
|
||||
// after this function returns while some ipdl code still needs to run on
|
||||
// this thread.
|
||||
|
@ -474,6 +474,11 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* Called during destruction in order to release resources as early as possible.
|
||||
*/
|
||||
void StopAndClearResources();
|
||||
|
||||
/**
|
||||
* This returns a reference to the APZCTreeManager to which
|
||||
* pan/zoom-related events can be sent.
|
||||
|
Loading…
Reference in New Issue
Block a user