mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1052042 - Move the pre-pop GC to AutoEntryScript. r=billm
This commit is contained in:
parent
8c4bd13859
commit
63bfd2eb94
@ -348,6 +348,14 @@ AutoEntryScript::AutoEntryScript(nsIGlobalObject* aGlobalObject,
|
||||
MOZ_ASSERT_IF(aCx && aIsMainThread, aCx == FindJSContext(aGlobalObject));
|
||||
}
|
||||
|
||||
AutoEntryScript::~AutoEntryScript()
|
||||
{
|
||||
// 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.
|
||||
JS_MaybeGC(cx());
|
||||
}
|
||||
|
||||
AutoIncumbentScript::AutoIncumbentScript(nsIGlobalObject* aGlobalObject)
|
||||
: ScriptSettingsStackEntry(aGlobalObject, /* aCandidate = */ false)
|
||||
, mCallerOverride(nsContentUtils::GetCurrentJSContextForThread())
|
||||
|
@ -201,6 +201,8 @@ public:
|
||||
// Note: aCx is mandatory off-main-thread.
|
||||
JSContext* aCx = nullptr);
|
||||
|
||||
~AutoEntryScript();
|
||||
|
||||
void SetWebIDLCallerPrincipal(nsIPrincipal *aPrincipal) {
|
||||
mWebIDLCallerPrincipal = aPrincipal;
|
||||
}
|
||||
|
@ -51,15 +51,6 @@ AutoCxPusher::AutoCxPusher(JSContext* cx, bool allowNull)
|
||||
|
||||
AutoCxPusher::~AutoCxPusher()
|
||||
{
|
||||
// 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.
|
||||
//
|
||||
// NB: We need to take care to only do this if we're in a compartment,
|
||||
// otherwise JS_MaybeGC will segfault.
|
||||
if (mScx && !mAutoCompartment.empty())
|
||||
JS_MaybeGC(nsXPConnect::XPConnect()->GetCurrentJSContext());
|
||||
|
||||
// Leave the compartment and request before popping.
|
||||
mAutoCompartment.destroyIfConstructed();
|
||||
mAutoRequest.destroyIfConstructed();
|
||||
|
Loading…
Reference in New Issue
Block a user