Temporary restore old shark start/stop functions (bug 625993, r=bz).

This commit is contained in:
Andreas Gal 2011-01-14 19:02:11 -08:00
parent 949f18ab0c
commit c71d128474
3 changed files with 22 additions and 8 deletions

View File

@ -3362,10 +3362,8 @@ nsJSContext::InitClasses(void *aGlobalObj)
rv = NS_ERROR_FAILURE;
}
#ifdef MOZ_PROFILING
// Attempt to initialize profiling functions
::JS_DefineProfilingFunctions(mContext, globalObj);
#endif
#ifdef NS_TRACE_MALLOC
// Attempt to initialize TraceMalloc functions

View File

@ -2105,10 +2105,8 @@ nsDOMWorker::CompileGlobalObject(JSContext* aCx, nsLazyAutoRequest *aRequest,
success = JS_DefineFunctions(aCx, global, gDOMWorkerFunctions);
NS_ENSURE_TRUE(success, PR_FALSE);
#ifdef MOZ_PROFILING
success = JS_DefineProfilingFunctions(aCx, global);
NS_ENSURE_TRUE(success, PR_FALSE);
#endif
if (IsPrivileged()) {
// Add chrome functions.

View File

@ -1924,20 +1924,38 @@ JS_StopProfiling()
static JSBool
StartProfiling(JSContext *cx, uintN argc, jsval *vp)
{
*vp = BOOLEAN_TO_JSVAL(Probes::startProfiling());
JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(Probes::startProfiling()));
return true;
}
static JSBool
StopProfiling(JSContext *cx, uintN argc, jsval *vp)
{
*vp = JSVAL_VOID;
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
#ifdef MOZ_SHARK
static JSBool
IgnoreAndReturnTrue(JSContext *cx, uintN argc, jsval *vp)
{
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
return true;
}
#endif
static JSFunctionSpec profiling_functions[] = {
JS_FN("startProfiling", StartProfiling, 0,0),
JS_FN("stopProfiling", StopProfiling, 0,0),
JS_FN("startProfiling", StartProfiling, 0,0),
JS_FN("stopProfiling", StopProfiling, 0,0),
#ifdef MOZ_SHARK
/* Keep users of the old shark API happy. */
JS_FN("connectShark", IgnoreAndReturnTrue, 0,0),
JS_FN("disconnectShark", IgnoreAndReturnTrue, 0,0),
JS_FN("startShark", StartProfiling, 0,0),
JS_FN("stopShark", StopProfiling, 0,0),
#endif
JS_FS_END
};