Bug 1285867 (Part 7) - Clean up remaining references to decoder 'data errors' and refer to them as just 'errors'. r=edwin
authorSeth Fowler <mark.seth.fowler@gmail.com>
Mon, 11 Jul 2016 01:09:10 -0700
changeset 305172 401978e000d8e8819c0ef3a3b5b081e408dc711c
parent 305171 9b650c8855c2a64e6194680eee53c53b113e4798
child 305173 0bb4cf8a575985a1d013097836f1fb8281a7d6a2
push id30455
push usercbook@mozilla.com
push dateSun, 17 Jul 2016 08:08:29 +0000
treeherdermozilla-central@711963e8daa3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin
bugs1285867
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 1285867 (Part 7) - Clean up remaining references to decoder 'data errors' and refer to them as just 'errors'. r=edwin
image/Decoder.cpp
image/Decoder.h
image/decoders/nsICODecoder.cpp
--- a/image/Decoder.cpp
+++ b/image/Decoder.cpp
@@ -55,17 +55,17 @@ Decoder::Decoder(RasterImage* aImage)
   , mFrameCount(0)
   , mDecoderFlags(DefaultDecoderFlags())
   , mSurfaceFlags(DefaultSurfaceFlags())
   , mInitialized(false)
   , mMetadataDecode(false)
   , mInFrame(false)
   , mReachedTerminalState(false)
   , mDecodeDone(false)
-  , mDataError(false)
+  , mError(false)
   , mDecodeAborted(false)
   , mShouldReportError(false)
 { }
 
 Decoder::~Decoder()
 {
   MOZ_ASSERT(mProgress == NoProgress || !mImage,
              "Destroying Decoder without taking all its progress changes");
@@ -165,17 +165,17 @@ Decoder::Decode(NotNull<IResumable*> aOn
     } while (!terminalState);
   }
 
   MOZ_ASSERT(terminalState);
   mReachedTerminalState = true;
 
   // If decoding failed, record that fact.
   if (terminalState == Some(TerminalState::FAILURE)) {
-    PostDataError();
+    PostError();
   }
 
   // We're done decoding; perform final cleanup.
   CompleteDecode();
 
   return HasError() ? NS_ERROR_FAILURE : NS_OK;
 }
 
