From 063f83b278bf6cc73b008cf477623674c7433a5c Mon Sep 17 00:00:00 2001 From: Seth Fowler Date: Mon, 11 Jul 2016 00:42:56 -0700 Subject: [PATCH] Bug 1285867 (Part 5) - Replace Decoder::mDataDone with Decoder::mReachedTerminalState. r=edwin --- image/Decoder.cpp | 5 ++--- image/Decoder.h | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/image/Decoder.cpp b/image/Decoder.cpp index 4f6299aa9ad8..3c3e7811c98f 100644 --- a/image/Decoder.cpp +++ b/image/Decoder.cpp @@ -65,7 +65,7 @@ Decoder::Decoder(RasterImage* aImage) , mInitialized(false) , mMetadataDecode(false) , mInFrame(false) - , mDataDone(false) + , mReachedTerminalState(false) , mDecodeDone(false) , mDataError(false) , mDecodeAborted(false) @@ -143,8 +143,6 @@ Decoder::Decode(NotNull aOnResume) return NS_OK; case SourceBufferIterator::COMPLETE: - mDataDone = true; - // Normally even if the data is truncated, we want decoding to // succeed so we can display whatever we got. However, if the // SourceBuffer was completed with a failing status, we want to fail. @@ -175,6 +173,7 @@ Decoder::Decode(NotNull aOnResume) } while (!terminalState); MOZ_ASSERT(terminalState); + mReachedTerminalState = true; // If decoding failed, record that fact. if (terminalState == Some(TerminalState::FAILURE)) { diff --git a/image/Decoder.h b/image/Decoder.h index c10f8014ae45..f4ba6daf86f7 100644 --- a/image/Decoder.h +++ b/image/Decoder.h @@ -193,8 +193,8 @@ public: /// Did we finish decoding enough that calling Decode() again would be useless? bool GetDecodeDone() const { - return mDecodeDone || (mMetadataDecode && HasSize()) || - HasError() || mDataDone; + return mReachedTerminalState || mDecodeDone || + (mMetadataDecode && HasSize()) || HasError(); } /// Are we in the middle of a frame right now? Used for assertions only. @@ -425,7 +425,7 @@ private: bool mInitialized : 1; bool mMetadataDecode : 1; bool mInFrame : 1; - bool mDataDone : 1; + bool mReachedTerminalState : 1; bool mDecodeDone : 1; bool mDataError : 1; bool mDecodeAborted : 1;