Bug 677079 - Part u: Provide TriggerOperationCallbacksForActiveContexts in jsfriendapi.h; r=bhackett

This commit is contained in:
Ms2ger 2012-01-15 09:13:10 +01:00
parent 070a861598
commit 9d6c493995
4 changed files with 15 additions and 10 deletions

View File

@ -1969,7 +1969,7 @@ namespace js {
/* These must be called with GC lock taken. */
JS_FRIEND_API(void)
void
TriggerOperationCallback(JSContext *cx);
void

View File

@ -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

View File

@ -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 */
/*

View File

@ -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. */