Bug 1809753 - Part 4: Remove unnecessary GetMainThreadEventTarget, r=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
This commit is contained in:
@@ -2755,7 +2755,7 @@ WebSocketImpl::Dispatch(already_AddRefed<nsIRunnable> aEvent, uint32_t aFlags) {
|
||||
if (mIsMainThread) {
|
||||
return mMainThreadEventTarget
|
||||
? mMainThreadEventTarget->Dispatch(event_ref.forget())
|
||||
: GetMainThreadEventTarget()->Dispatch(event_ref.forget());
|
||||
: GetMainThreadSerialEventTarget()->Dispatch(event_ref.forget());
|
||||
}
|
||||
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
Reference in New Issue
Block a user