From 9d6c4939953914c95e310e97774464dc812f2ef2 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 15 Jan 2012 09:13:10 +0100 Subject: [PATCH] Bug 677079 - Part u: Provide TriggerOperationCallbacksForActiveContexts in jsfriendapi.h; r=bhackett --- js/src/jscntxt.h | 2 +- js/src/jsfriendapi.cpp | 9 +++++++++ js/src/jsfriendapi.h | 4 ++++ js/xpconnect/src/XPCJSRuntime.cpp | 10 +--------- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index 6f7d66eb8b73..f4af03583909 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -1969,7 +1969,7 @@ namespace js { /* These must be called with GC lock taken. */ -JS_FRIEND_API(void) +void TriggerOperationCallback(JSContext *cx); void diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index 66bddc31a244..5147596e09a1 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -586,4 +586,13 @@ IsContextRunningJS(JSContext *cx) return !cx->stack.empty(); } +JS_FRIEND_API(void) +TriggerOperationCallbacksForActiveContexts(JSRuntime *rt) +{ + JSContext* cx = NULL; + while ((cx = js_NextActiveContext(rt, cx))) { + TriggerOperationCallback(cx); + } +} + } // namespace js diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index 80a7b4b12a68..e884ee9da4db 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -538,6 +538,10 @@ CallContextDebugHandler(JSContext *cx, JSScript *script, jsbytecode *bc, Value * extern JS_FRIEND_API(bool) IsContextRunningJS(JSContext *cx); +/* Must be called with GC lock taken. */ +extern JS_FRIEND_API(void) +TriggerOperationCallbacksForActiveContexts(JSRuntime *rt); + } /* namespace js */ /* diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index d6b04c690fc6..72361e8f6a49 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -64,11 +64,6 @@ #include "nsExceptionHandler.h" #endif -#include "jscntxt.h" -#if 0 -js_NextActiveContext, js::TriggerOperationCallback -#endif - using namespace mozilla; using namespace mozilla::xpconnect::memory; @@ -957,10 +952,7 @@ XPCJSRuntime::WatchdogMain(void *arg) #endif PR_WaitCondVar(self->mWatchdogWakeup, sleepInterval); JS_ASSERT(status == PR_SUCCESS); - JSContext* cx = nsnull; - while ((cx = js_NextActiveContext(self->mJSRuntime, cx))) { - js::TriggerOperationCallback(cx); - } + js::TriggerOperationCallbacksForActiveContexts(self->mJSRuntime); } /* Wake up the main thread waiting for the watchdog to terminate. */