mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 09:54:42 +00:00
Bug 1343341. Only set the animation state as discarded if we discarded the animated frames (and not a static frame from a first-frame-only decode). r=aosmond
The SurfaceCache can hold the first frame of a "static" decode as well as the animated frames in two seperate entries. We only care about what happens to the animated frames, so ignore OnSurfaceDiscarded for anything else. To accomplish this we must pass the SurfaceKey to OnSurfaceDiscarded.
This commit is contained in:
parent
d69ec52e66
commit
23f3425afe
@ -80,7 +80,7 @@ DynamicImage::OnImageDataComplete(nsIRequest* aRequest,
|
||||
}
|
||||
|
||||
void
|
||||
DynamicImage::OnSurfaceDiscarded()
|
||||
DynamicImage::OnSurfaceDiscarded(const SurfaceKey& aSurfaceKey)
|
||||
{ }
|
||||
|
||||
void
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
nsresult aStatus,
|
||||
bool aLastPart) override;
|
||||
|
||||
virtual void OnSurfaceDiscarded() override;
|
||||
virtual void OnSurfaceDiscarded(const SurfaceKey& aSurfaceKey) override;
|
||||
|
||||
virtual void SetInnerWindowID(uint64_t aInnerWindowId) override;
|
||||
virtual uint64_t InnerWindowID() const override;
|
||||
|
@ -216,7 +216,7 @@ public:
|
||||
/**
|
||||
* Called when the SurfaceCache discards a surface belonging to this image.
|
||||
*/
|
||||
virtual void OnSurfaceDiscarded() = 0;
|
||||
virtual void OnSurfaceDiscarded(const SurfaceKey& aSurfaceKey) = 0;
|
||||
|
||||
virtual void SetInnerWindowID(uint64_t aInnerWindowId) = 0;
|
||||
virtual uint64_t InnerWindowID() const = 0;
|
||||
@ -256,7 +256,7 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual void OnSurfaceDiscarded() override { }
|
||||
virtual void OnSurfaceDiscarded(const SurfaceKey& aSurfaceKey) override { }
|
||||
|
||||
virtual void SetInnerWindowID(uint64_t aInnerWindowId) override
|
||||
{
|
||||
|
@ -88,9 +88,9 @@ ImageWrapper::OnImageDataComplete(nsIRequest* aRequest,
|
||||
}
|
||||
|
||||
void
|
||||
ImageWrapper::OnSurfaceDiscarded()
|
||||
ImageWrapper::OnSurfaceDiscarded(const SurfaceKey& aSurfaceKey)
|
||||
{
|
||||
return mInnerImage->OnSurfaceDiscarded();
|
||||
return mInnerImage->OnSurfaceDiscarded(aSurfaceKey);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
nsresult aStatus,
|
||||
bool aLastPart) override;
|
||||
|
||||
virtual void OnSurfaceDiscarded() override;
|
||||
virtual void OnSurfaceDiscarded(const SurfaceKey& aSurfaceKey) override;
|
||||
|
||||
virtual void SetInnerWindowID(uint64_t aInnerWindowId) override;
|
||||
virtual uint64_t InnerWindowID() const override;
|
||||
|
@ -420,11 +420,11 @@ RasterImage::WillDrawOpaqueNow()
|
||||
}
|
||||
|
||||
void
|
||||
RasterImage::OnSurfaceDiscarded()
|
||||
RasterImage::OnSurfaceDiscarded(const SurfaceKey& aSurfaceKey)
|
||||
{
|
||||
MOZ_ASSERT(mProgressTracker);
|
||||
|
||||
if (mAnimationState) {
|
||||
if (mAnimationState && aSurfaceKey.Playback() == PlaybackType::eAnimated) {
|
||||
MOZ_ASSERT(gfxPrefs::ImageMemAnimatedDiscardable());
|
||||
mAnimationState->SetDiscarded(true);
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ public:
|
||||
virtual nsresult StopAnimation() override;
|
||||
|
||||
// Methods inherited from Image
|
||||
virtual void OnSurfaceDiscarded() override;
|
||||
virtual void OnSurfaceDiscarded(const SurfaceKey& aSurfaceKey) override;
|
||||
|
||||
virtual size_t SizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf)
|
||||
const override;
|
||||
|
@ -502,7 +502,7 @@ public:
|
||||
|
||||
// If the surface was not a placeholder, tell its image that we discarded it.
|
||||
if (!aSurface->IsPlaceholder()) {
|
||||
static_cast<Image*>(imageKey)->OnSurfaceDiscarded();
|
||||
static_cast<Image*>(imageKey)->OnSurfaceDiscarded(aSurface->GetSurfaceKey());
|
||||
}
|
||||
|
||||
StopTracking(aSurface);
|
||||
|
@ -1123,7 +1123,7 @@ VectorImage::RequestDiscard()
|
||||
}
|
||||
|
||||
void
|
||||
VectorImage::OnSurfaceDiscarded()
|
||||
VectorImage::OnSurfaceDiscarded(const SurfaceKey& aSurfaceKey)
|
||||
{
|
||||
MOZ_ASSERT(mProgressTracker);
|
||||
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
nsresult aResult,
|
||||
bool aLastPart) override;
|
||||
|
||||
virtual void OnSurfaceDiscarded() override;
|
||||
virtual void OnSurfaceDiscarded(const SurfaceKey& aSurfaceKey) override;
|
||||
|
||||
/**
|
||||
* Callback for SVGRootRenderingObserver.
|
||||
|
Loading…
Reference in New Issue
Block a user