Bug 1283855 part 14 - Make more callback setters take JSContext instead of JSRuntime. r=shu

This commit is contained in:
Jan de Mooij 2016-07-05 14:35:26 +02:00
Родитель 3e6263744c
Коммит fb15cb143c
6 изменённых файлов: 20 добавлений и 20 удалений

Просмотреть файл

@ -891,7 +891,7 @@ public:
JSContext* cx = JS_GetContext(rt);
js::SetPreserveWrapperCallback(rt, PreserveWrapper);
js::SetPreserveWrapperCallback(cx, PreserveWrapper);
JS_InitDestroyPrincipalsCallback(rt, DestroyWorkerPrincipals);
JS_SetWrapObjectCallbacks(cx, &WrapObjectCallbacks);
if (mWorkerPrivate->IsDedicatedWorker()) {

Просмотреть файл

@ -64,9 +64,9 @@ js::ForgetSourceHook(JSRuntime* rt)
}
JS_FRIEND_API(void)
JS_SetGrayGCRootsTracer(JSRuntime* rt, JSTraceDataOp traceOp, void* data)
JS_SetGrayGCRootsTracer(JSContext* cx, JSTraceDataOp traceOp, void* data)
{
rt->gc.setGrayRootsTracer(traceOp, data);
cx->gc.setGrayRootsTracer(traceOp, data);
}
JS_FRIEND_API(JSObject*)
@ -540,9 +540,9 @@ js::SetReservedOrProxyPrivateSlotWithBarrier(JSObject* obj, size_t slot, const j
}
void
js::SetPreserveWrapperCallback(JSRuntime* rt, PreserveWrapperCallback callback)
js::SetPreserveWrapperCallback(JSContext* cx, PreserveWrapperCallback callback)
{
rt->preserveWrapperCallback = callback;
cx->preserveWrapperCallback = callback;
}
/*
@ -647,9 +647,9 @@ js::StringToLinearStringSlow(JSContext* cx, JSString* str)
}
JS_FRIEND_API(void)
JS_SetAccumulateTelemetryCallback(JSRuntime* rt, JSAccumulateTelemetryDataCallback callback)
JS_SetAccumulateTelemetryCallback(JSContext* cx, JSAccumulateTelemetryDataCallback callback)
{
rt->setTelemetryCallback(rt, callback);
cx->setTelemetryCallback(cx, callback);
}
JS_FRIEND_API(JSObject*)
@ -1134,10 +1134,10 @@ js::DumpHeap(JSRuntime* rt, FILE* fp, js::DumpHeapNurseryBehaviour nurseryBehavi
}
JS_FRIEND_API(void)
js::SetActivityCallback(JSRuntime* rt, ActivityCallback cb, void* arg)
js::SetActivityCallback(JSContext* cx, ActivityCallback cb, void* arg)
{
rt->activityCallback = cb;
rt->activityCallbackArg = arg;
cx->activityCallback = cb;
cx->activityCallbackArg = arg;
}
JS_FRIEND_API(void)

Просмотреть файл

@ -45,7 +45,7 @@ class InterpreterFrame;
} /* namespace js */
extern JS_FRIEND_API(void)
JS_SetGrayGCRootsTracer(JSRuntime* rt, JSTraceDataOp traceOp, void* data);
JS_SetGrayGCRootsTracer(JSContext* cx, JSTraceDataOp traceOp, void* data);
extern JS_FRIEND_API(JSObject*)
JS_FindCompilationScope(JSContext* cx, JS::HandleObject obj);
@ -145,7 +145,7 @@ typedef void
(*JSAccumulateTelemetryDataCallback)(int id, uint32_t sample, const char* key);
extern JS_FRIEND_API(void)
JS_SetAccumulateTelemetryCallback(JSRuntime* rt, JSAccumulateTelemetryDataCallback callback);
JS_SetAccumulateTelemetryCallback(JSContext* cx, JSAccumulateTelemetryDataCallback callback);
extern JS_FRIEND_API(bool)
JS_GetIsSecureContext(JSCompartment* compartment);
@ -978,7 +978,7 @@ JS_FRIEND_API(bool)
StringIsArrayIndex(JSLinearString* str, uint32_t* indexp);
JS_FRIEND_API(void)
SetPreserveWrapperCallback(JSRuntime* rt, PreserveWrapperCallback callback);
SetPreserveWrapperCallback(JSContext* cx, PreserveWrapperCallback callback);
JS_FRIEND_API(bool)
IsObjectInContextCompartment(JSObject* obj, const JSContext* cx);
@ -1118,7 +1118,7 @@ typedef void
* idle and a request begins.
*/
JS_FRIEND_API(void)
SetActivityCallback(JSRuntime* rt, ActivityCallback cb, void* arg);
SetActivityCallback(JSContext* cx, ActivityCallback cb, void* arg);
typedef bool
(* DOMInstanceClassHasProtoAtDepth)(const Class* instanceClass,

Просмотреть файл

@ -7434,7 +7434,7 @@ main(int argc, char** argv, char** envp)
}
#endif
js::SetPreserveWrapperCallback(rt, DummyPreserveWrapperCallback);
js::SetPreserveWrapperCallback(cx, DummyPreserveWrapperCallback);
result = Shell(cx, &op, envp);

