Bug 1291045 (Part 5) - Expose the IDecodingTask notification helpers for use in other files. r=edwin
authorSeth Fowler <mark.seth.fowler@gmail.com>
Wed, 27 Jul 2016 19:40:56 -0700
changeset 308435 7466366ce986deea1a21f47b998216a1527c528d
parent 308434 c31142f750f879fa3bc8f523285f3f19cd310bf6
child 308436 a6e140998c35958e3d05031afacd9e123356b2d3
push id80340
push userseth.bugzilla@blackhail.net
push dateSat, 06 Aug 2016 01:46:33 +0000
treeherdermozilla-inbound@b5418ecab2a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin
bugs1291045
milestone51.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 1291045 (Part 5) - Expose the IDecodingTask notification helpers for use in other files. r=edwin
image/IDecodingTask.cpp
image/IDecodingTask.h
--- a/image/IDecodingTask.cpp
+++ b/image/IDecodingTask.cpp
@@ -19,18 +19,19 @@ namespace mozilla {
 using gfx::IntRect;
 
 namespace image {
 
 ///////////////////////////////////////////////////////////////////////////////
 // Helpers for sending notifications to the image associated with a decoder.
 ///////////////////////////////////////////////////////////////////////////////
 
-static void
-NotifyProgress(NotNull<RasterImage*> aImage, NotNull<Decoder*> aDecoder)
+/* static */ void
+IDecodingTask::NotifyProgress(NotNull<RasterImage*> aImage,
+                              NotNull<Decoder*> aDecoder)
 {
   MOZ_ASSERT(aDecoder->HasProgress() && !aDecoder->IsMetadataDecode());
 
   // Capture the decoder's state. If we need to notify asynchronously, it's
   // important that we don't wait until the lambda actually runs to capture the
   // state that we're going to notify. That would both introduce data races on
   // the decoder's state and cause inconsistencies between the NotifyProgress()
   // calls we make off-main-thread and the notifications that RasterImage
@@ -51,18 +52,19 @@ NotifyProgress(NotNull<RasterImage*> aIm
   // We're forced to notify asynchronously.
   NotNull<RefPtr<RasterImage>> image = aImage;
   NS_DispatchToMainThread(NS_NewRunnableFunction([=]() -> void {
     image->NotifyProgress(progress, invalidRect,
                           frameCount, surfaceFlags);
   }));
 }
 
-static void
-NotifyDecodeComplete(NotNull<RasterImage*> aImage, NotNull<Decoder*> aDecoder)
+/* static */ void
+IDecodingTask::NotifyDecodeComplete(NotNull<RasterImage*> aImage,
+                                    NotNull<Decoder*> aDecoder)
 {
   // Synchronously notify if we can.
   if (NS_IsMainThread() &&
       !(aDecoder->GetDecoderFlags() & DecoderFlags::ASYNC_NOTIFY)) {
     aImage->FinalizeDecoder(aDecoder);
     return;
   }
 
--- a/image/IDecodingTask.h
+++ b/image/IDecodingTask.h
@@ -45,16 +45,24 @@ public:
   /// @return a priority hint that DecodePool can use when scheduling this task.
   virtual TaskPriority Priority() const = 0;
 
   /// A default implementation of IResumable which resubmits the task to the
   /// DecodePool. Subclasses can override this if they need different behavior.
   void Resume() override;
 
 protected:
+  /// Notify @aImage of @aDecoder's progress.
+  static void NotifyProgress(NotNull<RasterImage*> aImage,
+                             NotNull<Decoder*> aDecoder);
+
+  /// Notify @aImage that @aDecoder has finished.
+  static void NotifyDecodeComplete(NotNull<RasterImage*> aImage,
+                                   NotNull<Decoder*> aDecoder);
+
   virtual ~IDecodingTask() { }
 };
 
 
 /**
  * An IDecodingTask implementation for full decodes of single frame images.
  */
 class DecodingTask final : public IDecodingTask