mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-09 04:25:38 +00:00
Bug 921454 - Add an option for explicitly forcing foreground finalization. r=jonco
This commit is contained in:
parent
3fc5ba84fa
commit
4a8a8167bd
@ -353,7 +353,8 @@ SetProxyExtra(JSObject *obj, size_t n, const Value &extra)
|
||||
class MOZ_STACK_CLASS ProxyOptions {
|
||||
public:
|
||||
ProxyOptions() : callable_(false),
|
||||
singleton_(false)
|
||||
singleton_(false),
|
||||
forceForegroundFinalization_(false)
|
||||
{}
|
||||
|
||||
bool callable() const { return callable_; }
|
||||
@ -368,9 +369,18 @@ class MOZ_STACK_CLASS ProxyOptions {
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool forceForegroundFinalization() const {
|
||||
return forceForegroundFinalization_;
|
||||
}
|
||||
ProxyOptions &setForceForegroundFinalization(bool flag) {
|
||||
forceForegroundFinalization_ = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
bool callable_;
|
||||
bool singleton_;
|
||||
bool forceForegroundFinalization_;
|
||||
};
|
||||
|
||||
JS_FRIEND_API(JSObject *)
|
||||
|
@ -43,7 +43,7 @@ ProxyObject::New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, Tag
|
||||
NewObjectKind newKind =
|
||||
(clasp == &OuterWindowProxyObject::class_ || options.singleton()) ? SingletonObject : GenericObject;
|
||||
gc::AllocKind allocKind = gc::GetGCObjectKind(clasp);
|
||||
if (handler->finalizeInBackground(priv))
|
||||
if (!options.forceForegroundFinalization() && handler->finalizeInBackground(priv))
|
||||
allocKind = GetBackgroundAllocKind(allocKind);
|
||||
RootedObject obj(cx, NewObjectWithGivenProto(cx, clasp, proto, parent, allocKind, newKind));
|
||||
if (!obj)
|
||||
|
Loading…
x
Reference in New Issue
Block a user