Просмотреть файл

@ -1647,7 +1647,7 @@ XPCJSRuntime::~XPCJSRuntime()
// actual JS_DestroyRuntime() call. But destroying the runtime triggers
// one final GC, which can call back into the runtime with various
// callback if we aren't careful. Null out the relevant callbacks.
js::SetActivityCallback(Runtime(), nullptr, nullptr);
js::SetActivityCallback(Context(), nullptr, nullptr);
JS_RemoveFinalizeCallback(Context(), FinalizeCallback);
JS_RemoveWeakPointerZoneGroupCallback(Context(), WeakPointerZoneGroupCallback);
JS_RemoveWeakPointerCompartmentCallback(Context(), WeakPointerCompartmentCallback);
@ -3561,13 +3561,13 @@ XPCJSRuntime::Initialize()
JS_AddWeakPointerZoneGroupCallback(cx, WeakPointerZoneGroupCallback, this);
JS_AddWeakPointerCompartmentCallback(cx, WeakPointerCompartmentCallback, this);
JS_SetWrapObjectCallbacks(cx, &WrapObjectCallbacks);
js::SetPreserveWrapperCallback(runtime, PreserveWrapper);
js::SetPreserveWrapperCallback(cx, PreserveWrapper);
#ifdef MOZ_ENABLE_PROFILER_SPS
if (PseudoStack* stack = mozilla_get_pseudo_stack())
stack->sampleRuntime(runtime);
#endif
JS_SetAccumulateTelemetryCallback(runtime, AccumulateTelemetryCallback);
js::SetActivityCallback(runtime, ActivityCallback, this);
JS_SetAccumulateTelemetryCallback(cx, AccumulateTelemetryCallback);
js::SetActivityCallback(cx, ActivityCallback, this);
JS_SetInterruptCallback(runtime, InterruptCallback);
js::SetWindowProxyClass(runtime, &OuterWindowProxyClass);
#ifdef MOZ_CRASHREPORTER

Просмотреть файл

@ -516,7 +516,7 @@ CycleCollectedJSRuntime::Initialize(JSRuntime* aParentRuntime,
if (!JS_AddExtraGCRootsTracer(mJSContext, TraceBlackJS, this)) {
MOZ_CRASH("JS_AddExtraGCRootsTracer failed");
}
JS_SetGrayGCRootsTracer(mJSRuntime, TraceGrayJS, this);
JS_SetGrayGCRootsTracer(mJSContext, TraceGrayJS, this);
JS_SetGCCallback(mJSContext, GCCallback, this);
mPrevGCSliceCallback = JS::SetGCSliceCallback(mJSRuntime, GCSliceCallback);