@@ -189,28 +189,28 @@ Decoder::ShouldSyncDecode(size_t aByteLi
 }
 
 void
 Decoder::CompleteDecode()
 {
   // Implementation-specific finalization.
   nsresult rv = BeforeFinishInternal();
   if (NS_FAILED(rv)) {
-    PostDataError();
+    PostError();
   }
 
   rv = HasError() ? FinishWithErrorInternal()
                   : FinishInternal();
   if (NS_FAILED(rv)) {
-    PostDataError();
+    PostError();
   }
 
   // If this was a metadata decode and we never got a size, the decode failed.
   if (IsMetadataDecode() && !HasSize()) {
-    PostDataError();
+    PostError();
   }
 
   // If the implementation left us mid-frame, finish that up.
   if (mInFrame && !HasError()) {
     PostFrameStop();
   }
 
   // If PostDecodeDone() has not been called, and this decoder wasn't aborted
@@ -511,19 +511,19 @@ Decoder::PostDecodeDone(int32_t aLoopCou
   mDecodeDone = true;
 
   mImageMetadata.SetLoopCount(aLoopCount);
 
   mProgress |= FLAG_DECODE_COMPLETE;
 }
 
 void
-Decoder::PostDataError()
+Decoder::PostError()
 {
-  mDataError = true;
+  mError = true;
 
   if (mInFrame && mCurrentFrame) {
     mCurrentFrame->Abort();
   }
 }
 
 Telemetry::ID
 Decoder::SpeedHistogram()
--- a/image/Decoder.h
+++ b/image/Decoder.h
@@ -189,18 +189,17 @@ public:
   uint32_t GetCompleteFrameCount() {
     return mInFrame ? mFrameCount - 1 : mFrameCount;
   }
 
   // Did we discover that the image we're decoding is animated?
   bool HasAnimation() const { return mImageMetadata.HasAnimation(); }
 
   // Error tracking
-  bool HasError() const { return HasDataError(); }
-  bool HasDataError() const { return mDataError; }
+  bool HasError() const { return mError; }
   bool ShouldReportError() const { return mShouldReportError; }
 
   /// Did we finish decoding enough that calling Decode() again would be useless?
   bool GetDecodeDone() const
   {
     return mReachedTerminalState || mDecodeDone ||
            (mMetadataDecode && HasSize()) || HasError();
   }
@@ -361,26 +360,16 @@ protected:
   // the stream, or by us calling FinishInternal().
   //
   // May not be called mid-frame.
   //
   // For animated images, specify the loop count. -1 means loop forever, 0
   // means a single iteration, stopping on the last frame.
   void PostDecodeDone(int32_t aLoopCount = 0);
 
-  // Report an error in the image data.
-  void PostDataError();
-
-  /**
-   * CompleteDecode() finishes up the decoding process after Decode() determines
-   * that we're finished. It records final progress and does all the cleanup
-   * that's possible off-main-thread.
-   */
-  void CompleteDecode();
-
   /**
    * Allocates a new frame, making it our current frame if successful.
    *
    * The @aFrameNum parameter only exists as a sanity check; it's illegal to
    * create a new frame anywhere but immediately after the existing frames.
    *
    * If a non-paletted frame is desired, pass 0 for aPaletteDepth.
    */
@@ -392,16 +381,27 @@ protected:
 
   /// Helper method for decoders which only have 'basic' frame allocation needs.
   nsresult AllocateBasicFrame() {
     nsIntSize size = GetSize();
     return AllocateFrame(0, size, nsIntRect(nsIntPoint(), size),
                          gfx::SurfaceFormat::B8G8R8A8);
   }
 
+private:
+  /// Report that an error was encountered while decoding.
+  void PostError();
+
+  /**
+   * CompleteDecode() finishes up the decoding process after Decode() determines
+   * that we're finished. It records final progress and does all the cleanup
+   * that's possible off-main-thread.
+   */
+  void CompleteDecode();
+
   RawAccessFrameRef AllocateFrameInternal(uint32_t aFrameNum,
                                           const nsIntSize& aTargetSize,
                                           const nsIntRect& aFrameRect,
                                           gfx::SurfaceFormat aFormat,
                                           uint8_t aPaletteDepth,
                                           imgFrame* aPreviousFrame);
 
 protected:
@@ -428,17 +428,17 @@ private:
   DecoderFlags mDecoderFlags;
   SurfaceFlags mSurfaceFlags;
 
   bool mInitialized : 1;
   bool mMetadataDecode : 1;
   bool mInFrame : 1;
   bool mReachedTerminalState : 1;
   bool mDecodeDone : 1;
-  bool mDataError : 1;
+  bool mError : 1;
   bool mDecodeAborted : 1;
   bool mShouldReportError : 1;
 };
 
 } // namespace image
 } // namespace mozilla
 
 #endif // mozilla_image_Decoder_h
--- a/image/decoders/nsICODecoder.cpp
+++ b/image/decoders/nsICODecoder.cpp
@@ -650,17 +650,17 @@ nsICODecoder::WriteToContainedDecoder(co
   if (NS_FAILED(mContainedDecoder->Decode(mDoNotResume))) {
     succeeded = false;
   }
 
   // Make our state the same as the state of the contained decoder, and
   // propagate errors.
   mProgress |= mContainedDecoder->TakeProgress();
   mInvalidRect.UnionRect(mInvalidRect, mContainedDecoder->TakeInvalidRect());
-  if (mContainedDecoder->HasDataError()) {
+  if (mContainedDecoder->HasError()) {
     succeeded = false;
   }
 
   return succeeded;
 }
 
 } // namespace image
 } // namespace mozilla