Bug 943803. Don't try to forcibly discard an image if we have an existing decoder. r=jmuizelaar
authorTimothy Nikkel <tnikkel@gmail.com>
Thu, 16 Jan 2014 16:45:49 -0600
changeset 163861 5a7ba959a5d17c96101908c48d61b1e2e74bd437
parent 163860 9e9cbc97aa0ad6b60f13707c89c6ede3384854db
child 163862 19cb3daa91a754fadda67fa0843ea0cb23a7991f
push id38572
push usertnikkel@gmail.com
push dateThu, 16 Jan 2014 22:46:06 +0000
treeherdermozilla-inbound@5a7ba959a5d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmuizelaar
bugs943803
milestone29.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 943803. Don't try to forcibly discard an image if we have an existing decoder. r=jmuizelaar
image/src/RasterImage.cpp
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -2596,17 +2596,17 @@ RasterImage::Draw(gfxContext *aContext,
   // we don't currently.)
   if ((aFlags & DECODE_FLAGS_MASK) != DECODE_FLAGS_DEFAULT)
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG_POINTER(aContext);
 
   // We can only draw with the default decode flags
   if (mFrameDecodeFlags != DECODE_FLAGS_DEFAULT) {
-    if (!CanForciblyDiscard())
+    if (!CanForciblyDiscard() || mDecoder || mAnim)
       return NS_ERROR_NOT_AVAILABLE;
     ForceDiscard();
 
     mFrameDecodeFlags = DECODE_FLAGS_DEFAULT;
   }
 
   // If this image is a candidate for discarding, reset its position in the
   // discard tracker so we're less likely to discard it right away.
@@ -2719,17 +2719,17 @@ RasterImage::UnlockImage()
   return NS_OK;
 }
 
 //******************************************************************************
 /* void requestDiscard() */
 NS_IMETHODIMP
 RasterImage::RequestDiscard()
 {
-  if (CanDiscard()) {
+  if (CanDiscard() && !mDecoder && !mAnim) {
     ForceDiscard();
   }
 
   return NS_OK;
 }
 
 // Flushes up to aMaxBytes to the decoder.
 nsresult