Bug 715240. Only track decode on draw latency when we have all of the data. r=joe,f=jlebar
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Mon, 19 Dec 2011 16:42:36 -0500
changeset 85040 a5fa5e73d9019fbc69a3dda44326fe7d14f4d29b
parent 85039 6c67d9517dbb04ca590f43ca00f175a6aed99b0e
child 85041 df2cf9afad63879f12137ab717d942607de9f9e9
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjoe
bugs715240
milestone12.0a1
Bug 715240. Only track decode on draw latency when we have all of the data. r=joe,f=jlebar Previously, could start counting before the image was completely downloaded. This would cause the download time to be included.
image/src/RasterImage.cpp
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -2578,17 +2578,18 @@ RasterImage::Draw(gfxContext *aContext,
   if (mFrameDecodeFlags != DECODE_FLAGS_DEFAULT) {
     if (!CanForciblyDiscard())
       return NS_ERROR_NOT_AVAILABLE;
     ForceDiscard();
 
     mFrameDecodeFlags = DECODE_FLAGS_DEFAULT;
   }
 
-  if (!mDecoded) {
+  // We use !mDecoded && mHasSourceData to mean discarded.
+  if (!mDecoded && mHasSourceData) {
       mDrawStartTime = TimeStamp::Now();
   }
 
   // If a synchronous draw is requested, flush anything that might be sitting around
   if (aFlags & FLAG_SYNC_DECODE) {
     nsresult rv = SyncDecode();
     NS_ENSURE_SUCCESS(rv, rv);
   }