Bug 1519567, use medium high priority queue for imglib notifications, r=tnikkel

--HG--
extra : rebase_source : e78679b1bec411508291c7ce5f9c2600d1fe5c90
This commit is contained in:
Olli Pettay 2019-03-01 15:11:56 +02:00
Родитель 4ca6abb8b0
Коммит cf64822527
4 изменённых файлов: 22 добавлений и 18 удалений

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

@ -82,13 +82,13 @@ void IDecodingTask::NotifyProgress(NotNull<RasterImage*> aImage,
// We're forced to notify asynchronously.
NotNull<RefPtr<RasterImage>> image = aImage;
mEventTarget->Dispatch(NS_NewRunnableFunction("IDecodingTask::NotifyProgress",
[=]() -> void {
image->NotifyProgress(
progress, invalidRect,
frameCount, decoderFlags,
surfaceFlags);
}),
mEventTarget->Dispatch(CreateMediumHighRunnable(NS_NewRunnableFunction(
"IDecodingTask::NotifyProgress",
[=]() -> void {
image->NotifyProgress(progress, invalidRect,
frameCount, decoderFlags,
surfaceFlags);
})),
NS_DISPATCH_NORMAL);
}
@ -118,15 +118,15 @@ void IDecodingTask::NotifyDecodeComplete(NotNull<RasterImage*> aImage,
// We're forced to notify asynchronously.
NotNull<RefPtr<RasterImage>> image = aImage;
mEventTarget->Dispatch(
NS_NewRunnableFunction("IDecodingTask::NotifyDecodeComplete",
mEventTarget->Dispatch(CreateMediumHighRunnable(NS_NewRunnableFunction(
"IDecodingTask::NotifyDecodeComplete",
[=]() -> void {
image->NotifyDecodeComplete(
finalStatus, metadata, telemetry, progress,
invalidRect, frameCount, decoderFlags,
surfaceFlags);
}),
NS_DISPATCH_NORMAL);
})),
NS_DISPATCH_NORMAL);
}
///////////////////////////////////////////////////////////////////////////////

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

@ -400,7 +400,8 @@ void ImageResource::SendOnUnlockedDraw(uint32_t aFlags) {
tracker->OnUnlockedDraw();
}
});
eventTarget->Dispatch(ev.forget(), NS_DISPATCH_NORMAL);
eventTarget->Dispatch(CreateMediumHighRunnable(ev.forget()),
NS_DISPATCH_NORMAL);
}
}

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

@ -1180,14 +1180,14 @@ void VectorImage::SendFrameComplete(bool aDidCache, uint32_t aFlags) {
GetMaxSizedIntRect());
} else {
NotNull<RefPtr<VectorImage>> image = WrapNotNull(this);
NS_DispatchToMainThread(NS_NewRunnableFunction(
NS_DispatchToMainThread(CreateMediumHighRunnable(NS_NewRunnableFunction(
"ProgressTracker::SyncNotifyProgress", [=]() -> void {
RefPtr<ProgressTracker> tracker = image->GetProgressTracker();
if (tracker) {
tracker->SyncNotifyProgress(FLAG_FRAME_COMPLETE,
GetMaxSizedIntRect());
}
}));
})));
}
}
@ -1513,7 +1513,8 @@ void VectorImage::InvalidateObserversOnNextRefreshDriverTick() {
nsCOMPtr<nsIRunnable> ev(NS_NewRunnableFunction(
"VectorImage::SendInvalidationNotifications",
[=]() -> void { self->SendInvalidationNotifications(); }));
eventTarget->Dispatch(ev.forget(), NS_DISPATCH_NORMAL);
eventTarget->Dispatch(CreateMediumHighRunnable(ev.forget()),
NS_DISPATCH_NORMAL);
}
void VectorImage::PropagateUseCounters(Document* aParentDocument) {

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

@ -284,11 +284,12 @@ nsresult imgRequestProxy::DispatchWithTargetIfAvailable(
// rather we need to (e.g. we are in the wrong scheduler group context).
// As such, we do not set mHadDispatch for telemetry purposes.
if (mEventTarget) {
mEventTarget->Dispatch(std::move(aEvent), NS_DISPATCH_NORMAL);
mEventTarget->Dispatch(CreateMediumHighRunnable(std::move(aEvent)),
NS_DISPATCH_NORMAL);
return NS_OK;
}
return NS_DispatchToMainThread(std::move(aEvent));
return NS_DispatchToMainThread(CreateMediumHighRunnable(std::move(aEvent)));
}
void imgRequestProxy::DispatchWithTarget(already_AddRefed<nsIRunnable> aEvent) {
@ -298,7 +299,8 @@ void imgRequestProxy::DispatchWithTarget(already_AddRefed<nsIRunnable> aEvent) {
MOZ_ASSERT(mEventTarget);
mHadDispatch = true;
mEventTarget->Dispatch(std::move(aEvent), NS_DISPATCH_NORMAL);
mEventTarget->Dispatch(CreateMediumHighRunnable(std::move(aEvent)),
NS_DISPATCH_NORMAL);
}
void imgRequestProxy::AddToOwner(Document* aLoadingDocument) {