Bug 1317552. Send unlocked draw notifications for images async when asked to. r=aosmond

This commit is contained in:
Timothy Nikkel 2016-11-17 00:25:53 -06:00
Родитель 26308b5b88
Коммит 0b046c7ab4
4 изменённых файлов: 29 добавлений и 6 удалений

Просмотреть файл

@ -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 mozilla

Просмотреть файл

@ -305,6 +305,8 @@ protected:
virtual nsresult StartAnimation() = 0;
virtual nsresult StopAnimation() = 0;
void SendOnUnlockedDraw(uint32_t aFlags);
// Member data shared by all implementations of this abstract class
RefPtr<ProgressTracker> mProgressTracker;
RefPtr<ImageURL> mURI;

Просмотреть файл

@ -587,8 +587,8 @@ RasterImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags)
return nullptr;
}
if (IsUnlocked() && mProgressTracker) {
mProgressTracker->OnUnlockedDraw();
if (IsUnlocked()) {
SendOnUnlockedDraw(aFlags);
}
RefPtr<layers::ImageContainer> container = mImageContainer.get();
@ -1343,10 +1343,11 @@ RasterImage::Draw(gfxContext* aContext,
return DrawResult::BAD_ARGS;
}
if (IsUnlocked() && mProgressTracker) {
mProgressTracker->OnUnlockedDraw();
if (IsUnlocked()) {
SendOnUnlockedDraw(aFlags);
}
// If we're not using SamplingFilter::GOOD, we shouldn't high-quality scale or
// downscale during decode.
uint32_t flags = aSamplingFilter == SamplingFilter::GOOD

Просмотреть файл

@ -835,8 +835,8 @@ VectorImage::Draw(gfxContext* aContext,
return DrawResult::TEMPORARY_ERROR;
}
if (mAnimationConsumers == 0 && mProgressTracker) {
mProgressTracker->OnUnlockedDraw();
if (mAnimationConsumers == 0) {
SendOnUnlockedDraw(aFlags);
}
AutoRestore<bool> autoRestoreIsDrawing(mIsDrawing);