summaryrefslogtreecommitdiffstats
path: root/image/imgRequest.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /image/imgRequest.cpp
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'image/imgRequest.cpp')
-rw-r--r--image/imgRequest.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/image/imgRequest.cpp b/image/imgRequest.cpp
index 47bdd3480c..9713d2f33e 100644
--- a/image/imgRequest.cpp
+++ b/image/imgRequest.cpp
@@ -334,8 +334,7 @@ void imgRequest::Cancel(nsresult aStatus) {
if (NS_IsMainThread()) {
ContinueCancel(aStatus);
} else {
- RefPtr<ProgressTracker> progressTracker = GetProgressTracker();
- nsCOMPtr<nsIEventTarget> eventTarget = progressTracker->GetEventTarget();
+ nsCOMPtr<nsIEventTarget> eventTarget = GetMainThreadSerialEventTarget();
nsCOMPtr<nsIRunnable> ev = new imgRequestMainThreadCancel(this, aStatus);
eventTarget->Dispatch(ev.forget(), NS_DISPATCH_NORMAL);
}
@@ -1027,26 +1026,23 @@ imgRequest::OnDataAvailable(nsIRequest* aRequest, nsIInputStream* aInStr,
if (result.mImage) {
image = result.mImage;
- nsCOMPtr<nsIEventTarget> eventTarget;
// Update our state to reflect this new part.
{
MutexAutoLock lock(mMutex);
mImage = image;
- // We only get an event target if we are not on the main thread, because
- // we have to dispatch in that case. If we are on the main thread, but
- // on a different scheduler group than ProgressTracker would give us,
- // that is okay because nothing in imagelib requires that, just our
- // listeners (which have their own checks).
- if (!NS_IsMainThread()) {
- eventTarget = mProgressTracker->GetEventTarget();
- MOZ_ASSERT(eventTarget);
- }
-
mProgressTracker = nullptr;
}
+ // We only get an event target if we are not on the main thread, because
+ // we have to dispatch in that case.
+ nsCOMPtr<nsIEventTarget> eventTarget;
+ if (!NS_IsMainThread()) {
+ eventTarget = GetMainThreadSerialEventTarget();
+ MOZ_ASSERT(eventTarget);
+ }
+
// Some property objects are not threadsafe, and we need to send
// OnImageAvailable on the main thread, so finish on the main thread.
if (!eventTarget) {