mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1100725 (Part 4) - Assert that we always consume all decoder progress and invalidations. r=tn
This commit is contained in:
parent
e5a219327f
commit
4953a29763
@ -83,7 +83,7 @@ nsICODecoder::FinishInternal()
|
||||
if (mContainedDecoder) {
|
||||
mContainedDecoder->FinishSharedDecoder();
|
||||
mDecodeDone = mContainedDecoder->GetDecodeDone();
|
||||
mProgress |= mContainedDecoder->GetProgress();
|
||||
mProgress |= mContainedDecoder->TakeProgress();
|
||||
mInvalidRect.Union(mContainedDecoder->TakeInvalidRect());
|
||||
}
|
||||
}
|
||||
@ -597,7 +597,7 @@ nsICODecoder::WriteToContainedDecoder(const char* aBuffer, uint32_t aCount,
|
||||
DecodeStrategy aStrategy)
|
||||
{
|
||||
mContainedDecoder->Write(aBuffer, aCount, aStrategy);
|
||||
mProgress |= mContainedDecoder->GetProgress();
|
||||
mProgress |= mContainedDecoder->TakeProgress();
|
||||
mInvalidRect.Union(mContainedDecoder->TakeInvalidRect());
|
||||
if (mContainedDecoder->HasDataError()) {
|
||||
mDataError = mContainedDecoder->HasDataError();
|
||||
@ -643,7 +643,7 @@ nsICODecoder::AllocateFrame()
|
||||
if (mContainedDecoder) {
|
||||
nsresult rv = mContainedDecoder->AllocateFrame();
|
||||
mCurrentFrame = mContainedDecoder->GetCurrentFrame();
|
||||
mProgress |= mContainedDecoder->GetProgress();
|
||||
mProgress |= mContainedDecoder->TakeProgress();
|
||||
mInvalidRect.Union(mContainedDecoder->TakeInvalidRect());
|
||||
return rv;
|
||||
}
|
||||
|
@ -35,6 +35,10 @@ Decoder::Decoder(RasterImage &aImage)
|
||||
|
||||
Decoder::~Decoder()
|
||||
{
|
||||
MOZ_ASSERT(mProgress == NoProgress,
|
||||
"Destroying Decoder without taking all its progress changes");
|
||||
MOZ_ASSERT(mInvalidRect.IsEmpty(),
|
||||
"Destroying Decoder without taking all its invalidations");
|
||||
mInitialized = false;
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,18 @@ public:
|
||||
return invalidRect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the progress changes accumulated by the decoder so far, and clears
|
||||
* them. This means that each call to TakeProgress() returns only the changes
|
||||
* accumulated since the last call to TakeProgress().
|
||||
*/
|
||||
Progress TakeProgress()
|
||||
{
|
||||
Progress progress = mProgress;
|
||||
mProgress = NoProgress;
|
||||
return progress;
|
||||
}
|
||||
|
||||
// We're not COM-y, so we don't get refcounts by default
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Decoder)
|
||||
|
||||
@ -99,8 +111,6 @@ public:
|
||||
|
||||
size_t BytesDecoded() const { return mBytesDecoded; }
|
||||
|
||||
Progress GetProgress() const { return mProgress; }
|
||||
|
||||
// The number of frames we have, including anything in-progress. Thus, this
|
||||
// is only 0 if we haven't begun any frames.
|
||||
uint32_t GetFrameCount() { return mFrameCount; }
|
||||
|
@ -2924,7 +2924,7 @@ RasterImage::FinishedSomeDecoding(eShutdownIntent aIntent /* = eShutdownIntent_D
|
||||
|
||||
if (image->mDecoder) {
|
||||
invalidRect = image->mDecoder->TakeInvalidRect();
|
||||
progress |= image->mDecoder->GetProgress();
|
||||
progress |= image->mDecoder->TakeProgress();
|
||||
|
||||
if (request && request->mChunkCount && !image->mDecoder->IsSizeDecode()) {
|
||||
Telemetry::Accumulate(Telemetry::IMAGE_DECODE_CHUNKS, request->mChunkCount);
|
||||
@ -2968,7 +2968,7 @@ RasterImage::FinishedSomeDecoding(eShutdownIntent aIntent /* = eShutdownIntent_D
|
||||
|
||||
// If there were any final changes, grab them.
|
||||
invalidRect.Union(decoder->TakeInvalidRect());
|
||||
progress |= decoder->GetProgress();
|
||||
progress |= decoder->TakeProgress();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user