зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1315583 - Release ActiveResourceTracker on the main thread. r=dvander
This commit is contained in:
Родитель
b2c5102506
Коммит
5b78e0fd3c
|
@ -192,6 +192,21 @@ ShadowLayerForwarder::ShadowLayerForwarder(ClientLayerManager* aClientLayerManag
|
|||
mActiveResourceTracker = MakeUnique<ActiveResourceTracker>(1000, "CompositableForwarder");
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct ReleaseOnMainThreadTask : public Runnable
|
||||
{
|
||||
UniquePtr<T> mObj;
|
||||
|
||||
explicit ReleaseOnMainThreadTask(UniquePtr<T>& aObj)
|
||||
: mObj(Move(aObj))
|
||||
{}
|
||||
|
||||
NS_IMETHOD Run() override {
|
||||
mObj = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
ShadowLayerForwarder::~ShadowLayerForwarder()
|
||||
{
|
||||
MOZ_ASSERT(mTxn->Finished(), "unfinished transaction?");
|
||||
|
@ -200,6 +215,10 @@ ShadowLayerForwarder::~ShadowLayerForwarder()
|
|||
mShadowManager->SetForwarder(nullptr);
|
||||
mShadowManager->Destroy();
|
||||
}
|
||||
if (!NS_IsMainThread()) {
|
||||
NS_DispatchToMainThread(
|
||||
new ReleaseOnMainThreadTask<ActiveResourceTracker>(mActiveResourceTracker));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче