mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Delay the DidComposite call in ClientLayerManager's destructor. (bug 1305829, r=mattwoodrow)
This commit is contained in:
parent
94f694f70f
commit
22b001c0b6
@ -112,10 +112,6 @@ ClientLayerManager::ClientLayerManager(nsIWidget* aWidget)
|
||||
|
||||
ClientLayerManager::~ClientLayerManager()
|
||||
{
|
||||
if (mTransactionIdAllocator) {
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
DidComposite(mLatestTransactionId, now, now);
|
||||
}
|
||||
mMemoryPressureObserver->Destroy();
|
||||
ClearCachedResources();
|
||||
// Stop receiveing AsyncParentMessage at Forwarder.
|
||||
@ -137,6 +133,19 @@ ClientLayerManager::Destroy()
|
||||
// former will early-return if the later has already run.
|
||||
ClearCachedResources();
|
||||
LayerManager::Destroy();
|
||||
|
||||
if (mTransactionIdAllocator) {
|
||||
// Make sure to notify the refresh driver just in case it's waiting on a
|
||||
// pending transaction. Do this at the top of the event loop so we don't
|
||||
// cause a paint to occur during compositor shutdown.
|
||||
RefPtr<TransactionIdAllocator> allocator = mTransactionIdAllocator;
|
||||
uint64_t id = mLatestTransactionId;
|
||||
|
||||
RefPtr<Runnable> task = NS_NewRunnableFunction([allocator, id] () -> void {
|
||||
allocator->NotifyTransactionCompleted(id);
|
||||
});
|
||||
NS_DispatchToMainThread(task.forget());
|
||||
}
|
||||
}
|
||||
|
||||
int32_t
|
||||
|
@ -248,6 +248,7 @@ WidgetShutdownObserver::Unregister()
|
||||
void
|
||||
nsBaseWidget::Shutdown()
|
||||
{
|
||||
RevokeTransactionIdAllocator();
|
||||
DestroyCompositor();
|
||||
FreeShutdownObserver();
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
@ -295,6 +296,23 @@ void nsBaseWidget::DestroyCompositor()
|
||||
}
|
||||
}
|
||||
|
||||
// This prevents the layer manager from starting a new transaction during
|
||||
// shutdown.
|
||||
void
|
||||
nsBaseWidget::RevokeTransactionIdAllocator()
|
||||
{
|
||||
if (!mLayerManager) {
|
||||
return;
|
||||
}
|
||||
|
||||
ClientLayerManager* clm = mLayerManager->AsClientLayerManager();
|
||||
if (!clm) {
|
||||
return;
|
||||
}
|
||||
|
||||
clm->SetTransactionIdAllocator(nullptr);
|
||||
}
|
||||
|
||||
void nsBaseWidget::ReleaseContentController()
|
||||
{
|
||||
if (mRootContentController) {
|
||||
@ -377,6 +395,7 @@ nsBaseWidget::~nsBaseWidget()
|
||||
}
|
||||
|
||||
FreeShutdownObserver();
|
||||
RevokeTransactionIdAllocator();
|
||||
DestroyLayerManager();
|
||||
|
||||
#ifdef NOISY_WIDGET_LEAKS
|
||||
|
@ -643,6 +643,7 @@ protected:
|
||||
virtual void DestroyCompositor();
|
||||
void DestroyLayerManager();
|
||||
void ReleaseContentController();
|
||||
void RevokeTransactionIdAllocator();
|
||||
|
||||
void FreeShutdownObserver();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user