Bug 943803 - Don't try to forcibly discard an image if we have an existing decoder. r=jmuizelaar, a=bajaj
authorTimothy Nikkel <tnikkel@gmail.com>
Thu, 16 Jan 2014 16:45:49 -0600
changeset 175877 04e166b45ee3d7f7e0dbc938a8d50e1bfd16b9fb
parent 175876 15d30496c66d9bb2362b9a6cfe1aa88d7ae81d26
child 175878 4382683168eee444348ff5999e8dd34a64eeab11
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmuizelaar, bajaj
bugs943803
milestone28.0a2
Bug 943803 - Don't try to forcibly discard an image if we have an existing decoder. r=jmuizelaar, a=bajaj
image/src/RasterImage.cpp
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -2610,17 +2610,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.
@@ -2733,17 +2733,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