Issue #2073 - m-c 1651587: Make image::Image release efficient on main thread

This commit is contained in:
Martok 2023-01-03 23:30:46 +01:00 committed by roytam1
commit 9a39001cc3
6 changed files with 75 additions and 13 deletions

View file

@ -61,14 +61,8 @@ AnimationSurfaceProvider::DropImageReference()
return; // Nothing to do.
}
// RasterImage objects need to be destroyed on the main thread. We also need
// to destroy them asynchronously, because if our surface cache entry is
// destroyed and we were the only thing keeping |mImage| alive, RasterImage's
// destructor may call into the surface cache while whatever code caused us to
// get evicted is holding the surface cache lock, causing deadlock.
RefPtr<RasterImage> image = mImage;
mImage = nullptr;
NS_ReleaseOnMainThread(image.forget(), /* aAlwaysProxy = */ true);
// RasterImage objects need to be destroyed on the main thread.
SurfaceCache::ReleaseImageOnMainThread(mImage.forget());
}
void