mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 860085 - Remove nsIXPConnect::ReleaseJSContext. r=gabor
This commit is contained in:
parent
919587b427
commit
6aa989b495
@ -291,7 +291,7 @@ interface nsIXPCFunctionThisTranslator : nsISupports
|
||||
{ 0xbd, 0xd6, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } }
|
||||
%}
|
||||
|
||||
[uuid(bd61342d-8a88-4f23-8d2d-1782fff02d26)]
|
||||
[uuid(3bc074e6-2102-40a4-8c84-38b002c9e2f1)]
|
||||
interface nsIXPConnect : nsISupports
|
||||
{
|
||||
%{ C++
|
||||
@ -521,8 +521,6 @@ interface nsIXPConnect : nsISupports
|
||||
in JSObjectPtr aScope,
|
||||
in nsIClassInfo aClassInfo);
|
||||
|
||||
void releaseJSContext(in JSContextPtr aJSContext, in boolean noGC);
|
||||
|
||||
jsval variantToJS(in JSContextPtr ctx, in JSObjectPtr scope, in nsIVariant value);
|
||||
nsIVariant JSToVariant(in JSContextPtr ctx, in jsval value);
|
||||
|
||||
|
@ -261,14 +261,6 @@ XPCCallContext::SetMethodIndex(uint16_t index)
|
||||
mMethodIndex = index;
|
||||
}
|
||||
|
||||
inline void
|
||||
XPCCallContext::SetDestroyJSContextInDestructor()
|
||||
{
|
||||
CHECK_STATE(HAVE_CONTEXT);
|
||||
MOZ_ASSERT(mJSContext);
|
||||
mCxDestroyer.construct(mJSContext);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
inline const nsIID*
|
||||
|
@ -937,41 +937,6 @@ nsXPConnect::GetWrappedNativePrototype(JSContext * aJSContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void releaseJSContext (in JSContextPtr aJSContext, in bool noGC); */
|
||||
NS_IMETHODIMP
|
||||
nsXPConnect::ReleaseJSContext(JSContext * aJSContext, bool noGC)
|
||||
{
|
||||
NS_ASSERTION(aJSContext, "bad param");
|
||||
XPCCallContext* ccx = nullptr;
|
||||
for (XPCCallContext* cur = GetRuntime()->GetCallContext();
|
||||
cur;
|
||||
cur = cur->GetPrevCallContext()) {
|
||||
if (cur->GetJSContext() == aJSContext) {
|
||||
ccx = cur;
|
||||
// Keep looping to find the deepest matching call context.
|
||||
}
|
||||
}
|
||||
|
||||
if (ccx) {
|
||||
#ifdef DEBUG_xpc_hacker
|
||||
printf("!xpc - deferring destruction of JSContext @ %p\n",
|
||||
(void *)aJSContext);
|
||||
#endif
|
||||
ccx->SetDestroyJSContextInDestructor();
|
||||
return NS_OK;
|
||||
}
|
||||
// else continue on and synchronously destroy the JSContext ...
|
||||
|
||||
NS_ASSERTION(!XPCJSRuntime::Get()->GetJSContextStack()->HasJSContext(aJSContext),
|
||||
"JSContext still in threadjscontextstack!");
|
||||
|
||||
if (noGC)
|
||||
JS_DestroyContextNoGC(aJSContext);
|
||||
else
|
||||
JS_DestroyContext(aJSContext);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void debugDump (in short depth); */
|
||||
NS_IMETHODIMP
|
||||
nsXPConnect::DebugDump(int16_t depth)
|
||||
|
@ -1024,17 +1024,6 @@ private:
|
||||
//
|
||||
// Note that most accessors are inlined.
|
||||
|
||||
// This is a dumb little thing to ensure that the XPCCallContext destructor
|
||||
// calls JS_DestroyContext after the JSAutoRequest is destroyed (if at all).
|
||||
// This will go away in a few days when bug 860085 removes this machinery.
|
||||
class AutoJSContextDestroyer
|
||||
{
|
||||
JSContext *mCx;
|
||||
public:
|
||||
AutoJSContextDestroyer(JSContext *aCx) : mCx(aCx) {}
|
||||
~AutoJSContextDestroyer() { JS_DestroyContext(mCx); }
|
||||
};
|
||||
|
||||
class MOZ_STACK_CLASS XPCCallContext : public nsAXPCNativeCallContext
|
||||
{
|
||||
public:
|
||||
@ -1098,8 +1087,6 @@ public:
|
||||
inline uint16_t GetMethodIndex() const ;
|
||||
inline void SetMethodIndex(uint16_t index) ;
|
||||
|
||||
inline void SetDestroyJSContextInDestructor();
|
||||
|
||||
inline jsid GetResolveName() const;
|
||||
inline jsid SetResolveName(JS::HandleId name);
|
||||
|
||||
@ -1148,8 +1135,6 @@ inline void CHECK_STATE(int s) const {NS_ASSERTION(mState >= s, "bad state");}
|
||||
#endif
|
||||
|
||||
private:
|
||||
mozilla::Maybe<AutoJSContextDestroyer> mCxDestroyer;
|
||||
|
||||
mozilla::AutoPushJSContext mPusher;
|
||||
State mState;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user