Bug 1283855 part 17 - Make {Get,Set}DebuggerMallocSizeOf take JSContext instead of JSRuntime. r=jimb

This commit is contained in:
Jan de Mooij 2016-07-06 11:40:20 +02:00
parent c1ed92b71b
commit 79865aba2a
5 changed files with 14 additions and 15 deletions

View File

@ -63,9 +63,9 @@ GetCurrentThreadDebuggerMallocSizeOf()
{
auto ccrt = CycleCollectedJSRuntime::Get();
MOZ_ASSERT(ccrt);
auto rt = ccrt->Runtime();
MOZ_ASSERT(rt);
auto mallocSizeOf = JS::dbg::GetDebuggerMallocSizeOf(rt);
auto cx = ccrt->Context();
MOZ_ASSERT(cx);
auto mallocSizeOf = JS::dbg::GetDebuggerMallocSizeOf(cx);
MOZ_ASSERT(mallocSizeOf);
return mallocSizeOf;
}
@ -1246,8 +1246,7 @@ public:
return false;
}
JSRuntime* rt = JS_GetRuntime(cx);
mozilla::MallocSizeOf mallocSizeOf = dbg::GetDebuggerMallocSizeOf(rt);
mozilla::MallocSizeOf mallocSizeOf = dbg::GetDebuggerMallocSizeOf(cx);
MOZ_ASSERT(mallocSizeOf);
protobufNode.set_size(ubiNode.size(mallocSizeOf));

View File

@ -257,15 +257,15 @@ class BuilderOrigin : public Builder {
// and returns the number of bytes allocated to that block. SpiderMonkey itself
// doesn't know which function is appropriate to use, but the embedding does.
// Tell Debuggers in |runtime| to use |mallocSizeOf| to find the size of
// Tell Debuggers in |cx| to use |mallocSizeOf| to find the size of
// malloc'd blocks.
JS_PUBLIC_API(void)
SetDebuggerMallocSizeOf(JSRuntime* runtime, mozilla::MallocSizeOf mallocSizeOf);
SetDebuggerMallocSizeOf(JSContext* cx, mozilla::MallocSizeOf mallocSizeOf);
// Get the MallocSizeOf function that the given runtime is using to find the
// Get the MallocSizeOf function that the given context is using to find the
// size of malloc'd blocks.
JS_PUBLIC_API(mozilla::MallocSizeOf)
GetDebuggerMallocSizeOf(JSRuntime* runtime);
GetDebuggerMallocSizeOf(JSContext* cx);

View File

@ -7405,7 +7405,7 @@ main(int argc, char** argv, char** envp)
JS_SetNativeStackQuota(cx, gMaxStackSize);
JS::dbg::SetDebuggerMallocSizeOf(rt, moz_malloc_size_of);
JS::dbg::SetDebuggerMallocSizeOf(cx, moz_malloc_size_of);
if (!JS::InitSelfHostedCode(cx))
return 1;

View File

@ -355,15 +355,15 @@ DebuggerMemory::setOnGarbageCollection(JSContext* cx, unsigned argc, Value* vp)
/* Debugger.Memory.prototype.takeCensus */
JS_PUBLIC_API(void)
JS::dbg::SetDebuggerMallocSizeOf(JSRuntime* rt, mozilla::MallocSizeOf mallocSizeOf)
JS::dbg::SetDebuggerMallocSizeOf(JSContext* cx, mozilla::MallocSizeOf mallocSizeOf)
{
rt->debuggerMallocSizeOf = mallocSizeOf;
cx->debuggerMallocSizeOf = mallocSizeOf;
}
JS_PUBLIC_API(mozilla::MallocSizeOf)
JS::dbg::GetDebuggerMallocSizeOf(JSRuntime* rt)
JS::dbg::GetDebuggerMallocSizeOf(JSContext* cx)
{
return rt->debuggerMallocSizeOf;
return cx->debuggerMallocSizeOf;
}
using JS::ubi::Census;

View File

@ -556,7 +556,7 @@ CycleCollectedJSRuntime::Initialize(JSRuntime* aParentRuntime,
mConsumedRejections.init(mJSRuntime, JS::GCVector<JSObject*, 0, js::SystemAllocPolicy>(js::SystemAllocPolicy()));
#endif // SPIDERMONKEY_PROMISE
JS::dbg::SetDebuggerMallocSizeOf(mJSRuntime, moz_malloc_size_of);
JS::dbg::SetDebuggerMallocSizeOf(mJSContext, moz_malloc_size_of);
nsCycleCollector_registerJSRuntime(this);