Bug 784756 - Remove an unnecessary loop from DecodeWorker::DecodeABitOf() that caused it to always take 5ms, even when decoding didn't take that long. r=joe
authorRobert Lickenbrock <rclickenbrock@gmail.com>
Fri, 24 Aug 2012 11:24:36 -0700
changeset 103314 3331ec03e60f
parent 103313 0eb750ce354b
child 103315 a5549c0a8817
push id13936
push userjlebar@mozilla.com
push date2012-08-24 18:26 +0000
treeherdermozilla-inbound@3331ec03e60f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjoe
bugs784756
milestone17.0a1
Bug 784756 - Remove an unnecessary loop from DecodeWorker::DecodeABitOf() that caused it to always take 5ms, even when decoding didn't take that long. r=joe
image/src/RasterImage.cpp
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -2896,30 +2896,26 @@ RasterImage::DecodeWorker::RequestDecode
 {
   AddDecodeRequest(&aImg->mDecodeRequest);
   EnsurePendingInEventLoop();
 }
 
 void
 RasterImage::DecodeWorker::DecodeABitOf(RasterImage* aImg)
 {
-  TimeStamp eventStart = TimeStamp::Now();
-
-  do {
-    DecodeSomeOfImage(aImg);
-
-    // If we aren't yet finished decoding and we have more data in hand, add
-    // this request to the back of the priority list.
-    if (aImg->mDecoder &&
-        !aImg->mError &&
-        !aImg->IsDecodeFinished() &&
-        aImg->mSourceData.Length() > aImg->mBytesDecoded) {
-      RequestDecode(aImg);
-    }
-  } while ((TimeStamp::Now() - eventStart).ToMilliseconds() <= gMaxMSBeforeYield);
+  DecodeSomeOfImage(aImg);
+
+  // If we aren't yet finished decoding and we have more data in hand, add
+  // this request to the back of the priority list.
+  if (aImg->mDecoder &&
+      !aImg->mError &&
+      !aImg->IsDecodeFinished() &&
+      aImg->mSourceData.Length() > aImg->mBytesDecoded) {
+    RequestDecode(aImg);
+  }
 }
 
 void
 RasterImage::DecodeWorker::EnsurePendingInEventLoop()
 {
   if (!mPendingInEventLoop) {
     mPendingInEventLoop = true;
     NS_DispatchToCurrentThread(this);