Bug 1137844 - Part 2: Add a Debugger.Memory.prototype.onGarbageCollection getter/setter pair. r=sfink

This commit is contained in:
Nick Fitzgerald 2015-03-13 13:03:00 +01:00
parent 05bb991f96
commit 41b6a5b520
3 changed files with 18 additions and 0 deletions

View File

@ -199,6 +199,7 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
OnNewGlobalObject,
OnNewPromise,
OnPromiseSettled,
OnGarbageCollection,
HookCount
};
enum {

View File

@ -301,6 +301,20 @@ DebuggerMemory::getAllocationsLogOverflowed(JSContext *cx, unsigned argc, Value
return true;
}
/* static */ bool
DebuggerMemory::getOnGarbageCollection(JSContext *cx, unsigned argc, Value *vp)
{
THIS_DEBUGGER_MEMORY(cx, argc, vp, "(get onGarbageCollection)", args, memory);
return Debugger::getHookImpl(cx, args, *memory->getDebugger(), Debugger::OnGarbageCollection);
}
/* static */ bool
DebuggerMemory::setOnGarbageCollection(JSContext *cx, unsigned argc, Value *vp)
{
THIS_DEBUGGER_MEMORY(cx, argc, vp, "(set onGarbageCollection)", args, memory);
return Debugger::setHookImpl(cx, args, *memory->getDebugger(), Debugger::OnGarbageCollection);
}
/* Debugger.Memory.prototype.takeCensus */
@ -814,6 +828,7 @@ DebuggerMemory::takeCensus(JSContext *cx, unsigned argc, Value *vp)
JS_PSGS("maxAllocationsLogLength", getMaxAllocationsLogLength, setMaxAllocationsLogLength, 0),
JS_PSGS("allocationSamplingProbability", getAllocationSamplingProbability, setAllocationSamplingProbability, 0),
JS_PSG("allocationsLogOverflowed", getAllocationsLogOverflowed, 0),
JS_PSGS("onGarbageCollection", getOnGarbageCollection, setOnGarbageCollection, 0),
JS_PS_END
};

View File

@ -43,6 +43,8 @@ class DebuggerMemory : public NativeObject {
static bool setAllocationSamplingProbability(JSContext *cx, unsigned argc, Value *vp);
static bool getAllocationSamplingProbability(JSContext *cx, unsigned argc, Value *vp);
static bool getAllocationsLogOverflowed(JSContext *cx, unsigned argc, Value *vp);
static bool getOnGarbageCollection(JSContext *cx, unsigned argc, Value *vp);
static bool setOnGarbageCollection(JSContext *cx, unsigned argc, Value *vp);
// Function properties of Debugger.Memory.prototype.
static bool takeCensus(JSContext *cx, unsigned argc, Value *vp);