diff --git a/dom/cache/Manager.cpp b/dom/cache/Manager.cpp index c1bdb443d8efc..a2362c37d7542 100644 --- a/dom/cache/Manager.cpp +++ b/dom/cache/Manager.cpp @@ -1959,8 +1959,7 @@ void Manager::Init(Maybe aOldManager) { // per Manager now, this lets us cleanly call Factory::Remove() once the // Context goes away. SafeRefPtr ref = Context::Create( - SafeRefPtrFromThis(), mIOThread->SerialEventTarget(), - MakeSafeRefPtr(), + SafeRefPtrFromThis(), mIOThread, MakeSafeRefPtr(), aOldManager ? SomeRef(*aOldManager->mContext) : Nothing()); mContext = ref.unsafeGetRawPtr(); } diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp index aad6afc837566..ae473ea05bd46 100644 --- a/dom/media/GraphDriver.cpp +++ b/dom/media/GraphDriver.cpp @@ -142,7 +142,7 @@ void ThreadedDriver::Start() { // See AudioInitTask nsresult rv = NS_NewNamedThread("MediaTrackGrph", getter_AddRefs(mThread)); if (NS_SUCCEEDED(rv)) { - mThread->EventTarget()->Dispatch(event.forget(), NS_DISPATCH_NORMAL); + mThread->Dispatch(event.forget(), NS_DISPATCH_NORMAL); } } diff --git a/dom/media/GraphDriver.h b/dom/media/GraphDriver.h index 0180c6a5dcede..8e62b2923339c 100644 --- a/dom/media/GraphDriver.h +++ b/dom/media/GraphDriver.h @@ -445,7 +445,7 @@ class ThreadedDriver : public GraphDriver { nsIThread* Thread() const { return mThread; } bool OnThread() const override { - return !mThread || mThread->EventTarget()->IsOnCurrentThread(); + return !mThread || mThread->IsOnCurrentThread(); } bool ThreadRunning() const override { return mThreadRunning; } diff --git a/dom/media/GraphRunner.cpp b/dom/media/GraphRunner.cpp index 0cb7135d8b03e..850f423790aae 100644 --- a/dom/media/GraphRunner.cpp +++ b/dom/media/GraphRunner.cpp @@ -153,9 +153,7 @@ NS_IMETHODIMP GraphRunner::Run() { return NS_OK; } -bool GraphRunner::OnThread() const { - return mThread->EventTarget()->IsOnCurrentThread(); -} +bool GraphRunner::OnThread() const { return mThread->IsOnCurrentThread(); } #ifdef DEBUG bool GraphRunner::InDriverIteration(const GraphDriver* aDriver) const { diff --git a/dom/media/gmp/GMPContentParent.cpp b/dom/media/gmp/GMPContentParent.cpp index 10fea5c9e3815..4c46f7bdec75f 100644 --- a/dom/media/gmp/GMPContentParent.cpp +++ b/dom/media/gmp/GMPContentParent.cpp @@ -142,7 +142,7 @@ nsCOMPtr GMPContentParent::GMPEventTarget() { mps->GetThread(getter_AddRefs(gmpThread)); MOZ_ASSERT(gmpThread); - mGMPEventTarget = gmpThread->SerialEventTarget(); + mGMPEventTarget = gmpThread; } return mGMPEventTarget; diff --git a/dom/media/gmp/GMPParent.cpp b/dom/media/gmp/GMPParent.cpp index c425b07091792..555ca3e800832 100644 --- a/dom/media/gmp/GMPParent.cpp +++ b/dom/media/gmp/GMPParent.cpp @@ -563,7 +563,7 @@ nsCOMPtr GMPParent::GMPEventTarget() { // nullptr if the GeckoMediaPluginService has started shutdown. nsCOMPtr gmpThread; mps->GetThread(getter_AddRefs(gmpThread)); - return gmpThread ? gmpThread->SerialEventTarget() : nullptr; + return gmpThread; } /* static */ diff --git a/gfx/vr/service/OpenVRSession.cpp b/gfx/vr/service/OpenVRSession.cpp index 68ec72876e8e5..b0e3ad4f80c01 100644 --- a/gfx/vr/service/OpenVRSession.cpp +++ b/gfx/vr/service/OpenVRSession.cpp @@ -1380,7 +1380,8 @@ void OpenVRSession::StartHapticTimer() { if (!mHapticTimer && mHapticThread) { mLastHapticUpdate = TimeStamp(); mHapticTimer = NS_NewTimer(); - mHapticTimer->SetTarget(mHapticThread->GetThread()->EventTarget()); + nsCOMPtr thread = mHapticThread->GetThread(); + mHapticTimer->SetTarget(thread); mHapticTimer->InitWithNamedFuncCallback( HapticTimerCallback, this, kVRHapticUpdateInterval, nsITimer::TYPE_REPEATING_PRECISE_CAN_SKIP, diff --git a/ipc/mscom/EnsureMTA.cpp b/ipc/mscom/EnsureMTA.cpp index 2258dd9dcd301..4ecc8332510bb 100644 --- a/ipc/mscom/EnsureMTA.cpp +++ b/ipc/mscom/EnsureMTA.cpp @@ -163,8 +163,7 @@ RefPtr EnsureMTA::CreateInstance( nsCOMPtr mtaThread(GetPersistentMTAThread()); - return InvokeAsync(mtaThread->SerialEventTarget(), __func__, - std::move(invoker)); + return InvokeAsync(mtaThread, __func__, std::move(invoker)); } /* static */ diff --git a/parser/html/nsHtml5Module.cpp b/parser/html/nsHtml5Module.cpp index 533e34b100224..366a63e54fb9d 100644 --- a/parser/html/nsHtml5Module.cpp +++ b/parser/html/nsHtml5Module.cpp @@ -108,14 +108,13 @@ already_AddRefed nsHtml5Module::GetStreamParserEventTarget() { MOZ_ASSERT(sNsHtml5ModuleInitialized, "nsHtml5Module not initialized."); if (sStreamParserThread) { - nsCOMPtr target = - sStreamParserThread->SerialEventTarget(); + nsCOMPtr target = sStreamParserThread; return target.forget(); } nsCOMPtr mainThread; NS_GetMainThread(getter_AddRefs(mainThread)); MOZ_RELEASE_ASSERT(mainThread); // Unrecoverable situation - nsCOMPtr target = mainThread->SerialEventTarget(); + nsCOMPtr target = mainThread; return target.forget(); } diff --git a/toolkit/xre/dllservices/UntrustedModulesProcessor.cpp b/toolkit/xre/dllservices/UntrustedModulesProcessor.cpp index 0bab977e41341..7d9955a61867d 100644 --- a/toolkit/xre/dllservices/UntrustedModulesProcessor.cpp +++ b/toolkit/xre/dllservices/UntrustedModulesProcessor.cpp @@ -353,9 +353,9 @@ RefPtr UntrustedModulesProcessor::GetProcessedData() { BackgroundPriorityRegion::Clear(mThread); RefPtr self(this); - return InvokeAsync( - mThread->SerialEventTarget(), __func__, - [self = std::move(self)]() { return self->GetProcessedDataInternal(); }); + return InvokeAsync(mThread, __func__, [self = std::move(self)]() { + return self->GetProcessedDataInternal(); + }); } RefPtr UntrustedModulesProcessor::GetModulesTrust( @@ -377,12 +377,12 @@ RefPtr UntrustedModulesProcessor::GetModulesTrust( // Clear any background priority in case background processing is running. BackgroundPriorityRegion::Clear(mThread); - return InvokeAsync(mThread->SerialEventTarget(), __func__, std::move(run)); + return InvokeAsync(mThread, __func__, std::move(run)); } RefPtr p( new ModulesTrustPromise::Private(__func__)); - nsCOMPtr evtTarget(mThread->SerialEventTarget()); + nsCOMPtr evtTarget(mThread); const char* source = __func__; auto runWrap = [evtTarget = std::move(evtTarget), p, source, @@ -443,7 +443,7 @@ UntrustedModulesProcessor::GetProcessedDataInternalChildProcess() { RefPtr self(this); RefPtr p( new UntrustedModulesPromise::Private(__func__)); - nsCOMPtr evtTarget(mThread->SerialEventTarget()); + nsCOMPtr evtTarget(mThread); const char* source = __func__; auto completionRoutine = [evtTarget = std::move(evtTarget), p, @@ -542,7 +542,7 @@ void UntrustedModulesProcessor::BackgroundProcessModuleLoadQueueChildProcess() { ProcessModuleLoadQueueChildProcess(Priority::Background)); RefPtr self(this); - nsCOMPtr evtTarget(mThread->SerialEventTarget()); + nsCOMPtr evtTarget(mThread); const char* source = __func__; auto completionRoutine = [evtTarget = std::move(evtTarget), diff --git a/xpcom/threads/LazyIdleThread.cpp b/xpcom/threads/LazyIdleThread.cpp index 7824b74635c05..bd9d2cd021aa4 100644 --- a/xpcom/threads/LazyIdleThread.cpp +++ b/xpcom/threads/LazyIdleThread.cpp @@ -635,15 +635,4 @@ LazyIdleThread::Observe(nsISupports* /* aSubject */, const char* aTopic, return NS_OK; } -NS_IMETHODIMP -LazyIdleThread::GetEventTarget(nsIEventTarget** aEventTarget) { - nsCOMPtr target = this; - target.forget(aEventTarget); - return NS_OK; -} - -nsIEventTarget* LazyIdleThread::EventTarget() { return this; } - -nsISerialEventTarget* LazyIdleThread::SerialEventTarget() { return this; } - } // namespace mozilla diff --git a/xpcom/threads/TimerThread.h b/xpcom/threads/TimerThread.h index 1faa24d3181d2..3a53ee292632d 100644 --- a/xpcom/threads/TimerThread.h +++ b/xpcom/threads/TimerThread.h @@ -53,9 +53,7 @@ class TimerThread final : public mozilla::Runnable, public nsIObserver { void DoBeforeSleep(); void DoAfterSleep(); - bool IsOnTimerThread() const { - return mThread->SerialEventTarget()->IsOnCurrentThread(); - } + bool IsOnTimerThread() const { return mThread->IsOnCurrentThread(); } uint32_t AllowedEarlyFiringMicroseconds(); diff --git a/xpcom/threads/nsIThread.idl b/xpcom/threads/nsIThread.idl index d8d3818e2a1d6..08cc888d146de 100644 --- a/xpcom/threads/nsIThread.idl +++ b/xpcom/threads/nsIThread.idl @@ -164,24 +164,6 @@ interface nsIThread : nsISerialEventTarget [noscript] void dispatchToQueue(in alreadyAddRefed_nsIRunnable event, in EventQueuePriority queue); - /** - * Use this attribute to dispatch runnables to the thread. Eventually, the - * eventTarget attribute will be the only way to dispatch events to a - * thread--nsIThread will no longer inherit from nsIEventTarget. - */ - readonly attribute nsIEventTarget eventTarget; - - /** - * A fast C++ getter for the eventTarget. - */ - [noscript,notxpcom] nsIEventTargetPtr EventTarget(); - - /** - * A fast C++ getter for the eventTarget. It asserts that the thread's event - * target is an nsISerialEventTarget and then returns it. - */ - [noscript,notxpcom] nsISerialEventTargetPtr SerialEventTarget(); - /** * This is set to the end of the last 50+ms event that was executed on * this thread (for MainThread only). Otherwise returns a null TimeStamp. diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp index d4fcb44d01701..6f18010fd063a 100644 --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -1375,13 +1375,6 @@ void nsThread::DoMainThreadSpecificProcessing() const { } } -NS_IMETHODIMP -nsThread::GetEventTarget(nsIEventTarget** aEventTarget) { - nsCOMPtr target = this; - target.forget(aEventTarget); - return NS_OK; -} - //----------------------------------------------------------------------------- // nsIDirectTaskDispatcher @@ -1411,10 +1404,6 @@ NS_IMETHODIMP nsThread::HaveDirectTasks(bool* aValue) { return NS_OK; } -nsIEventTarget* nsThread::EventTarget() { return this; } - -nsISerialEventTarget* nsThread::SerialEventTarget() { return this; } - NS_IMPL_ISUPPORTS(nsThreadShutdownContext, nsIThreadShutdown) NS_IMETHODIMP diff --git a/xpcom/threads/nsThreadUtils.cpp b/xpcom/threads/nsThreadUtils.cpp index 74608b8e47ddc..226411b5d7ebb 100644 --- a/xpcom/threads/nsThreadUtils.cpp +++ b/xpcom/threads/nsThreadUtils.cpp @@ -551,7 +551,7 @@ nsIEventTarget* GetCurrentEventTarget() { return nullptr; } - return thread->EventTarget(); + return thread; } nsIEventTarget* GetMainThreadEventTarget() { @@ -574,7 +574,7 @@ nsISerialEventTarget* GetCurrentSerialEventTarget() { return nullptr; } - return thread->SerialEventTarget(); + return thread; } nsISerialEventTarget* GetMainThreadSerialEventTarget() {