зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1809753 - Part 1: Remove quantum-dom nsIThread::EventTarget methods, r=mccr8
We aren't likely to try to make these changes any time soon, so cleaning out these unnecessary methods which just return `this` will simplify things. I was unable to find any calls to the `.eventTarget` getter in JS, which makes sense, as the nsIThread type is only really used in JS as a wrapper around the main thread in older code. Because of that, it has been removed as well. Differential Revision: https://phabricator.services.mozilla.com/D166605
This commit is contained in:
Родитель
1b2d188dea
Коммит
f410f28a30
|
@ -1959,8 +1959,7 @@ void Manager::Init(Maybe<Manager&> aOldManager) {
|
|||
// per Manager now, this lets us cleanly call Factory::Remove() once the
|
||||
// Context goes away.
|
||||
SafeRefPtr<Context> ref = Context::Create(
|
||||
SafeRefPtrFromThis(), mIOThread->SerialEventTarget(),
|
||||
MakeSafeRefPtr<SetupAction>(),
|
||||
SafeRefPtrFromThis(), mIOThread, MakeSafeRefPtr<SetupAction>(),
|
||||
aOldManager ? SomeRef(*aOldManager->mContext) : Nothing());
|
||||
mContext = ref.unsafeGetRawPtr();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -142,7 +142,7 @@ nsCOMPtr<nsISerialEventTarget> GMPContentParent::GMPEventTarget() {
|
|||
mps->GetThread(getter_AddRefs(gmpThread));
|
||||
MOZ_ASSERT(gmpThread);
|
||||
|
||||
mGMPEventTarget = gmpThread->SerialEventTarget();
|
||||
mGMPEventTarget = gmpThread;
|
||||
}
|
||||
|
||||
return mGMPEventTarget;
|
||||
|
|
|
@ -563,7 +563,7 @@ nsCOMPtr<nsISerialEventTarget> GMPParent::GMPEventTarget() {
|
|||
// nullptr if the GeckoMediaPluginService has started shutdown.
|
||||
nsCOMPtr<nsIThread> gmpThread;
|
||||
mps->GetThread(getter_AddRefs(gmpThread));
|
||||
return gmpThread ? gmpThread->SerialEventTarget() : nullptr;
|
||||
return gmpThread;
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -1380,7 +1380,8 @@ void OpenVRSession::StartHapticTimer() {
|
|||
if (!mHapticTimer && mHapticThread) {
|
||||
mLastHapticUpdate = TimeStamp();
|
||||
mHapticTimer = NS_NewTimer();
|
||||
mHapticTimer->SetTarget(mHapticThread->GetThread()->EventTarget());
|
||||
nsCOMPtr<nsIThread> thread = mHapticThread->GetThread();
|
||||
mHapticTimer->SetTarget(thread);
|
||||
mHapticTimer->InitWithNamedFuncCallback(
|
||||
HapticTimerCallback, this, kVRHapticUpdateInterval,
|
||||
nsITimer::TYPE_REPEATING_PRECISE_CAN_SKIP,
|
||||
|
|
|
@ -163,8 +163,7 @@ RefPtr<EnsureMTA::CreateInstanceAgileRefPromise> EnsureMTA::CreateInstance(
|
|||
|
||||
nsCOMPtr<nsIThread> mtaThread(GetPersistentMTAThread());
|
||||
|
||||
return InvokeAsync(mtaThread->SerialEventTarget(), __func__,
|
||||
std::move(invoker));
|
||||
return InvokeAsync(mtaThread, __func__, std::move(invoker));
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -108,14 +108,13 @@ already_AddRefed<nsISerialEventTarget>
|
|||
nsHtml5Module::GetStreamParserEventTarget() {
|
||||
MOZ_ASSERT(sNsHtml5ModuleInitialized, "nsHtml5Module not initialized.");
|
||||
if (sStreamParserThread) {
|
||||
nsCOMPtr<nsISerialEventTarget> target =
|
||||
sStreamParserThread->SerialEventTarget();
|
||||
nsCOMPtr<nsISerialEventTarget> target = sStreamParserThread;
|
||||
return target.forget();
|
||||
}
|
||||
nsCOMPtr<nsIThread> mainThread;
|
||||
NS_GetMainThread(getter_AddRefs(mainThread));
|
||||
MOZ_RELEASE_ASSERT(mainThread); // Unrecoverable situation
|
||||
nsCOMPtr<nsISerialEventTarget> target = mainThread->SerialEventTarget();
|
||||
nsCOMPtr<nsISerialEventTarget> target = mainThread;
|
||||
return target.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -353,9 +353,9 @@ RefPtr<UntrustedModulesPromise> UntrustedModulesProcessor::GetProcessedData() {
|
|||
BackgroundPriorityRegion::Clear(mThread);
|
||||
|
||||
RefPtr<UntrustedModulesProcessor> 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<ModulesTrustPromise> UntrustedModulesProcessor::GetModulesTrust(
|
||||
|
@ -377,12 +377,12 @@ RefPtr<ModulesTrustPromise> 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<ModulesTrustPromise::Private> p(
|
||||
new ModulesTrustPromise::Private(__func__));
|
||||
nsCOMPtr<nsISerialEventTarget> evtTarget(mThread->SerialEventTarget());
|
||||
nsCOMPtr<nsISerialEventTarget> evtTarget(mThread);
|
||||
const char* source = __func__;
|
||||
|
||||
auto runWrap = [evtTarget = std::move(evtTarget), p, source,
|
||||
|
@ -443,7 +443,7 @@ UntrustedModulesProcessor::GetProcessedDataInternalChildProcess() {
|
|||
RefPtr<UntrustedModulesProcessor> self(this);
|
||||
RefPtr<UntrustedModulesPromise::Private> p(
|
||||
new UntrustedModulesPromise::Private(__func__));
|
||||
nsCOMPtr<nsISerialEventTarget> evtTarget(mThread->SerialEventTarget());
|
||||
nsCOMPtr<nsISerialEventTarget> evtTarget(mThread);
|
||||
|
||||
const char* source = __func__;
|
||||
auto completionRoutine = [evtTarget = std::move(evtTarget), p,
|
||||
|
@ -542,7 +542,7 @@ void UntrustedModulesProcessor::BackgroundProcessModuleLoadQueueChildProcess() {
|
|||
ProcessModuleLoadQueueChildProcess(Priority::Background));
|
||||
|
||||
RefPtr<UntrustedModulesProcessor> self(this);
|
||||
nsCOMPtr<nsISerialEventTarget> evtTarget(mThread->SerialEventTarget());
|
||||
nsCOMPtr<nsISerialEventTarget> evtTarget(mThread);
|
||||
|
||||
const char* source = __func__;
|
||||
auto completionRoutine = [evtTarget = std::move(evtTarget),
|
||||
|
|
|
@ -635,15 +635,4 @@ LazyIdleThread::Observe(nsISupports* /* aSubject */, const char* aTopic,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LazyIdleThread::GetEventTarget(nsIEventTarget** aEventTarget) {
|
||||
nsCOMPtr<nsIEventTarget> target = this;
|
||||
target.forget(aEventTarget);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIEventTarget* LazyIdleThread::EventTarget() { return this; }
|
||||
|
||||
nsISerialEventTarget* LazyIdleThread::SerialEventTarget() { return this; }
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -1375,13 +1375,6 @@ void nsThread::DoMainThreadSpecificProcessing() const {
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsThread::GetEventTarget(nsIEventTarget** aEventTarget) {
|
||||
nsCOMPtr<nsIEventTarget> 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
|
||||
|
|
|
@ -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() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче