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 105360 3331ec03e60fe6bd4bf8b4ba79679c44515c8443
parent 105359 0eb750ce354b9f9b55e768012a6b809547429046
child 105361 a5549c0a8817afb1ba4a8087b8b1759140ac4606
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
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);