Bug 677079 - Part aa: Expose sizeof(JSContext) in jsfriendapi.h; r=njn

This commit is contained in:
Ms2ger 2012-01-15 09:13:11 +01:00
parent 7a241b6e2d
commit 3b70bf2777
3 changed files with 10 additions and 3 deletions

View File

@ -607,4 +607,10 @@ GetContextStackLimit(const JSContext *cx)
return cx->stackLimit; return cx->stackLimit;
} }
JS_FRIEND_API(size_t)
SizeOfJSContext()
{
return sizeof(JSContext);
}
} // namespace js } // namespace js

View File

@ -562,6 +562,9 @@ typedef Vector<JSCompartment*, 0, SystemAllocPolicy> CompartmentVector;
extern JS_FRIEND_API(const CompartmentVector&) extern JS_FRIEND_API(const CompartmentVector&)
GetRuntimeCompartments(JSRuntime *rt); GetRuntimeCompartments(JSRuntime *rt);
extern JS_FRIEND_API(size_t)
SizeOfJSContext();
} /* namespace js */ } /* namespace js */
/* /*

View File

@ -69,8 +69,6 @@
#include "nsWrapperCacheInlines.h" #include "nsWrapperCacheInlines.h"
#include "jscntxt.h" // sizeof(JSContext)
NS_IMPL_THREADSAFE_ISUPPORTS7(nsXPConnect, NS_IMPL_THREADSAFE_ISUPPORTS7(nsXPConnect,
nsIXPConnect, nsIXPConnect,
nsISupportsWeakReference, nsISupportsWeakReference,
@ -1002,7 +1000,7 @@ public:
// edges will ensure that any cycles this context is in won't be // edges will ensure that any cycles this context is in won't be
// collected. // collected.
unsigned refCount = nsXPConnect::GetXPConnect()->GetOutstandingRequests(cx) + 1; unsigned refCount = nsXPConnect::GetXPConnect()->GetOutstandingRequests(cx) + 1;
NS_IMPL_CYCLE_COLLECTION_DESCRIBE(JSContext, refCount) cb.DescribeRefCountedNode(refCount, js::SizeOfJSContext(), "JSContext");
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "[global object]"); NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "[global object]");
if (JSObject *global = JS_GetGlobalObject(cx)) { if (JSObject *global = JS_GetGlobalObject(cx)) {
cb.NoteScriptChild(nsIProgrammingLanguage::JAVASCRIPT, global); cb.NoteScriptChild(nsIProgrammingLanguage::JAVASCRIPT, global);