Bug 1317552. Send unlocked draw notifications for images async when asked to. r=aosmond
This commit is contained in:
@@ -146,5 +146,25 @@ ImageResource::EvaluateAnimation()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ImageResource::SendOnUnlockedDraw(uint32_t aFlags)
|
||||||
|
{
|
||||||
|
if (!mProgressTracker) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(aFlags & FLAG_ASYNC_NOTIFY)) {
|
||||||
|
mProgressTracker->OnUnlockedDraw();
|
||||||
|
} else {
|
||||||
|
NotNull<RefPtr<ImageResource>> image = WrapNotNull(this);
|
||||||
|
NS_DispatchToMainThread(NS_NewRunnableFunction([=]() -> void {
|
||||||
|
RefPtr<ProgressTracker> tracker = image->GetProgressTracker();
|
||||||
|
if (tracker) {
|
||||||
|
tracker->OnUnlockedDraw();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace image
|
} // namespace image
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|||||||
@@ -305,6 +305,8 @@ protected:
|
|||||||
virtual nsresult StartAnimation() = 0;
|
virtual nsresult StartAnimation() = 0;
|
||||||
virtual nsresult StopAnimation() = 0;
|
virtual nsresult StopAnimation() = 0;
|
||||||
|
|
||||||
|
void SendOnUnlockedDraw(uint32_t aFlags);
|
||||||
|
|
||||||
// Member data shared by all implementations of this abstract class
|
// Member data shared by all implementations of this abstract class
|
||||||
RefPtr<ProgressTracker> mProgressTracker;
|
RefPtr<ProgressTracker> mProgressTracker;
|
||||||
RefPtr<ImageURL> mURI;
|
RefPtr<ImageURL> mURI;
|
||||||
|
|||||||
@@ -587,8 +587,8 @@ RasterImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsUnlocked() && mProgressTracker) {
|
if (IsUnlocked()) {
|
||||||
mProgressTracker->OnUnlockedDraw();
|
SendOnUnlockedDraw(aFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<layers::ImageContainer> container = mImageContainer.get();
|
RefPtr<layers::ImageContainer> container = mImageContainer.get();
|
||||||
@@ -1343,10 +1343,11 @@ RasterImage::Draw(gfxContext* aContext,
|
|||||||
return DrawResult::BAD_ARGS;
|
return DrawResult::BAD_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsUnlocked() && mProgressTracker) {
|
if (IsUnlocked()) {
|
||||||
mProgressTracker->OnUnlockedDraw();
|
SendOnUnlockedDraw(aFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// If we're not using SamplingFilter::GOOD, we shouldn't high-quality scale or
|
// If we're not using SamplingFilter::GOOD, we shouldn't high-quality scale or
|
||||||
// downscale during decode.
|
// downscale during decode.
|
||||||
uint32_t flags = aSamplingFilter == SamplingFilter::GOOD
|
uint32_t flags = aSamplingFilter == SamplingFilter::GOOD
|
||||||
|
|||||||
@@ -835,8 +835,8 @@ VectorImage::Draw(gfxContext* aContext,
|
|||||||
return DrawResult::TEMPORARY_ERROR;
|
return DrawResult::TEMPORARY_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mAnimationConsumers == 0 && mProgressTracker) {
|
if (mAnimationConsumers == 0) {
|
||||||
mProgressTracker->OnUnlockedDraw();
|
SendOnUnlockedDraw(aFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoRestore<bool> autoRestoreIsDrawing(mIsDrawing);
|
AutoRestore<bool> autoRestoreIsDrawing(mIsDrawing);
|
||||||
|
|||||||
Reference in New Issue
Block a user