Bug 755255 - Hoist mCallContext into XPCJSRuntime. r=mrbkap

This commit is contained in:
Bobby Holley 2012-06-21 16:14:49 +02:00
parent d2e4d37f1e
commit 1b1b37d7aa
3 changed files with 13 additions and 7 deletions

View File

@ -1036,6 +1036,9 @@ XPCJSRuntime::~XPCJSRuntime()
if (mJSCycleCollectionContext)
JS_DestroyContextNoGC(mJSCycleCollectionContext);
if (mCallContext)
mCallContext->SystemIsBeingShutDown();
#ifdef XPC_DUMP_AT_SHUTDOWN
{
// count the total JSContexts in use
@ -1944,6 +1947,7 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
mJSRuntime(nsnull),
mJSContextStack(new XPCJSContextStack()),
mJSCycleCollectionContext(nsnull),
mCallContext(nsnull),
mWrappedJSMap(JSObject2WrappedJSMap::newMap(XPC_JS_MAP_SIZE)),
mWrappedJSClassMap(IID2WrappedJSClassMap::newMap(XPC_JS_CLASS_MAP_SIZE)),
mIID2NativeInterfaceMap(IID2NativeInterfaceMap::newMap(XPC_NATIVE_INTERFACE_MAP_SIZE)),

View File

@ -242,7 +242,6 @@ void * XPCPerThreadData::sMainJSThread = nsnull;
XPCPerThreadData::XPCPerThreadData() :
mNextThread(nsnull),
mCallContext(nsnull),
mResolveName(JSID_VOID),
mResolvingWrapper(nsnull),
mExceptionManager(nsnull),
@ -267,9 +266,6 @@ XPCPerThreadData::Cleanup()
MOZ_ASSERT(!mAutoRoots);
NS_IF_RELEASE(mExceptionManager);
NS_IF_RELEASE(mException);
if (mCallContext)
mCallContext->SystemIsBeingShutDown();
}
XPCPerThreadData::~XPCPerThreadData()

View File

@ -662,6 +662,10 @@ public:
JSContext* GetJSCycleCollectionContext();
XPCCallContext* GetCallContext() const {return mCallContext;}
XPCCallContext* SetCallContext(XPCCallContext* ccx)
{XPCCallContext* old = mCallContext; mCallContext = ccx; return old;}
JSObject2WrappedJSMap* GetWrappedJSMap() const
{return mWrappedJSMap;}
@ -826,6 +830,7 @@ private:
JSRuntime* mJSRuntime;
XPCJSContextStack* mJSContextStack;
JSContext* mJSCycleCollectionContext;
XPCCallContext* mCallContext;
JSObject2WrappedJSMap* mWrappedJSMap;
IID2WrappedJSClassMap* mWrappedJSClassMap;
IID2NativeInterfaceMap* mIID2NativeInterfaceMap;
@ -3729,9 +3734,11 @@ public:
return false;
}
XPCCallContext* GetCallContext() const {return mCallContext;}
// These go away soon.
XPCCallContext* GetCallContext() const
{return XPCJSRuntime::Get()->GetCallContext();}
XPCCallContext* SetCallContext(XPCCallContext* ccx)
{XPCCallContext* old = mCallContext; mCallContext = ccx; return old;}
{return XPCJSRuntime::Get()->SetCallContext(ccx);}
jsid GetResolveName() const {return mResolveName;}
jsid SetResolveName(jsid name)
@ -3778,7 +3785,6 @@ private:
private:
XPCPerThreadData* mNextThread;
XPCCallContext* mCallContext;
jsid mResolveName;
XPCWrappedNative* mResolvingWrapper;