зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1271002. Notify right away after getting the first frame of an animated image. r=seth
The decoding loop in Decoder::Decode only pauses to report progress when it runs out of bytes to decode. So for long animated images where the network is keeping up with decoding it will be a relatively long time until we deliver the first frame complete notification and corresponding invalidation. In most cases this shouldn't be too expensive as it is just dispatching a runnable to the main thread from the decoding thread.
This commit is contained in:
Родитель
65ba2f05a0
Коммит
2c28cda879
|
@ -469,6 +469,7 @@ void
|
|||
DecodePool::NotifyProgress(Decoder* aDecoder)
|
||||
{
|
||||
MOZ_ASSERT(aDecoder);
|
||||
MOZ_ASSERT(aDecoder->HasProgress() && !aDecoder->IsMetadataDecode());
|
||||
|
||||
if (!NS_IsMainThread() ||
|
||||
(aDecoder->GetDecoderFlags() & DecoderFlags::ASYNC_NOTIFY)) {
|
||||
|
|
|
@ -79,6 +79,11 @@ public:
|
|||
*/
|
||||
already_AddRefed<nsIEventTarget> GetIOEventTarget();
|
||||
|
||||
/**
|
||||
* Notify about progress on aDecoder.
|
||||
*/
|
||||
void NotifyProgress(Decoder* aDecoder);
|
||||
|
||||
private:
|
||||
friend class DecodePoolWorker;
|
||||
|
||||
|
@ -87,7 +92,6 @@ private:
|
|||
|
||||
void Decode(Decoder* aDecoder);
|
||||
void NotifyDecodeComplete(Decoder* aDecoder);
|
||||
void NotifyProgress(Decoder* aDecoder);
|
||||
|
||||
static StaticRefPtr<DecodePool> sSingleton;
|
||||
static uint32_t sNumCores;
|
||||
|
|
|
@ -449,6 +449,12 @@ Decoder::PostFrameStop(Opacity aFrameOpacity
|
|||
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());
|
||||
DecodePool::Singleton()->NotifyProgress(this);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче