mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 332648 - Part h: Move AutoEnumStateArray to jsapi.h; r=evilpie
This commit is contained in:
parent
27ed38a4d4
commit
42d0f74e76
@ -87,6 +87,7 @@
|
||||
#include "frontend/BytecodeCompiler.h"
|
||||
#include "frontend/BytecodeEmitter.h"
|
||||
#include "js/MemoryMetrics.h"
|
||||
#include "mozilla/Util.h" // DebugOnly
|
||||
|
||||
#include "jsatominlines.h"
|
||||
#include "jsinferinlines.h"
|
||||
@ -6873,4 +6874,13 @@ AutoGCRooter::~AutoGCRooter()
|
||||
context->autoGCRooters = down;
|
||||
}
|
||||
|
||||
AutoEnumStateRooter::~AutoEnumStateRooter()
|
||||
{
|
||||
if (!stateValue.isNull()) {
|
||||
DebugOnly<JSBool> ok =
|
||||
obj->enumerate(context, JSENUMERATE_DESTROY, &stateValue, 0);
|
||||
JS_ASSERT(ok);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace JS
|
||||
|
@ -1003,6 +1003,35 @@ class AutoArrayRooter : private AutoGCRooter {
|
||||
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
/* The auto-root for enumeration object and its state. */
|
||||
class AutoEnumStateRooter : private AutoGCRooter
|
||||
{
|
||||
public:
|
||||
AutoEnumStateRooter(JSContext *cx, JSObject *obj
|
||||
JS_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: AutoGCRooter(cx, ENUMERATOR), obj(obj), stateValue()
|
||||
{
|
||||
JS_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
JS_ASSERT(obj);
|
||||
}
|
||||
|
||||
~AutoEnumStateRooter();
|
||||
|
||||
friend void AutoGCRooter::trace(JSTracer *trc);
|
||||
|
||||
const Value &state() const { return stateValue; }
|
||||
Value *addr() { return &stateValue; }
|
||||
|
||||
protected:
|
||||
void trace(JSTracer *trc);
|
||||
|
||||
JSObject * const obj;
|
||||
|
||||
private:
|
||||
Value stateValue;
|
||||
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
} /* namespace JS */
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -1700,19 +1700,6 @@ JSContext::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const
|
||||
busyArrays.sizeOfExcludingThis(mallocSizeOf);
|
||||
}
|
||||
|
||||
namespace js {
|
||||
|
||||
AutoEnumStateRooter::~AutoEnumStateRooter()
|
||||
{
|
||||
if (!stateValue.isNull()) {
|
||||
DebugOnly<JSBool> ok =
|
||||
obj->enumerate(context, JSENUMERATE_DESTROY, &stateValue, 0);
|
||||
JS_ASSERT(ok);
|
||||
}
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
namespace JS {
|
||||
|
||||
#if defined JS_THREADSAFE && defined DEBUG
|
||||
|
@ -1597,36 +1597,6 @@ typedef RootedVar<JSAtom*> RootedVarAtom;
|
||||
typedef RootedVar<jsid> RootedVarId;
|
||||
typedef RootedVar<Value> RootedVarValue;
|
||||
|
||||
/* FIXME(bug 332648): Move this into a public header. */
|
||||
/* The auto-root for enumeration object and its state. */
|
||||
class AutoEnumStateRooter : private AutoGCRooter
|
||||
{
|
||||
public:
|
||||
AutoEnumStateRooter(JSContext *cx, JSObject *obj
|
||||
JS_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: AutoGCRooter(cx, ENUMERATOR), obj(obj), stateValue()
|
||||
{
|
||||
JS_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
JS_ASSERT(obj);
|
||||
}
|
||||
|
||||
~AutoEnumStateRooter();
|
||||
|
||||
friend void AutoGCRooter::trace(JSTracer *trc);
|
||||
|
||||
const Value &state() const { return stateValue; }
|
||||
Value *addr() { return &stateValue; }
|
||||
|
||||
protected:
|
||||
void trace(JSTracer *trc);
|
||||
|
||||
JSObject * const obj;
|
||||
|
||||
private:
|
||||
Value stateValue;
|
||||
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
#ifdef JS_HAS_XML_SUPPORT
|
||||
class AutoXMLRooter : private AutoGCRooter {
|
||||
public:
|
||||
|
@ -1942,7 +1942,7 @@ AutoIdArray::trace(JSTracer *trc)
|
||||
void
|
||||
AutoEnumStateRooter::trace(JSTracer *trc)
|
||||
{
|
||||
gc::MarkRoot(trc, obj, "js::AutoEnumStateRooter.obj");
|
||||
gc::MarkRoot(trc, obj, "JS::AutoEnumStateRooter.obj");
|
||||
}
|
||||
|
||||
inline void
|
||||
|
Loading…
Reference in New Issue
Block a user