Bug 677079 - Part q: Expose gcLock in jsfriendapi.h; r=gal
authorMs2ger <ms2ger@gmail.com>
Sun, 15 Jan 2012 09:13:10 +0100
changeset 85694 35247789f332e6e120a3b6cb10d8f362f813287d
parent 85693 e798120914f78063f54f358649fd300bfdbc4eee
child 85695 fee37d705c87843ca3125afded1589ec331a4eb8
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgal
bugs677079
milestone12.0a1
Bug 677079 - Part q: Expose gcLock in jsfriendapi.h; r=gal
js/src/jsfriendapi.cpp
js/src/jsfriendapi.h
js/xpconnect/src/XPCJSRuntime.cpp
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -528,16 +528,22 @@ GetContextThread(const JSContext *cx)
     return cx->thread();
 }
 
 JS_FRIEND_API(unsigned)
 GetContextOutstandingRequests(const JSContext *cx)
 {
     return cx->outstandingRequests;
 }
+
+JS_FRIEND_API(PRLock *)
+GetRuntimeGCLock(const JSRuntime *rt)
+{
+    return rt->gcLock;
+}
 #endif
 
 JS_FRIEND_API(JSCompartment *)
 GetContextCompartment(const JSContext *cx)
 {
     return cx->compartment;
 }
 
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -148,16 +148,18 @@ extern JS_FRIEND_API(JSBool)
 JS_EnumerateState(JSContext *cx, JSObject *obj, JSIterateOp enum_op, js::Value *statep, jsid *idp);
 
 #endif
 
 JS_END_EXTERN_C
 
 #ifdef __cplusplus
 
+struct PRLock;
+
 namespace js {
 
 typedef bool
 (* PreserveWrapperCallback)(JSContext *cx, JSObject *obj);
 
 #ifdef DEBUG
  /*
   * DEBUG-only method to dump the complete object graph of heap-allocated things.
@@ -451,16 +453,19 @@ JS_FRIEND_API(JSString *)
 GetPCCountScriptContents(JSContext *cx, size_t script);
 
 #ifdef JS_THREADSAFE
 JS_FRIEND_API(JSThread *)
 GetContextThread(const JSContext *cx);
 
 JS_FRIEND_API(unsigned)
 GetContextOutstandingRequests(const JSContext *cx);
+
+JS_FRIEND_API(PRLock *)
+GetRuntimeGCLock(const JSRuntime *rt);
 #endif
 
 JS_FRIEND_API(JSCompartment *)
 GetContextCompartment(const JSContext *cx);
 
 JS_FRIEND_API(bool)
 HasUnrootedGlobal(const JSContext *cx);
 
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -62,17 +62,16 @@
 
 #ifdef MOZ_CRASHREPORTER
 #include "nsExceptionHandler.h"
 #endif
 
 #include "jscntxt.h"
 #if 0
 js_NextActiveContext, js::TriggerOperationCallback
-        mWatchdogWakeup = JS_NEW_CONDVAR(mJSRuntime->gcLock);
 #endif
 
 using namespace mozilla;
 using namespace mozilla::xpconnect::memory;
 
 /***************************************************************************/
 
 const char* XPCJSRuntime::mStrings[] = {
@@ -1975,17 +1974,17 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* 
                                   xpc::WrapperFactory::Rewrap,
                                   xpc::WrapperFactory::PrepareForWrapping);
         js::SetPreserveWrapperCallback(mJSRuntime, PreserveWrapper);
 
 #ifdef MOZ_CRASHREPORTER
         JS_EnumerateDiagnosticMemoryRegions(DiagnosticMemoryCallback);
 #endif
         JS_SetAccumulateTelemetryCallback(mJSRuntime, AccumulateTelemetryCallback);
-        mWatchdogWakeup = JS_NEW_CONDVAR(mJSRuntime->gcLock);
+        mWatchdogWakeup = JS_NEW_CONDVAR(js::GetRuntimeGCLock(mJSRuntime));
         if (!mWatchdogWakeup)
             NS_RUNTIMEABORT("JS_NEW_CONDVAR failed.");
 
         js::SetActivityCallback(mJSRuntime, ActivityCallback, this);
 
         NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(XPConnectJSGCHeap));
         NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(XPConnectJSSystemCompartmentCount));
         NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(XPConnectJSUserCompartmentCount));