Bug 1389479 - Part 3. AnimationSurfaceProvider no longer needs to always dispatch to free its RasterImage. r=tnikkel
authorAndrew Osmond <aosmond@mozilla.com>
Tue, 15 Aug 2017 15:02:14 -0400
changeset 374901 9ddc28603bea7b9916093490359863be852a7358
parent 374900 3f2e443dd48ce187ba6098e2a72fd5804f94c6f3
child 374902 c8135aa1f7506f4dc9e4cafe4a8de9ab37f193eb
push id32340
push userkwierso@gmail.com
push dateWed, 16 Aug 2017 02:03:08 +0000
treeherdermozilla-central@4e93516e92e5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1389479
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1389479 - Part 3. AnimationSurfaceProvider no longer needs to always dispatch to free its RasterImage. r=tnikkel
image/AnimationSurfaceProvider.cpp
--- a/image/AnimationSurfaceProvider.cpp
+++ b/image/AnimationSurfaceProvider.cpp
@@ -38,24 +38,19 @@ AnimationSurfaceProvider::~AnimationSurf
 
 void
 AnimationSurfaceProvider::DropImageReference()
 {
   if (!mImage) {
     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_ReleaseOnMainThreadSystemGroup(image.forget(), /* aAlwaysProxy = */ true);
+  // RasterImage objects need to be destroyed on the main thread.
+  NS_ReleaseOnMainThreadSystemGroup("AnimationSurfaceProvider::mImage",
+                                    mImage.forget());
 }
 
 DrawableFrameRef
 AnimationSurfaceProvider::DrawableRef(size_t aFrame)
 {
   MutexAutoLock lock(mFramesMutex);
 
   if (Availability().IsPlaceholder()) {