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 167961 ceb821fb91152d55a5b2b5ea53a2ec98f4e4329d
parent 167960 e0ced44cd88d63cb845b1245f6b4ca0af199fde4
child 167962 90107551b8f582db65e7216df26252d952300fff
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmuizelaar, bajaj
bugs943803
milestone27.0
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
@@ -2618,17 +2618,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.
@@ -2741,17 +2741,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