Skip to content

Commit

Permalink
Bug 1302448 part 2 - Rename XPCJSRuntime to XPCJSContext. r=mrbkap
Browse files Browse the repository at this point in the history
  • Loading branch information
jandem committed Sep 14, 2016
1 parent 7f38a9c commit 09d5c94
Show file tree
Hide file tree
Showing 34 changed files with 355 additions and 355 deletions.
4 changes: 2 additions & 2 deletions dom/base/nsDOMClassInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1717,15 +1717,15 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
JS::MutableHandle<JS::PropertyDescriptor> desc)
{
if (id == XPCJSRuntime::Get()->GetStringID(XPCJSRuntime::IDX_COMPONENTS)) {
if (id == XPCJSContext::Get()->GetStringID(XPCJSContext::IDX_COMPONENTS)) {
return LookupComponentsShim(cx, obj, aWin->AsInner(), desc);
}

#ifdef USE_CONTROLLERS_SHIM
// Note: We use |obj| rather than |aWin| to get the principal here, because
// this is called during Window setup when the Document isn't necessarily
// hooked up yet.
if (id == XPCJSRuntime::Get()->GetStringID(XPCJSRuntime::IDX_CONTROLLERS) &&
if (id == XPCJSContext::Get()->GetStringID(XPCJSContext::IDX_CONTROLLERS) &&
!xpc::IsXrayWrapper(obj) &&
!nsContentUtils::IsSystemPrincipal(nsContentUtils::ObjectPrincipal(obj)))
{
Expand Down
4 changes: 2 additions & 2 deletions dom/base/nsGlobalWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4475,11 +4475,11 @@ nsGlobalWindow::MayResolve(jsid aId)
return false;
}

if (aId == XPCJSRuntime::Get()->GetStringID(XPCJSRuntime::IDX_COMPONENTS)) {
if (aId == XPCJSContext::Get()->GetStringID(XPCJSContext::IDX_COMPONENTS)) {
return true;
}

if (aId == XPCJSRuntime::Get()->GetStringID(XPCJSRuntime::IDX_CONTROLLERS)) {
if (aId == XPCJSContext::Get()->GetStringID(XPCJSContext::IDX_CONTROLLERS)) {
// We only resolve .controllers in release builds and on non-chrome windows,
// but let's not worry about any of that stuff.
return true;
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsInProcessTabChildGlobal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ nsInProcessTabChildGlobal::PreHandleEvent(EventChainPreVisitor& aVisitor)
nsresult
nsInProcessTabChildGlobal::InitTabChildGlobal()
{
// If you change this, please change GetCompartmentName() in XPCJSRuntime.cpp
// If you change this, please change GetCompartmentName() in XPCJSContext.cpp
// accordingly.
nsAutoCString id;
id.AssignLiteral("inProcessTabChildGlobal");
Expand Down
2 changes: 1 addition & 1 deletion js/src/shell/js.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static const size_t gStackChunkSize = 8192;

/*
* Note: This limit should match the stack limit set by the browser in
* js/xpconnect/src/XPCJSRuntime.cpp
* js/xpconnect/src/XPCJSContext.cpp
*/
#if defined(MOZ_ASAN) || (defined(DEBUG) && !defined(XP_WIN))
static const size_t gMaxStackSize = 2 * 128 * sizeof(size_t) * 1024;
Expand Down
2 changes: 1 addition & 1 deletion js/xpconnect/idl/xpccomponents.idl
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ interface nsIXPCComponents_Utils : nsISupports
* watchdog-related event occured.
*
* Valid categories:
* "RuntimeStateChange" - Runtime switching between active and inactive states
* "ContextStateChange" - Context switching between active and inactive states
* "WatchdogWakeup" - Watchdog waking up from sleeping
* "WatchdogHibernateStart" - Watchdog begins hibernating
* "WatchdogHibernateStop" - Watchdog stops hibernating
Expand Down
2 changes: 1 addition & 1 deletion js/xpconnect/loader/mozJSSubScriptLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ NotifyPrecompilationCompleteRunnable::Run(void)
AutoSendObserverNotification notifier(mPrecompiler);

if (mToken) {
JSContext* cx = XPCJSRuntime::Get()->Context();
JSContext* cx = XPCJSContext::Get()->Context();
NS_ENSURE_TRUE(cx, NS_ERROR_FAILURE);
JS::CancelOffThreadScript(cx, mToken);
}
Expand Down
2 changes: 1 addition & 1 deletion js/xpconnect/src/ExportHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ NewFunctionForwarder(JSContext* cx, HandleId idArg, HandleObject callable,
{
RootedId id(cx, idArg);
if (id == JSID_VOIDHANDLE)
id = GetRTIdByIndex(cx, XPCJSRuntime::IDX_EMPTYSTRING);
id = GetJSIDByIndex(cx, XPCJSContext::IDX_EMPTYSTRING);

// We have no way of knowing whether the underlying function wants to be a
// constructor or not, so we just mark all forwarders as constructors, and
Expand Down
2 changes: 1 addition & 1 deletion js/xpconnect/src/Sandbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ sandbox_addProperty(JSContext* cx, HandleObject obj, HandleId id, HandleValue v)
// Whenever JS_EnumerateStandardClasses is called, it defines the
// "undefined" property, even if it's already defined. We don't want to do
// anything in that case.
if (id == XPCJSRuntime::Get()->GetStringID(XPCJSRuntime::IDX_UNDEFINED))
if (id == XPCJSContext::Get()->GetStringID(XPCJSContext::IDX_UNDEFINED))
return true;

// Avoid recursively triggering sandbox_addProperty in the
Expand Down
16 changes: 8 additions & 8 deletions js/xpconnect/src/XPCCallContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ XPCCallContext::XPCCallContext(JSContext* cx,
: mAr(cx),
mState(INIT_FAILED),
mXPC(nsXPConnect::XPConnect()),
mXPCJSRuntime(nullptr),
mXPCJSContext(nullptr),
mJSContext(cx),
mWrapper(nullptr),
mTearOff(nullptr),
Expand All @@ -39,12 +39,12 @@ XPCCallContext::XPCCallContext(JSContext* cx,
if (!mXPC)
return;

mXPCJSRuntime = XPCJSRuntime::Get();
mXPCJSContext = XPCJSContext::Get();

// hook into call context chain.
mPrevCallContext = mXPCJSRuntime->SetCallContext(this);
mPrevCallContext = mXPCJSContext->SetCallContext(this);

mState = HAVE_RUNTIME;
mState = HAVE_CONTEXT;

if (!obj)
return;
Expand Down Expand Up @@ -125,7 +125,7 @@ void
XPCCallContext::SetCallInfo(XPCNativeInterface* iface, XPCNativeMember* member,
bool isSetter)
{
CHECK_STATE(HAVE_RUNTIME);
CHECK_STATE(HAVE_CONTEXT);

// We are going straight to the method info and need not do a lookup
// by id.
Expand Down Expand Up @@ -197,7 +197,7 @@ XPCCallContext::SystemIsBeingShutDown()
// can be making this call on one thread for call contexts on another
// thread.
NS_WARNING("Shutting Down XPConnect even through there is a live XPCCallContext");
mXPCJSRuntime = nullptr;
mXPCJSContext = nullptr;
mState = SYSTEM_SHUTDOWN;
mInterface = nullptr;

Expand All @@ -207,8 +207,8 @@ XPCCallContext::SystemIsBeingShutDown()

XPCCallContext::~XPCCallContext()
{
if (mXPCJSRuntime) {
DebugOnly<XPCCallContext*> old = mXPCJSRuntime->SetCallContext(mPrevCallContext);
if (mXPCJSContext) {
DebugOnly<XPCCallContext*> old = mXPCJSContext->SetCallContext(mPrevCallContext);
MOZ_ASSERT(old == this, "bad pop from per thread data");
}
}
Expand Down
12 changes: 6 additions & 6 deletions js/xpconnect/src/XPCComponents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2569,7 +2569,7 @@ nsXPCComponents_Utils::GetWeakReference(HandleValue object, JSContext* cx,
NS_IMETHODIMP
nsXPCComponents_Utils::ForceGC()
{
JSContext* cx = nsXPConnect::GetRuntimeInstance()->Context();
JSContext* cx = nsXPConnect::GetContextInstance()->Context();
PrepareForFullGC(cx);
GCForReason(cx, GC_NORMAL, gcreason::COMPONENT_UTILS);
return NS_OK;
Expand Down Expand Up @@ -3187,8 +3187,8 @@ NS_IMETHODIMP
nsXPCComponents_Utils::GetWatchdogTimestamp(const nsAString& aCategory, PRTime* aOut)
{
WatchdogTimestampCategory category;
if (aCategory.EqualsLiteral("RuntimeStateChange"))
category = TimestampRuntimeStateChange;
if (aCategory.EqualsLiteral("ContextStateChange"))
category = TimestampContextStateChange;
else if (aCategory.EqualsLiteral("WatchdogWakeup"))
category = TimestampWatchdogWakeup;
else if (aCategory.EqualsLiteral("WatchdogHibernateStart"))
Expand All @@ -3197,7 +3197,7 @@ nsXPCComponents_Utils::GetWatchdogTimestamp(const nsAString& aCategory, PRTime*
category = TimestampWatchdogHibernateStop;
else
return NS_ERROR_INVALID_ARG;
*aOut = XPCJSRuntime::Get()->GetWatchdogTimestamp(category);
*aOut = XPCJSContext::Get()->GetWatchdogTimestamp(category);
return NS_OK;
}

Expand Down Expand Up @@ -3458,7 +3458,7 @@ nsXPCComponents::GetManager(nsIComponentManager * *aManager)
NS_IMETHODIMP
nsXPCComponents::GetReturnCode(JSContext* aCx, MutableHandleValue aOut)
{
nsresult res = XPCJSRuntime::Get()->GetPendingResult();
nsresult res = XPCJSContext::Get()->GetPendingResult();
aOut.setNumber(static_cast<uint32_t>(res));
return NS_OK;
}
Expand All @@ -3469,7 +3469,7 @@ nsXPCComponents::SetReturnCode(JSContext* aCx, HandleValue aCode)
nsresult rv;
if (!ToUint32(aCx, aCode, (uint32_t*)&rv))
return NS_ERROR_FAILURE;
XPCJSRuntime::Get()->SetPendingResult(rv);
XPCJSContext::Get()->SetPendingResult(rv);
return NS_OK;
}

Expand Down
2 changes: 1 addition & 1 deletion js/xpconnect/src/XPCForwards.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// forward declarations of interally used classes...

class nsXPConnect;
class XPCJSRuntime;
class XPCJSContext;
class XPCContext;
class XPCCallContext;

Expand Down
36 changes: 18 additions & 18 deletions js/xpconnect/src/XPCInlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
/***************************************************************************/

inline void
XPCJSRuntime::AddVariantRoot(XPCTraceableVariant* variant)
XPCJSContext::AddVariantRoot(XPCTraceableVariant* variant)
{
variant->AddToRootSet(&mVariantRoots);
}

inline void
XPCJSRuntime::AddWrappedJSRoot(nsXPCWrappedJS* wrappedJS)
XPCJSContext::AddWrappedJSRoot(nsXPCWrappedJS* wrappedJS)
{
wrappedJS->AddToRootSet(&mWrappedJSRoots);
}

inline void
XPCJSRuntime::AddObjectHolderRoot(XPCJSObjectHolder* holder)
XPCJSContext::AddObjectHolderRoot(XPCJSObjectHolder* holder)
{
holder->AddToRootSet(&mObjectHolderRoots);
}
Expand All @@ -39,24 +39,24 @@ XPCCallContext::IsValid() const
return mState != INIT_FAILED;
}

inline XPCJSRuntime*
XPCCallContext::GetRuntime() const
inline XPCJSContext*
XPCCallContext::GetContext() const
{
CHECK_STATE(HAVE_RUNTIME);
return mXPCJSRuntime;
CHECK_STATE(HAVE_CONTEXT);
return mXPCJSContext;
}

inline JSContext*
XPCCallContext::GetJSContext() const
{
CHECK_STATE(HAVE_RUNTIME);
CHECK_STATE(HAVE_CONTEXT);
return mJSContext;
}

inline XPCCallContext*
XPCCallContext::GetPrevCallContext() const
{
CHECK_STATE(HAVE_RUNTIME);
CHECK_STATE(HAVE_CONTEXT);
return mPrevCallContext;
}

Expand Down Expand Up @@ -185,29 +185,29 @@ XPCCallContext::SetRetVal(JS::Value val)
inline jsid
XPCCallContext::GetResolveName() const
{
CHECK_STATE(HAVE_RUNTIME);
return XPCJSRuntime::Get()->GetResolveName();
CHECK_STATE(HAVE_CONTEXT);
return XPCJSContext::Get()->GetResolveName();
}

inline jsid
XPCCallContext::SetResolveName(JS::HandleId name)
{
CHECK_STATE(HAVE_RUNTIME);
return XPCJSRuntime::Get()->SetResolveName(name);
CHECK_STATE(HAVE_CONTEXT);
return XPCJSContext::Get()->SetResolveName(name);
}

inline XPCWrappedNative*
XPCCallContext::GetResolvingWrapper() const
{
CHECK_STATE(HAVE_OBJECT);
return XPCJSRuntime::Get()->GetResolvingWrapper();
return XPCJSContext::Get()->GetResolvingWrapper();
}

inline XPCWrappedNative*
XPCCallContext::SetResolvingWrapper(XPCWrappedNative* w)
{
CHECK_STATE(HAVE_OBJECT);
return XPCJSRuntime::Get()->SetResolvingWrapper(w);
return XPCJSContext::Get()->SetResolvingWrapper(w);
}

inline uint16_t
Expand Down Expand Up @@ -536,10 +536,10 @@ xpc_ForcePropertyResolve(JSContext* cx, JS::HandleObject obj, jsid idArg)
}

inline jsid
GetRTIdByIndex(JSContext* cx, unsigned index)
GetJSIDByIndex(JSContext* cx, unsigned index)
{
XPCJSRuntime* rt = nsXPConnect::XPConnect()->GetRuntime();
return rt->GetStringID(index);
XPCJSContext* xpcx = nsXPConnect::XPConnect()->GetContext();
return xpcx->GetStringID(index);
}

inline
Expand Down
Loading

0 comments on commit 09d5c94

Please sign in to comment.