bug 873622 - remove some useless xpconnect getters r=bholley

This commit is contained in:
Trevor Saunders 2013-05-17 13:28:08 -04:00
parent 6a25cfb54f
commit 5b48393469
6 changed files with 18 additions and 25 deletions

View File

@ -585,7 +585,7 @@ xpc_ForcePropertyResolve(JSContext* cx, JSObject* obj, jsid id)
inline jsid
GetRTIdByIndex(JSContext *cx, unsigned index)
{
XPCJSRuntime *rt = nsXPConnect::FastGetXPConnect()->GetRuntime();
XPCJSRuntime *rt = nsXPConnect::XPConnect()->GetRuntime();
return rt->GetStringID(index);
}

View File

@ -382,7 +382,7 @@ void XPCJSRuntime::TraceBlackJS(JSTracer* trc, void* data)
// Skip this part if XPConnect is shutting down. We get into
// bad locking problems with the thread iteration otherwise.
if (!self->GetXPConnect()->IsShuttingDown()) {
if (!nsXPConnect::XPConnect()->IsShuttingDown()) {
// Trace those AutoMarkingPtr lists!
if (AutoMarkingPtr *roots = Get()->mAutoRoots)
roots->TraceJSAll(trc);
@ -399,7 +399,7 @@ void XPCJSRuntime::TraceBlackJS(JSTracer* trc, void* data)
}
dom::TraceBlackJS(trc, JS_GetGCParameter(self->GetJSRuntime(), JSGC_NUMBER),
self->GetXPConnect()->IsShuttingDown());
nsXPConnect::XPConnect()->IsShuttingDown());
}
// static
@ -935,7 +935,7 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp *fop, JSFinalizeStatus status, JSBool is
// Skip this part if XPConnect is shutting down. We get into
// bad locking problems with the thread iteration otherwise.
if (!self->GetXPConnect()->IsShuttingDown()) {
if (!nsXPConnect::XPConnect()->IsShuttingDown()) {
// Mark those AutoMarkingPtr lists!
if (AutoMarkingPtr *roots = Get()->mAutoRoots)
@ -977,7 +977,7 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp *fop, JSFinalizeStatus status, JSBool is
// We don't want to sweep the JSClasses at shutdown time.
// At this point there may be JSObjects using them that have
// been removed from the other maps.
if (!self->GetXPConnect()->IsShuttingDown()) {
if (!nsXPConnect::XPConnect()->IsShuttingDown()) {
self->mNativeScriptableSharedMap->
Enumerate(JSClassSweeper, sweepArg);
}
@ -1023,7 +1023,7 @@ XPCJSRuntime::FinalizeCallback(JSFreeOp *fop, JSFinalizeStatus status, JSBool is
// Skip this part if XPConnect is shutting down. We get into
// bad locking problems with the thread iteration otherwise.
if (!self->GetXPConnect()->IsShuttingDown()) {
if (!nsXPConnect::XPConnect()->IsShuttingDown()) {
// Do the marking...
XPCCallContext* ccxp = XPCJSRuntime::Get()->GetCallContext();
@ -2654,8 +2654,7 @@ SourceHook(JSContext *cx, JS::Handle<JSScript*> script, jschar **src,
}
XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
: mXPConnect(aXPConnect),
mJSRuntime(nullptr),
: mJSRuntime(nullptr),
mJSContextStack(new XPCJSContextStack()),
mCallContext(nullptr),
mAutoRoots(nullptr),
@ -2914,7 +2913,6 @@ XPCJSRuntime::DebugDump(int16_t depth)
depth--;
XPC_LOG_ALWAYS(("XPCJSRuntime @ %x", this));
XPC_LOG_INDENT();
XPC_LOG_ALWAYS(("mXPConnect @ %x", mXPConnect));
XPC_LOG_ALWAYS(("mJSRuntime @ %x", mJSRuntime));
XPC_LOG_ALWAYS(("mMapLock @ %x", mMapLock));

View File

@ -2991,9 +2991,7 @@ XPCWrappedNative::GetObjectPrincipal() const
NS_IMETHODIMP XPCWrappedNative::GetXPConnect(nsIXPConnect * *aXPConnect)
{
if (IsValid()) {
nsIXPConnect* temp = GetRuntime()->GetXPConnect();
NS_IF_ADDREF(temp);
*aXPConnect = temp;
NS_IF_ADDREF(*aXPConnect = nsXPConnect::XPConnect());
} else
*aXPConnect = nullptr;
return NS_OK;

View File

@ -488,7 +488,6 @@ public:
return gSelf;
}
static nsXPConnect* FastGetXPConnect() { return gSelf ? gSelf : XPConnect(); }
static XPCJSRuntime* GetRuntimeInstance();
XPCJSRuntime* GetRuntime() {return mRuntime;}
@ -658,7 +657,6 @@ public:
static XPCJSRuntime* Get() { return nsXPConnect::XPConnect()->GetRuntime(); }
JSRuntime* GetJSRuntime() const {return mJSRuntime;}
nsXPConnect* GetXPConnect() const {return mXPConnect;}
XPCJSContextStack* GetJSContextStack() {return mJSContextStack;}
void DestroyJSContextStack();
@ -913,7 +911,6 @@ private:
jsid mStrIDs[IDX_TOTAL_COUNT];
jsval mStrJSVals[IDX_TOTAL_COUNT];
nsXPConnect* mXPConnect;
JSRuntime* mJSRuntime;
XPCJSContextStack* mJSContextStack;
XPCCallContext* mCallContext;
@ -1061,7 +1058,7 @@ public:
return mSecurityManager;
} else {
nsIXPCSecurityManager* mgr;
nsXPConnect* xpc = mRuntime->GetXPConnect();
nsXPConnect* xpc = nsXPConnect::XPConnect();
mgr = xpc->GetDefaultSecurityManager();
if (mgr && (flags & xpc->GetDefaultSecurityManagerFlags()))
return mgr;

View File

@ -294,9 +294,9 @@ WrapperFactory::PrepareForWrapping(JSContext *cx, HandleObject scope,
// so we don't have to.
RootedValue v(cx);
nsresult rv =
nsXPConnect::FastGetXPConnect()->WrapNativeToJSVal(cx, wrapScope, wn->Native(), nullptr,
&NS_GET_IID(nsISupports), false,
v.address(), getter_AddRefs(holder));
nsXPConnect::XPConnect()->WrapNativeToJSVal(cx, wrapScope, wn->Native(), nullptr,
&NS_GET_IID(nsISupports), false,
v.address(), getter_AddRefs(holder));
if (NS_SUCCEEDED(rv)) {
obj = JSVAL_TO_OBJECT(v);
NS_ASSERTION(IS_WN_WRAPPER(obj), "bad object");

View File

@ -872,9 +872,9 @@ WrapURI(JSContext *cx, nsIURI *uri, MutableHandleValue vp)
{
RootedObject scope(cx, JS_GetGlobalForScopeChain(cx));
nsresult rv =
nsXPConnect::FastGetXPConnect()->WrapNativeToJSVal(cx, scope, uri, nullptr,
&NS_GET_IID(nsIURI), true,
vp.address(), nullptr);
nsXPConnect::XPConnect()->WrapNativeToJSVal(cx, scope, uri, nullptr,
&NS_GET_IID(nsIURI), true,
vp.address(), nullptr);
if (NS_FAILED(rv)) {
XPCThrower::Throw(rv, cx);
return false;
@ -911,9 +911,9 @@ nodePrincipal_getter(JSContext *cx, HandleObject wrapper, HandleId id, MutableHa
RootedObject scope(cx, JS_GetGlobalForScopeChain(cx));
nsresult rv =
nsXPConnect::FastGetXPConnect()->WrapNativeToJSVal(cx, scope, node->NodePrincipal(), nullptr,
&NS_GET_IID(nsIPrincipal), true,
vp.address(), nullptr);
nsXPConnect::XPConnect()->WrapNativeToJSVal(cx, scope, node->NodePrincipal(), nullptr,
&NS_GET_IID(nsIPrincipal), true,
vp.address(), nullptr);
if (NS_FAILED(rv)) {
XPCThrower::Throw(rv, cx);
return false;