forked from mirrors/gecko-dev
Bug 1805963 - Part 2: remove support for local execution, r=xpcom-reviewers,jstutte
The only consumer of this feature has been removed, so we don't need it anymore. It acts very differently than other runnables run on the main thread, so removing it will simplify things. Differential Revision: https://phabricator.services.mozilla.com/D164841
This commit is contained in:
parent
2485971930
commit
829856daa2
2 changed files with 1 additions and 96 deletions
|
|
@ -909,7 +909,7 @@ nsThread::HasPendingEvents(bool* aResult) {
|
|||
return NS_ERROR_NOT_SAME_THREAD;
|
||||
}
|
||||
|
||||
if (mIsMainThread && !mIsInLocalExecutionMode) {
|
||||
if (mIsMainThread) {
|
||||
*aResult = TaskController::Get()->HasMainThreadPendingTasks();
|
||||
} else {
|
||||
*aResult = mEvents->HasPendingEvent();
|
||||
|
|
@ -1076,18 +1076,6 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult) {
|
|||
// event loop since its state change hasn't happened yet.
|
||||
bool reallyWait = aMayWait && (mNestedEventLoopDepth > 0 || !ShuttingDown());
|
||||
|
||||
if (mIsInLocalExecutionMode) {
|
||||
if (nsCOMPtr<nsIRunnable> event = mEvents->GetEvent(reallyWait)) {
|
||||
*aResult = true;
|
||||
LogRunnable::Run log(event);
|
||||
event->Run();
|
||||
event = nullptr;
|
||||
} else {
|
||||
*aResult = false;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Maybe<dom::AutoNoJSAPI> noJSAPI;
|
||||
|
||||
if (mUseHangMonitor && reallyWait) {
|
||||
|
|
@ -1427,29 +1415,6 @@ nsIEventTarget* nsThread::EventTarget() { return this; }
|
|||
|
||||
nsISerialEventTarget* nsThread::SerialEventTarget() { return this; }
|
||||
|
||||
nsLocalExecutionRecord nsThread::EnterLocalExecution() {
|
||||
MOZ_RELEASE_ASSERT(!mIsInLocalExecutionMode);
|
||||
MOZ_ASSERT(IsOnCurrentThread());
|
||||
MOZ_ASSERT(EventQueue());
|
||||
return nsLocalExecutionRecord(*EventQueue(), mIsInLocalExecutionMode);
|
||||
}
|
||||
|
||||
nsLocalExecutionGuard::nsLocalExecutionGuard(
|
||||
nsLocalExecutionRecord&& aLocalExecutionRecord)
|
||||
: mEventQueueStack(aLocalExecutionRecord.mEventQueueStack),
|
||||
mLocalEventTarget(mEventQueueStack.PushEventQueue()),
|
||||
mLocalExecutionFlag(aLocalExecutionRecord.mLocalExecutionFlag) {
|
||||
MOZ_ASSERT(mLocalEventTarget);
|
||||
MOZ_ASSERT(!mLocalExecutionFlag);
|
||||
mLocalExecutionFlag = true;
|
||||
}
|
||||
|
||||
nsLocalExecutionGuard::~nsLocalExecutionGuard() {
|
||||
MOZ_ASSERT(mLocalExecutionFlag);
|
||||
mLocalExecutionFlag = false;
|
||||
mEventQueueStack.PopEventQueue(mLocalEventTarget);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsThreadShutdownContext, nsIThreadShutdown)
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ class Array;
|
|||
using mozilla::NotNull;
|
||||
|
||||
class nsIRunnable;
|
||||
class nsLocalExecutionRecord;
|
||||
class nsThreadEnumerator;
|
||||
class nsThreadShutdownContext;
|
||||
|
||||
|
|
@ -249,21 +248,6 @@ class nsThread : public nsIThreadInternal,
|
|||
|
||||
static nsThreadEnumerator Enumerate();
|
||||
|
||||
// When entering local execution mode a new event queue is created and used as
|
||||
// an event source. This queue is only accessible through an
|
||||
// nsLocalExecutionGuard constructed from the nsLocalExecutionRecord returned
|
||||
// by this function, effectively restricting the events that get run while in
|
||||
// local execution mode to those dispatched by the owner of the guard object.
|
||||
//
|
||||
// Local execution is not nestable. When the nsLocalExecutionGuard is
|
||||
// destructed, the thread exits the local execution mode.
|
||||
//
|
||||
// Note that code run in local execution mode is not considered a task in the
|
||||
// spec sense. Events from the local queue are considered part of the
|
||||
// enclosing task and as such do not trigger profiling hooks, observer
|
||||
// notifications, etc.
|
||||
nsLocalExecutionRecord EnterLocalExecution();
|
||||
|
||||
void SetUseHangMonitor(bool aValue) {
|
||||
MOZ_ASSERT(IsOnCurrentThread());
|
||||
mUseHangMonitor = aValue;
|
||||
|
|
@ -350,8 +334,6 @@ class nsThread : public nsIThreadInternal,
|
|||
|
||||
mozilla::PerformanceCounterState mPerformanceCounterState;
|
||||
|
||||
bool mIsInLocalExecutionMode = false;
|
||||
|
||||
mozilla::SimpleTaskQueue mDirectTasks;
|
||||
};
|
||||
|
||||
|
|
@ -393,48 +375,6 @@ class nsThreadShutdownContext final : public nsIThreadShutdown {
|
|||
bool mThreadLeaked MOZ_GUARDED_BY(mJoiningThreadMutex) = false;
|
||||
};
|
||||
|
||||
// This RAII class controls the duration of the associated nsThread's local
|
||||
// execution mode and provides access to the local event target. (See
|
||||
// nsThread::EnterLocalExecution() for details.) It is constructed from an
|
||||
// nsLocalExecutionRecord, which can only be constructed by nsThread.
|
||||
class MOZ_RAII nsLocalExecutionGuard final {
|
||||
public:
|
||||
MOZ_IMPLICIT nsLocalExecutionGuard(
|
||||
nsLocalExecutionRecord&& aLocalExecutionRecord);
|
||||
nsLocalExecutionGuard(const nsLocalExecutionGuard&) = delete;
|
||||
nsLocalExecutionGuard(nsLocalExecutionGuard&&) = delete;
|
||||
~nsLocalExecutionGuard();
|
||||
|
||||
nsCOMPtr<nsISerialEventTarget> GetEventTarget() const {
|
||||
return mLocalEventTarget;
|
||||
}
|
||||
|
||||
private:
|
||||
mozilla::SynchronizedEventQueue& mEventQueueStack;
|
||||
nsCOMPtr<nsISerialEventTarget> mLocalEventTarget;
|
||||
bool& mLocalExecutionFlag;
|
||||
};
|
||||
|
||||
class MOZ_TEMPORARY_CLASS nsLocalExecutionRecord final {
|
||||
private:
|
||||
friend class nsThread;
|
||||
friend class nsLocalExecutionGuard;
|
||||
|
||||
nsLocalExecutionRecord(mozilla::SynchronizedEventQueue& aEventQueueStack,
|
||||
bool& aLocalExecutionFlag)
|
||||
: mEventQueueStack(aEventQueueStack),
|
||||
mLocalExecutionFlag(aLocalExecutionFlag) {}
|
||||
|
||||
nsLocalExecutionRecord(nsLocalExecutionRecord&&) = default;
|
||||
|
||||
public:
|
||||
nsLocalExecutionRecord(const nsLocalExecutionRecord&) = delete;
|
||||
|
||||
private:
|
||||
mozilla::SynchronizedEventQueue& mEventQueueStack;
|
||||
bool& mLocalExecutionFlag;
|
||||
};
|
||||
|
||||
class MOZ_STACK_CLASS nsThreadEnumerator final {
|
||||
public:
|
||||
nsThreadEnumerator() = default;
|
||||
|
|
|
|||
Loading…
Reference in a new issue