зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1283855
part 2 - Make some callback setters take JSContext instead of JSRuntime. r=luke
This commit is contained in:
Родитель
d39ad7fb2d
Коммит
7c1a1cec44
|
@ -888,11 +888,13 @@ public:
|
|||
|
||||
JS_SetRuntimePrivate(rt, new WorkerThreadRuntimePrivate(mWorkerPrivate));
|
||||
|
||||
JSContext* cx = JS_GetContext(rt);
|
||||
|
||||
js::SetPreserveWrapperCallback(rt, PreserveWrapper);
|
||||
JS_InitDestroyPrincipalsCallback(rt, DestroyWorkerPrincipals);
|
||||
JS_SetWrapObjectCallbacks(rt, &WrapObjectCallbacks);
|
||||
JS_SetWrapObjectCallbacks(cx, &WrapObjectCallbacks);
|
||||
if (mWorkerPrivate->IsDedicatedWorker()) {
|
||||
JS_SetFutexCanWait(rt);
|
||||
JS_SetFutexCanWait(cx);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -91,7 +91,7 @@ BEGIN_TEST(testBug604087)
|
|||
CHECK(next);
|
||||
}
|
||||
|
||||
JS_SetWrapObjectCallbacks(JS_GetRuntime(cx), &WrapObjectCallbacks);
|
||||
JS_SetWrapObjectCallbacks(cx, &WrapObjectCallbacks);
|
||||
CHECK(JS_TransplantObject(cx, outerObj, next));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -493,9 +493,9 @@ JS_SetRuntimePrivate(JSRuntime* rt, void* data)
|
|||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetFutexCanWait(JSRuntime* rt)
|
||||
JS_SetFutexCanWait(JSContext* cx)
|
||||
{
|
||||
rt->fx.setCanWait(true);
|
||||
cx->fx.setCanWait(true);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -657,40 +657,40 @@ JS_GetImplementationVersion(void)
|
|||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetDestroyCompartmentCallback(JSRuntime* rt, JSDestroyCompartmentCallback callback)
|
||||
JS_SetDestroyCompartmentCallback(JSContext* cx, JSDestroyCompartmentCallback callback)
|
||||
{
|
||||
rt->destroyCompartmentCallback = callback;
|
||||
cx->destroyCompartmentCallback = callback;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetSizeOfIncludingThisCompartmentCallback(JSRuntime* rt,
|
||||
JS_SetSizeOfIncludingThisCompartmentCallback(JSContext* cx,
|
||||
JSSizeOfIncludingThisCompartmentCallback callback)
|
||||
{
|
||||
rt->sizeOfIncludingThisCompartmentCallback = callback;
|
||||
cx->sizeOfIncludingThisCompartmentCallback = callback;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetDestroyZoneCallback(JSRuntime* rt, JSZoneCallback callback)
|
||||
JS_SetDestroyZoneCallback(JSContext* cx, JSZoneCallback callback)
|
||||
{
|
||||
rt->destroyZoneCallback = callback;
|
||||
cx->destroyZoneCallback = callback;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetSweepZoneCallback(JSRuntime* rt, JSZoneCallback callback)
|
||||
JS_SetSweepZoneCallback(JSContext* cx, JSZoneCallback callback)
|
||||
{
|
||||
rt->sweepZoneCallback = callback;
|
||||
cx->sweepZoneCallback = callback;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetCompartmentNameCallback(JSRuntime* rt, JSCompartmentNameCallback callback)
|
||||
JS_SetCompartmentNameCallback(JSContext* cx, JSCompartmentNameCallback callback)
|
||||
{
|
||||
rt->compartmentNameCallback = callback;
|
||||
cx->compartmentNameCallback = callback;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetWrapObjectCallbacks(JSRuntime* rt, const JSWrapObjectCallbacks* callbacks)
|
||||
JS_SetWrapObjectCallbacks(JSContext* cx, const JSWrapObjectCallbacks* callbacks)
|
||||
{
|
||||
rt->wrapObjectCallbacks = callbacks;
|
||||
cx->wrapObjectCallbacks = callbacks;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSCompartment*)
|
||||
|
|
|
@ -1008,7 +1008,7 @@ extern JS_PUBLIC_API(void)
|
|||
JS_EndRequest(JSContext* cx);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SetFutexCanWait(JSRuntime* rt);
|
||||
JS_SetFutexCanWait(JSContext* cx);
|
||||
|
||||
namespace js {
|
||||
|
||||
|
@ -1251,23 +1251,23 @@ extern JS_PUBLIC_API(const char*)
|
|||
JS_GetImplementationVersion(void);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SetDestroyCompartmentCallback(JSRuntime* rt, JSDestroyCompartmentCallback callback);
|
||||
JS_SetDestroyCompartmentCallback(JSContext* cx, JSDestroyCompartmentCallback callback);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SetSizeOfIncludingThisCompartmentCallback(JSRuntime* rt,
|
||||
JS_SetSizeOfIncludingThisCompartmentCallback(JSContext* cx,
|
||||
JSSizeOfIncludingThisCompartmentCallback callback);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SetDestroyZoneCallback(JSRuntime* rt, JSZoneCallback callback);
|
||||
JS_SetDestroyZoneCallback(JSContext* cx, JSZoneCallback callback);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SetSweepZoneCallback(JSRuntime* rt, JSZoneCallback callback);
|
||||
JS_SetSweepZoneCallback(JSContext* cx, JSZoneCallback callback);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SetCompartmentNameCallback(JSRuntime* rt, JSCompartmentNameCallback callback);
|
||||
JS_SetCompartmentNameCallback(JSContext* cx, JSCompartmentNameCallback callback);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SetWrapObjectCallbacks(JSRuntime* rt, const JSWrapObjectCallbacks* callbacks);
|
||||
JS_SetWrapObjectCallbacks(JSContext* cx, const JSWrapObjectCallbacks* callbacks);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SetCompartmentPrivate(JSCompartment* compartment, void* data);
|
||||
|
|
|
@ -2943,14 +2943,15 @@ WorkerMain(void* arg)
|
|||
return;
|
||||
}
|
||||
|
||||
JSContext* cx = JS_GetContext(rt);
|
||||
|
||||
sr->isWorker = true;
|
||||
JS_SetRuntimePrivate(rt, sr.get());
|
||||
JS_SetFutexCanWait(rt);
|
||||
JS_SetFutexCanWait(cx);
|
||||
JS::SetWarningReporter(rt, WarningReporter);
|
||||
JS_InitDestroyPrincipalsCallback(rt, ShellPrincipals::destroy);
|
||||
SetWorkerRuntimeOptions(rt);
|
||||
|
||||
JSContext* cx = JS_GetContext(rt);
|
||||
if (!JS::InitSelfHostedCode(cx)) {
|
||||
JS_DestroyRuntime(rt);
|
||||
js_delete(input);
|
||||
|
@ -7380,9 +7381,11 @@ main(int argc, char** argv, char** envp)
|
|||
if (!sr)
|
||||
return 1;
|
||||
|
||||
JSContext* cx = JS_GetContext(rt);
|
||||
|
||||
JS_SetRuntimePrivate(rt, sr.get());
|
||||
// Waiting is allowed on the shell's main thread, for now.
|
||||
JS_SetFutexCanWait(rt);
|
||||
JS_SetFutexCanWait(cx);
|
||||
JS::SetWarningReporter(rt, WarningReporter);
|
||||
if (!SetRuntimeOptions(rt, op))
|
||||
return 1;
|
||||
|
@ -7405,7 +7408,6 @@ main(int argc, char** argv, char** envp)
|
|||
|
||||
JS::dbg::SetDebuggerMallocSizeOf(rt, moz_malloc_size_of);
|
||||
|
||||
JSContext* cx = JS_GetContext(rt);
|
||||
if (!JS::InitSelfHostedCode(cx))
|
||||
return 1;
|
||||
|
||||
|
|
|
@ -3454,6 +3454,8 @@ XPCJSRuntime::Initialize()
|
|||
MOZ_ASSERT(Runtime());
|
||||
JSRuntime* runtime = Runtime();
|
||||
|
||||
JSContext* cx = JS_GetContext(runtime);
|
||||
|
||||
mUnprivilegedJunkScope.init(runtime, nullptr);
|
||||
mPrivilegedJunkScope.init(runtime, nullptr);
|
||||
mCompilationScope.init(runtime, nullptr);
|
||||
|
@ -3550,14 +3552,14 @@ XPCJSRuntime::Initialize()
|
|||
kStackQuota - kSystemCodeBuffer,
|
||||
kStackQuota - kSystemCodeBuffer - kTrustedScriptBuffer);
|
||||
|
||||
JS_SetDestroyCompartmentCallback(runtime, CompartmentDestroyedCallback);
|
||||
JS_SetSizeOfIncludingThisCompartmentCallback(runtime, CompartmentSizeOfIncludingThisCallback);
|
||||
JS_SetCompartmentNameCallback(runtime, CompartmentNameCallback);
|
||||
JS_SetDestroyCompartmentCallback(cx, CompartmentDestroyedCallback);
|
||||
JS_SetSizeOfIncludingThisCompartmentCallback(cx, CompartmentSizeOfIncludingThisCallback);
|
||||
JS_SetCompartmentNameCallback(cx, CompartmentNameCallback);
|
||||
mPrevGCSliceCallback = JS::SetGCSliceCallback(runtime, GCSliceCallback);
|
||||
JS_AddFinalizeCallback(runtime, FinalizeCallback, nullptr);
|
||||
JS_AddWeakPointerZoneGroupCallback(runtime, WeakPointerZoneGroupCallback, this);
|
||||
JS_AddWeakPointerCompartmentCallback(runtime, WeakPointerCompartmentCallback, this);
|
||||
JS_SetWrapObjectCallbacks(runtime, &WrapObjectCallbacks);
|
||||
JS_SetWrapObjectCallbacks(cx, &WrapObjectCallbacks);
|
||||
js::SetPreserveWrapperCallback(runtime, PreserveWrapper);
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
if (PseudoStack* stack = mozilla_get_pseudo_stack())
|
||||
|
|
|
@ -536,8 +536,8 @@ CycleCollectedJSRuntime::Initialize(JSRuntime* aParentRuntime,
|
|||
JS::SetOutOfMemoryCallback(mJSRuntime, OutOfMemoryCallback, this);
|
||||
JS::SetLargeAllocationFailureCallback(mJSRuntime,
|
||||
LargeAllocationFailureCallback, this);
|
||||
JS_SetDestroyZoneCallback(mJSRuntime, XPCStringConvert::FreeZoneCache);
|
||||
JS_SetSweepZoneCallback(mJSRuntime, XPCStringConvert::ClearZoneCache);
|
||||
JS_SetDestroyZoneCallback(mJSContext, XPCStringConvert::FreeZoneCache);
|
||||
JS_SetSweepZoneCallback(mJSContext, XPCStringConvert::ClearZoneCache);
|
||||
JS::SetBuildIdOp(mJSRuntime, GetBuildId);
|
||||
JS::SetWarningReporter(mJSRuntime, MozCrashWarningReporter);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче