Skip to content

Commit

Permalink
Bug 1809753 - Part 4: Remove unnecessary GetMainThreadEventTarget, r=…
Browse files Browse the repository at this point in the history
…mccr8

This method always returned GetMainThreadSerialEventTarget(). This patch
switches all callers over to use that method instead.

We can't easily switch all calls to be calls to NS_GetMainThread(), as there is
no version of that method returning a bare nsIThread* instance.

I didn't introduce one, as we may want to add a lock around mMainThread in the
future, which would require removing nsThreadManager::GetMainThreadWeak. As
this method only returns nsISerialEventTarget, it method could remain
implemented, however, by returning a statically allocated fake event target
which forwards dispatches (and QIs to nsIThread) to the real main thread.

Differential Revision: https://phabricator.services.mozilla.com/D166608
  • Loading branch information
mystor committed Jan 16, 2023
1 parent 852d02e commit 9d6bb19
Show file tree
Hide file tree
Showing 60 changed files with 97 additions and 102 deletions.
4 changes: 2 additions & 2 deletions dom/base/ImageEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class SurfaceHelper : public Runnable {
}

already_AddRefed<gfx::DataSourceSurface> GetDataSurfaceSafe() {
nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadEventTarget();
nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadSerialEventTarget();
MOZ_ASSERT(mainTarget);
SyncRunnable::DispatchToThread(mainTarget, this, false);

Expand Down Expand Up @@ -90,7 +90,7 @@ class EncodingCompleteEvent final : public DiscardableRunnable {
if (!NS_IsMainThread() && IsCurrentThreadRunningWorker()) {
mCreationEventTarget = GetCurrentSerialEventTarget();
} else {
mCreationEventTarget = GetMainThreadEventTarget();
mCreationEventTarget = GetMainThreadSerialEventTarget();
}
}

Expand Down
2 changes: 1 addition & 1 deletion dom/base/InProcessBrowserChildMessageManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Nullable<WindowProxyHolder> InProcessBrowserChildMessageManager::GetContent(

already_AddRefed<nsIEventTarget>
InProcessBrowserChildMessageManager::GetTabEventTarget() {
nsCOMPtr<nsIEventTarget> target = GetMainThreadEventTarget();
nsCOMPtr<nsIEventTarget> target = GetMainThreadSerialEventTarget();
return target.forget();
}

Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsJSEnvironment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1977,7 +1977,7 @@ static bool DispatchToEventLoop(void* closure,
// simply NS_DispatchToMainThread. Failure during shutdown is expected and
// properly handled by the JS engine.

nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadEventTarget();
nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadSerialEventTarget();
if (!mainTarget) {
return false;
}
Expand Down
14 changes: 7 additions & 7 deletions dom/fetch/FetchService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@ RefPtr<FetchServicePromises> FetchService::FetchInstance::Fetch() {

// Create a FetchDriver instance
mFetchDriver = MakeRefPtr<FetchDriver>(
mRequest.clonePtr(), // Fetch Request
mPrincipal, // Principal
mLoadGroup, // LoadGroup
GetMainThreadEventTarget(), // MainThreadEventTarget
mCookieJarSettings, // CookieJarSettings
mPerformanceStorage, // PerformanceStorage
false // IsTrackingFetch
mRequest.clonePtr(), // Fetch Request
mPrincipal, // Principal
mLoadGroup, // LoadGroup
GetMainThreadSerialEventTarget(), // MainThreadEventTarget
mCookieJarSettings, // CookieJarSettings
mPerformanceStorage, // PerformanceStorage
false // IsTrackingFetch
);

// Call FetchDriver::Fetch to start fetching.
Expand Down
2 changes: 1 addition & 1 deletion dom/file/MutableBlobStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ MutableBlobStorage::MutableBlobStorage(MutableBlobStorageType aType,
MOZ_ASSERT(NS_IsMainThread());

if (!mEventTarget) {
mEventTarget = GetMainThreadEventTarget();
mEventTarget = GetMainThreadSerialEventTarget();
}

if (aMaxMemory == 0 && aType == eCouldBeInTemporaryFile) {
Expand Down
2 changes: 1 addition & 1 deletion dom/file/MutableBlobStreamListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ MutableBlobStreamListener::MutableBlobStreamListener(
MOZ_ASSERT(aCallback);

if (!mEventTarget) {
mEventTarget = GetMainThreadEventTarget();
mEventTarget = GetMainThreadSerialEventTarget();
}

MOZ_ASSERT(mEventTarget);
Expand Down
2 changes: 1 addition & 1 deletion dom/geolocation/Geolocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ void Geolocation::GetCurrentPosition(PositionCallback& aCallback,
static nsIEventTarget* MainThreadTarget(Geolocation* geo) {
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryReferent(geo->GetOwner());
if (!window) {
return GetMainThreadEventTarget();
return GetMainThreadSerialEventTarget();
}
return nsGlobalWindowInner::Cast(window)->EventTargetFor(
mozilla::TaskCategory::Other);
Expand Down
2 changes: 1 addition & 1 deletion dom/media/VideoUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ nsresult SimpleTimer::Init(nsIRunnable* aTask, uint32_t aTimeoutMs,
if (aTarget) {
target = aTarget;
} else {
target = GetMainThreadEventTarget();
target = GetMainThreadSerialEventTarget();
if (!target) {
return NS_ERROR_NOT_AVAILABLE;
}
Expand Down
2 changes: 1 addition & 1 deletion dom/media/eme/MediaKeys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void MediaKeys::OnInnerWindowDestroy() {
// Don't call shutdown directly because (at time of writing) mProxy can
// spin the event loop when it's shutdown. This can change the world state
// in the middle of window destruction, which we do not want.
GetMainThreadEventTarget()->Dispatch(
GetMainThreadSerialEventTarget()->Dispatch(
NewRunnableMethod("MediaKeys::Shutdown", this, &MediaKeys::Shutdown));
}

Expand Down
2 changes: 1 addition & 1 deletion dom/media/gtest/TestCDMStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ class CDMStorageTest {
nsCString failureReason;
self->mCDM
->Init(self->mCallback.get(), false, true,
GetMainThreadEventTarget())
GetMainThreadSerialEventTarget())
->Then(
thread, __func__,
[self, updates = std::move(updates)] {
Expand Down
2 changes: 1 addition & 1 deletion dom/media/mediacapabilities/DecoderBenchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ void DecoderBenchmark::CheckVersion(const nsACString& aDecoderName) {
}

DebugOnly<nsresult> rv =
GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction(
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
"DecoderBenchmark::CheckVersion", [name, version]() {
BenchmarkStorageChild::Instance()->SendCheckVersion(name, version);
}));
Expand Down
2 changes: 1 addition & 1 deletion dom/media/platforms/PDMFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ void PDMFactory::EnsureInit() {
initalization();
return;
}
nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadEventTarget();
nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadSerialEventTarget();
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction(
"PDMFactory::EnsureInit", std::move(initalization));
SyncRunnable::DispatchToThread(mainTarget, runnable);
Expand Down
3 changes: 2 additions & 1 deletion dom/media/platforms/wmf/WMFDecoderModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ bool WMFDecoderModule::CanCreateMFTDecoder(const WMFStreamType& aType) {
} else {
nsCOMPtr<nsIRunnable> runnable =
NS_NewRunnableFunction("WMFDecoderModule::Init", [&]() { Init(); });
SyncRunnable::DispatchToThread(GetMainThreadEventTarget(), runnable);
SyncRunnable::DispatchToThread(GetMainThreadSerialEventTarget(),
runnable);
}
}

Expand Down
2 changes: 1 addition & 1 deletion dom/media/webaudio/blink/HRTFDatabaseLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class HRTFDatabaseLoader::ProxyReleaseEvent final : public Runnable {
};

void HRTFDatabaseLoader::ProxyRelease() {
nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadEventTarget();
nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadSerialEventTarget();
if (MOZ_LIKELY(mainTarget)) {
RefPtr<ProxyReleaseEvent> event = new ProxyReleaseEvent(this);
DebugOnly<nsresult> rv = mainTarget->Dispatch(event, NS_DISPATCH_NORMAL);
Expand Down
2 changes: 1 addition & 1 deletion dom/media/webrtc/jsapi/MediaTransportHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ void MediaTransportHandlerSTS::Destroy() {
CSFLogDebug(LOGTAG, "%s %p", __func__, this);
// Our "destruction tour" starts on main, because we need to deregister.
if (!NS_IsMainThread()) {
GetMainThreadEventTarget()->Dispatch(NewNonOwningRunnableMethod(
GetMainThreadSerialEventTarget()->Dispatch(NewNonOwningRunnableMethod(
__func__, this, &MediaTransportHandlerSTS::Destroy));
return;
}
Expand Down
4 changes: 2 additions & 2 deletions dom/media/webrtc/jsapi/PeerConnectionCtx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,8 @@ static void GMPReady_m() {
};

static void GMPReady() {
GetMainThreadEventTarget()->Dispatch(WrapRunnableNM(&GMPReady_m),
NS_DISPATCH_NORMAL);
GetMainThreadSerialEventTarget()->Dispatch(WrapRunnableNM(&GMPReady_m),
NS_DISPATCH_NORMAL);
};

void PeerConnectionCtx::initGMP() {
Expand Down
22 changes: 11 additions & 11 deletions dom/media/webrtc/jsapi/PeerConnectionImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ void PeerConnectionImpl::UpdateNegotiationNeeded() {
}

// Queue a task to run the following steps:
GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction(
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
__func__, [this, self = RefPtr<PeerConnectionImpl>(this)] {
// If connection.[[IsClosed]] is true, abort these steps.
if (IsClosed()) {
Expand Down Expand Up @@ -1530,7 +1530,7 @@ PeerConnectionImpl::CreateOffer(const JsepOfferOptions& aOptions) {

STAMP_TIMECARD(mTimeCard, "Create Offer");

GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction(
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
__func__, [this, self = RefPtr<PeerConnectionImpl>(this), aOptions] {
std::string offer;

Expand Down Expand Up @@ -1570,7 +1570,7 @@ PeerConnectionImpl::CreateAnswer() {
// add it as a param to CreateAnswer, and convert it here.
JsepAnswerOptions options;

GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction(
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
__func__, [this, self = RefPtr<PeerConnectionImpl>(this), options] {
std::string answer;
SyncToJsep();
Expand Down Expand Up @@ -1889,7 +1889,7 @@ PeerConnectionImpl::AddIceCandidate(
mRawTrickledCandidates.push_back(aCandidate);
}
// Spec says we queue a task for these updates
GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction(
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
__func__, [this, self = RefPtr<PeerConnectionImpl>(this)] {
if (IsClosed()) {
return;
Expand All @@ -1910,7 +1910,7 @@ PeerConnectionImpl::AddIceCandidate(
static_cast<unsigned>(*result.mError), aCandidate,
level.valueOr(-1), errorString.c_str());

GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction(
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
__func__,
[this, self = RefPtr<PeerConnectionImpl>(this), errorString, result] {
if (IsClosed()) {
Expand Down Expand Up @@ -2577,7 +2577,7 @@ already_AddRefed<dom::Promise> PeerConnectionImpl::OnSetDescriptionSuccess(
void PeerConnectionImpl::DoSetDescriptionSuccessPostProcessing(
dom::RTCSdpType aSdpType, bool aRemote, const RefPtr<dom::Promise>& aP) {
// Spec says we queue a task for all the stuff that ends up back in JS
GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction(
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
__func__,
[this, self = RefPtr<PeerConnectionImpl>(this), aSdpType, aRemote, aP] {
if (IsClosed()) {
Expand Down Expand Up @@ -3829,7 +3829,7 @@ void PeerConnectionImpl::AddIceCandidate(const std::string& aCandidate,
cand.mUfrag = aUfrag;
mQueriedMDNSHostnames[addr].push_back(cand);

GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction(
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
"PeerConnectionImpl::SendQueryMDNSHostname",
[self = RefPtr<PeerConnectionImpl>(this), addr]() mutable {
if (self->mStunAddrsRequest) {
Expand Down Expand Up @@ -4033,7 +4033,7 @@ void PeerConnectionImpl::SignalHandler::IceGatheringStateChange_s(
dom::RTCIceGatheringState aState) {
ASSERT_ON_THREAD(mSTSThread);

GetMainThreadEventTarget()->Dispatch(
GetMainThreadSerialEventTarget()->Dispatch(
NS_NewRunnableFunction(__func__,
[handle = mHandle, aState] {
PeerConnectionWrapper wrapper(handle);
Expand All @@ -4049,7 +4049,7 @@ void PeerConnectionImpl::SignalHandler::IceConnectionStateChange_s(
dom::RTCIceConnectionState aState) {
ASSERT_ON_THREAD(mSTSThread);

GetMainThreadEventTarget()->Dispatch(
GetMainThreadSerialEventTarget()->Dispatch(
NS_NewRunnableFunction(__func__,
[handle = mHandle, aState] {
PeerConnectionWrapper wrapper(handle);
Expand All @@ -4068,7 +4068,7 @@ void PeerConnectionImpl::SignalHandler::OnCandidateFound_s(

MOZ_ASSERT(!aCandidateInfo.mUfrag.empty());

GetMainThreadEventTarget()->Dispatch(
GetMainThreadSerialEventTarget()->Dispatch(
NS_NewRunnableFunction(__func__,
[handle = mHandle, aTransportId, aCandidateInfo] {
PeerConnectionWrapper wrapper(handle);
Expand All @@ -4083,7 +4083,7 @@ void PeerConnectionImpl::SignalHandler::OnCandidateFound_s(
void PeerConnectionImpl::SignalHandler::AlpnNegotiated_s(
const std::string& aAlpn, bool aPrivacyRequested) {
MOZ_DIAGNOSTIC_ASSERT((aAlpn == "c-webrtc") == aPrivacyRequested);
GetMainThreadEventTarget()->Dispatch(
GetMainThreadSerialEventTarget()->Dispatch(
NS_NewRunnableFunction(__func__,
[handle = mHandle, aPrivacyRequested] {
PeerConnectionWrapper wrapper(handle);
Expand Down
6 changes: 3 additions & 3 deletions dom/media/webrtc/jsapi/RTCRtpSender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ already_AddRefed<Promise> RTCRtpSender::SetParameters(

// If the media stack is successfully configured with parameters,
// queue a task to run the following steps:
GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction(
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
__func__,
[this, self = RefPtr<RTCRtpSender>(this), p, paramsCopy, serialNumber] {
// Set sender.[[LastReturnedParameters]] to null.
Expand Down Expand Up @@ -853,7 +853,7 @@ void RTCRtpSender::GetParameters(RTCRtpSendParameters& aParameters) {
mLastReturnedParameters = Some(aParameters);

// Queue a task that sets sender.[[LastReturnedParameters]] to null.
GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction(
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
__func__, [this, self = RefPtr<RTCRtpSender>(this)] {
mLastReturnedParameters = Nothing();
}));
Expand Down Expand Up @@ -1068,7 +1068,7 @@ RefPtr<dom::Promise> ReplaceTrackOperation::CallImpl(ErrorResult& aError) {
}

// Queue a task that runs the following steps:
GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction(
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
__func__, [p, sender, track = mNewTrack]() MOZ_CAN_RUN_SCRIPT_BOUNDARY {
// If connection.[[IsClosed]] is true, abort these steps.
// Set sender.[[SenderTrack]] to withTrack.
Expand Down
4 changes: 2 additions & 2 deletions dom/media/webrtc/jsapi/RTCRtpTransceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ void RTCRtpTransceiver::RollbackToStableDtlsTransport() {

void RTCRtpTransceiver::UpdateDtlsTransportState(
const std::string& aTransportId, TransportLayer::State aState) {
if (!GetMainThreadEventTarget()->IsOnCurrentThread()) {
GetMainThreadEventTarget()->Dispatch(
if (!GetMainThreadSerialEventTarget()->IsOnCurrentThread()) {
GetMainThreadSerialEventTarget()->Dispatch(
WrapRunnable(this, &RTCRtpTransceiver::UpdateDtlsTransportState,
aTransportId, aState),
NS_DISPATCH_NORMAL);
Expand Down
2 changes: 1 addition & 1 deletion dom/media/webrtc/transport/WebrtcTCPSocketWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ WebrtcTCPSocketWrapper::WebrtcTCPSocketWrapper(
mWebrtcTCPSocket(nullptr),
mMainThread(nullptr),
mSocketThread(nullptr) {
mMainThread = GetMainThreadEventTarget();
mMainThread = GetMainThreadSerialEventTarget();
mSocketThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID);
MOZ_RELEASE_ASSERT(mMainThread, "no main thread");
MOZ_RELEASE_ASSERT(mSocketThread, "no socket thread");
Expand Down
2 changes: 1 addition & 1 deletion dom/media/webrtc/transport/ipc/WebrtcTCPSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ WebrtcTCPSocket::WebrtcTCPSocket(WebrtcTCPSocketCallback* aCallbacks)
mSocketIn(nullptr),
mSocketOut(nullptr) {
LOG(("WebrtcTCPSocket::WebrtcTCPSocket %p\n", this));
mMainThread = GetMainThreadEventTarget();
mMainThread = GetMainThreadSerialEventTarget();
mSocketThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID);
MOZ_RELEASE_ASSERT(mMainThread, "no main thread");
MOZ_RELEASE_ASSERT(mSocketThread, "no socket thread");
Expand Down
8 changes: 4 additions & 4 deletions dom/media/webrtc/transportbridge/MediaPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,7 @@ class GenericReceiveListener : public MediaTrackListener {
void OnRtpReceived() {
if (mMaybeTrackNeedsUnmute) {
mMaybeTrackNeedsUnmute = false;
GetMainThreadEventTarget()->Dispatch(
GetMainThreadSerialEventTarget()->Dispatch(
NewRunnableMethod("GenericReceiveListener::OnRtpReceived_m", this,
&GenericReceiveListener::OnRtpReceived_m));
}
Expand All @@ -1224,7 +1224,7 @@ class GenericReceiveListener : public MediaTrackListener {
mSource->Destroy();
}

GetMainThreadEventTarget()->Dispatch(
GetMainThreadSerialEventTarget()->Dispatch(
NewRunnableMethod("RemoteTrackSource::ForceEnded", mTrackSource.get(),
&RemoteTrackSource::ForceEnded));
}
Expand Down Expand Up @@ -1288,7 +1288,7 @@ class MediaPipelineReceiveAudio::PipelineListener
void MakePrincipalPrivate_s() {
mForceSilence = true;

GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction(
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
"MediaPipelineReceiveAudio::PipelineListener::MakePrincipalPrivate_s",
[self = RefPtr<PipelineListener>(this), this] {
class Message : public ControlMessage {
Expand Down Expand Up @@ -1494,7 +1494,7 @@ class MediaPipelineReceiveVideo::PipelineListener
mForceDropFrames = true;
}

GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction(
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
__func__, [self = RefPtr<PipelineListener>(this), this] {
RefPtr<nsIPrincipal> privatePrincipal =
NullPrincipal::CreateWithInheritedAttributes(
Expand Down
2 changes: 1 addition & 1 deletion dom/media/webvtt/TextTrackList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void TextTrackList::CreateAndDispatchChangeEvent() {
void TextTrackList::CreateAndDispatchTrackEventRunner(
TextTrack* aTrack, const nsAString& aEventName) {
DebugOnly<nsresult> rv;
nsCOMPtr<nsIEventTarget> target = GetMainThreadEventTarget();
nsCOMPtr<nsIEventTarget> target = GetMainThreadSerialEventTarget();
if (!target) {
// If we are not able to get the main-thread object we are shutting down.
return;
Expand Down
2 changes: 1 addition & 1 deletion dom/notification/Notification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2322,7 +2322,7 @@ nsresult Notification::DispatchToMainThread(
nsIEventTarget::DISPATCH_NORMAL);
}
}
nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadEventTarget();
nsCOMPtr<nsIEventTarget> mainTarget = GetMainThreadSerialEventTarget();
MOZ_ASSERT(mainTarget);
return mainTarget->Dispatch(std::move(aRunnable),
nsIEventTarget::DISPATCH_NORMAL);
Expand Down
4 changes: 2 additions & 2 deletions dom/webauthn/AndroidWebAuthnTokenManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ RefPtr<U2FRegisterPromise> AndroidWebAuthnTokenManager::Register(

ClearPromises();

GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction(
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
"java::WebAuthnTokenManager::WebAuthnMakeCredential",
[self = RefPtr{this}, aInfo, aForceNoneAttestation]() {
AssertIsOnMainThread();
Expand Down Expand Up @@ -282,7 +282,7 @@ RefPtr<U2FSignPromise> AndroidWebAuthnTokenManager::Sign(

ClearPromises();

GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction(
GetMainThreadSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
"java::WebAuthnTokenManager::WebAuthnGetAssertion",
[self = RefPtr{this}, aInfo]() {
AssertIsOnMainThread();
Expand Down
Loading

0 comments on commit 9d6bb19

Please sign in to comment.