Bug 1207355 (Part 5) - Request decodes intelligently in MultipartImage. r=tn
☠☠ backed out by b4c323832f31 ☠ ☠
authorSeth Fowler <mark.seth.fowler@gmail.com>
Wed, 28 Oct 2015 16:40:43 -0700
changeset 270024 ecebca101fcbe546e187abed4f0469c0fd96d920
parent 270023 08f2017137e1f29200354398311f5af96dbbe834
child 270025 e941e0e106a1f501424cb08f304455cb1cf9d8b2
push id67255
push usermfowler@mozilla.com
push dateWed, 28 Oct 2015 23:41:33 +0000
treeherdermozilla-inbound@aafd6db2fbb4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1207355
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1207355 (Part 5) - Request decodes intelligently in MultipartImage. r=tn
image/MultipartImage.cpp
--- a/image/MultipartImage.cpp
+++ b/image/MultipartImage.cpp
@@ -65,16 +65,26 @@ public:
 
   virtual void OnLoadComplete(bool aLastPart) override
   {
     if (!mImage) {
       // We've already finished observing the last image we were given.
       return;
     }
 
+    // Retrieve the image's intrinsic size.
+    int32_t width = 0;
+    int32_t height = 0;
+    mImage->GetWidth(&width);
+    mImage->GetHeight(&height);
+
+    // Request decoding at the intrinsic size.
+    mImage->RequestDecodeForSize(IntSize(width, height),
+                                 imgIContainer::DECODE_FLAGS_DEFAULT);
+
     // If there's already an error, we may never get a FRAME_COMPLETE
     // notification, so go ahead and notify our owner right away.
     RefPtr<ProgressTracker> tracker = mImage->GetProgressTracker();
     if (tracker->GetProgress() & FLAG_HAS_ERROR) {
       FinishObserving();
     }
   }
 
@@ -120,17 +130,16 @@ MultipartImage::Init()
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(mTracker, "Should've called SetProgressTracker() by now");
 
   // Start observing the first part.
   RefPtr<ProgressTracker> firstPartTracker =
     InnerImage()->GetProgressTracker();
   firstPartTracker->AddObserver(this);
-  InnerImage()->RequestDecode();
   InnerImage()->IncrementAnimationConsumers();
 }
 
 MultipartImage::~MultipartImage()
 {
   // Ask our ProgressTracker to drop its weak reference to us.
   mTracker->ResetImage();
 }
@@ -149,17 +158,16 @@ MultipartImage::BeginTransitionToPart(Im
     MOZ_ASSERT(!mNextPart);
   }
 
   mNextPart = aNextPart;
 
   // Start observing the next part; we'll complete the transition when
   // NextPartObserver calls FinishTransition.
   mNextPartObserver->BeginObserving(mNextPart);
-  mNextPart->RequestDecode();
   mNextPart->IncrementAnimationConsumers();
 }
 
 static Progress
 FilterProgress(Progress aProgress)
 {
   // Filter out onload blocking notifications, since we don't want to block
   // onload for multipart images.