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
parent efd3e4ebdc
commit 16cc77da27
4 changed files with 29 additions and 6 deletions

View File

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