diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /image/imgRequest.cpp | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'image/imgRequest.cpp')
-rw-r--r-- | image/imgRequest.cpp | 22 |
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) { |