Bug 1287691 (Part 4) - Leave notifying decoding progress for each frame to DecodingTask. r=edwin
authorSeth Fowler <mark.seth.fowler@gmail.com>
Mon, 18 Jul 2016 23:53:20 -0700
changeset 345790 fe259a08d225f4b533fac6c66329acc6c7d65388
parent 345789 2fd2f3d22e5d391cd2cfaa2a3cefa0978e0fc8a5
child 345791 8e2f62943272dda354db63bfdb42510355dfaa72
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin
bugs1287691
milestone50.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 1287691 (Part 4) - Leave notifying decoding progress for each frame to DecodingTask. r=edwin
image/Decoder.cpp
image/IDecodingTask.cpp
image/IDecodingTask.h
--- a/image/Decoder.cpp
+++ b/image/Decoder.cpp
@@ -442,22 +442,16 @@ Decoder::PostFrameStop(Opacity aFrameOpa
   mProgress |= FLAG_FRAME_COMPLETE;
 
   // If we're not sending partial invalidations, then we send an invalidation
   // here when the first frame is complete.
   if (!ShouldSendPartialInvalidations() && mFrameCount == 1) {
     mInvalidRect.UnionRect(mInvalidRect,
                            gfx::IntRect(gfx::IntPoint(0, 0), GetSize()));
   }
-
-  // If we are going to keep decoding we should notify now about the first frame being done.
-  if (mImage && mFrameCount == 1 && HasAnimation()) {
-    MOZ_ASSERT(HasProgress());
-    IDecodingTask::NotifyProgress(WrapNotNull(this));
-  }
 }
 
 void
 Decoder::PostInvalidation(const nsIntRect& aRect,
                           const Maybe<nsIntRect>& aRectAtTargetSize
                             /* = Nothing() */)
 {
   // We should be mid-frame
--- a/image/IDecodingTask.cpp
+++ b/image/IDecodingTask.cpp
@@ -14,18 +14,18 @@
 
 namespace mozilla {
 namespace image {
 
 ///////////////////////////////////////////////////////////////////////////////
 // Helpers for sending notifications to the image associated with a decoder.
 ///////////////////////////////////////////////////////////////////////////////
 
-/* static */ void
-IDecodingTask::NotifyProgress(NotNull<Decoder*> aDecoder)
+static void
+NotifyProgress(NotNull<Decoder*> aDecoder)
 {
   MOZ_ASSERT(aDecoder->HasProgress() && !aDecoder->IsMetadataDecode());
 
   // Synchronously notify if we can.
   if (NS_IsMainThread() &&
       !(aDecoder->GetDecoderFlags() & DecoderFlags::ASYNC_NOTIFY)) {
     aDecoder->GetImage()->NotifyProgress(aDecoder->TakeProgress(),
                                          aDecoder->TakeInvalidRect(),
--- a/image/IDecodingTask.h
+++ b/image/IDecodingTask.h
@@ -45,21 +45,16 @@ public:
 
   /// A default implementation of IResumable which resubmits the task to the
   /// DecodePool. Subclasses can override this if they need different behavior.
   void Resume() override;
 
   /// @return a non-null weak pointer to the Decoder associated with this task.
   virtual NotNull<Decoder*> GetDecoder() const = 0;
 
-  // Notify the Image associated with a Decoder of its progress, sending a
-  // runnable to the main thread if necessary.
-  // XXX(seth): This is a hack that will be removed soon.
-  static void NotifyProgress(NotNull<Decoder*> aDecoder);
-
 protected:
   virtual ~IDecodingTask() { }
 };
 
 
 /**
  * An IDecodingTask implementation for full decodes of images.
  */