mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1081038 - part1: Microtask in AutoEntryScript. r=bholley
This commit is contained in:
parent
3c4d8f8870
commit
69f651a9d6
@ -517,10 +517,14 @@ AutoEntryScript::AutoEntryScript(nsIGlobalObject* aGlobalObject,
|
||||
, ScriptSettingsStackEntry(aGlobalObject, /* aCandidate = */ true)
|
||||
, mWebIDLCallerPrincipal(nullptr)
|
||||
, mDocShellForJSRunToCompletion(nullptr)
|
||||
, mIsMainThread(aIsMainThread)
|
||||
{
|
||||
MOZ_ASSERT(aGlobalObject);
|
||||
MOZ_ASSERT_IF(!aCx, aIsMainThread); // cx is mandatory off-main-thread.
|
||||
MOZ_ASSERT_IF(aCx && aIsMainThread, aCx == FindJSContext(aGlobalObject));
|
||||
if (aIsMainThread) {
|
||||
nsContentUtils::EnterMicroTask();
|
||||
}
|
||||
|
||||
if (aIsMainThread && gRunToCompletionListeners > 0) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobalObject);
|
||||
@ -540,6 +544,10 @@ AutoEntryScript::~AutoEntryScript()
|
||||
mDocShellForJSRunToCompletion->NotifyJSRunToCompletionStop();
|
||||
}
|
||||
|
||||
if (mIsMainThread) {
|
||||
nsContentUtils::LeaveMicroTask();
|
||||
}
|
||||
|
||||
// GC when we pop a script entry point. This is a useful heuristic that helps
|
||||
// us out on certain (flawed) benchmarks like sunspider, because it lets us
|
||||
// avoid GCing during the timing loop.
|
||||
|
@ -344,6 +344,8 @@ private:
|
||||
friend nsIPrincipal* GetWebIDLCallerPrincipal();
|
||||
|
||||
nsIDocShell* mDocShellForJSRunToCompletion;
|
||||
|
||||
bool mIsMainThread;
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user