Skip to content
Snippets Groups Projects
Commit 170dc76f authored by alwu's avatar alwu
Browse files

Bug 1747290 - remove dead function. r=xpcom-reviewers,mccr8

parent 6fbca392
No related branches found
No related tags found
No related merge requests found
......@@ -368,38 +368,4 @@ void AbstractThread::DispatchDirectTask(
}
}
/* static */
already_AddRefed<AbstractThread> AbstractThread::CreateXPCOMThreadWrapper(
nsIThread* aThread, bool aRequireTailDispatch, bool aOnThread) {
nsCOMPtr<nsIThreadInternal> internalThread = do_QueryInterface(aThread);
MOZ_ASSERT(internalThread, "Need an nsThread for AbstractThread");
RefPtr<XPCOMThreadWrapper> wrapper =
new XPCOMThreadWrapper(internalThread, aRequireTailDispatch, aOnThread);
bool onCurrentThread = false;
Unused << aThread->IsOnCurrentThread(&onCurrentThread);
if (onCurrentThread) {
if (!aOnThread) {
MOZ_ASSERT(!sCurrentThreadTLS.get(),
"There can only be a single XPCOMThreadWrapper available on a "
"thread");
sCurrentThreadTLS.set(wrapper);
}
return wrapper.forget();
}
// Set the thread-local sCurrentThreadTLS to point to the wrapper on the
// target thread. This ensures that sCurrentThreadTLS is as expected by
// AbstractThread::GetCurrent() on the target thread.
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(
"AbstractThread::CreateXPCOMThreadWrapper", [wrapper]() {
MOZ_ASSERT(!sCurrentThreadTLS.get(),
"There can only be a single XPCOMThreadWrapper available on "
"a thread");
sCurrentThreadTLS.set(wrapper);
});
aThread->Dispatch(r.forget(), NS_DISPATCH_NORMAL);
return wrapper.forget();
}
} // namespace mozilla
......@@ -51,10 +51,6 @@ class AbstractThread : public nsISerialEventTarget {
AbstractThread(bool aSupportsTailDispatch)
: mSupportsTailDispatch(aSupportsTailDispatch) {}
// Returns an AbstractThread wrapper of a nsIThread.
static already_AddRefed<AbstractThread> CreateXPCOMThreadWrapper(
nsIThread* aThread, bool aRequireTailDispatch, bool aOnThread = false);
NS_DECL_THREADSAFE_ISUPPORTS
// We don't use NS_DECL_NSIEVENTTARGET so that we can remove the default
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment