本文整理汇总了C++中JSD_LOCK函数的典型用法代码示例。如果您正苦于以下问题:C++ JSD_LOCK函数的具体用法?C++ JSD_LOCK怎么用?C++ JSD_LOCK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了JSD_LOCK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jsd_ClearInterruptHook
JSBool
jsd_ClearInterruptHook(JSDContext* jsdc)
{
JSD_LOCK();
JS_ClearInterrupt(jsdc->jsrt, NULL, NULL );
jsdc->interruptHook = NULL;
JSD_UNLOCK();
return JS_TRUE;
}
示例2: jsd_GetScriptHook
JSBool
jsd_GetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc* hook, void** callerdata)
{
JSD_LOCK();
if( hook )
*hook = jsdc->scriptHook;
if( callerdata )
*callerdata = jsdc->scriptHookData;
JSD_UNLOCK();
return JS_TRUE;
}
示例3: jsd_SetErrorReporter
JSBool
jsd_SetErrorReporter(JSDContext* jsdc,
JSD_ErrorReporter reporter,
void* callerdata)
{
JSD_LOCK();
jsdc->errorReporter = reporter;
jsdc->errorReporterData = callerdata;
JSD_UNLOCK();
return JS_TRUE;
}
示例4: jsd_EnableSingleStepInterrupts
JSBool
jsd_EnableSingleStepInterrupts(JSDContext* jsdc, JSDScript* jsdscript, JSBool enable)
{
JSCompartment* oldCompartment;
JSBool rv;
oldCompartment = JS_EnterCompartmentOfScript(jsdc->dumbContext, jsdscript->script);
JSD_LOCK();
rv = JS_SetSingleStepMode(jsdc->dumbContext, jsdscript->script, enable);
JSD_UNLOCK();
JS_LeaveCompartment(jsdc->dumbContext, oldCompartment);
return rv;
}
示例5: jsd_SetDebuggerHook
bool
jsd_SetDebuggerHook(JSDContext* jsdc,
JSD_ExecutionHookProc hook,
void* callerdata)
{
JSD_LOCK();
jsdc->debuggerHookData = callerdata;
jsdc->debuggerHook = hook;
JSD_UNLOCK();
return true;
}
示例6: jsd_SetThrowHook
JSBool
jsd_SetThrowHook(JSDContext* jsdc,
JSD_ExecutionHookProc hook,
void* callerdata)
{
JSD_LOCK();
jsdc->throwHookData = callerdata;
jsdc->throwHook = hook;
JSD_UNLOCK();
return JS_TRUE;
}
示例7: jsd_SetFunctionHook
JSBool
jsd_SetFunctionHook(JSDContext* jsdc,
JSD_CallHookProc hook,
void* callerdata)
{
JSD_LOCK();
jsdc->functionHookData = callerdata;
jsdc->functionHook = hook;
JSD_UNLOCK();
return JS_TRUE;
}
示例8: jsd_ClearAllExecutionHooks
JSBool
jsd_ClearAllExecutionHooks(JSDContext* jsdc)
{
JSDScript* jsdscript;
JSDScript* iterp = NULL;
JSD_LOCK();
while( NULL != (jsdscript = jsd_IterateScripts(jsdc, &iterp)) )
jsd_ClearAllExecutionHooksForScript(jsdc, jsdscript);
JSD_UNLOCK();
return JS_TRUE;
}
示例9: jsd_SetTopLevelHook
JSBool
jsd_SetTopLevelHook(JSDContext* jsdc,
JSD_CallHookProc hook,
void* callerdata)
{
JSD_LOCK();
jsdc->toplevelHookData = callerdata;
jsdc->toplevelHook = hook;
JSD_UNLOCK();
return JS_TRUE;
}
示例10: jsd_GetErrorReporter
JSBool
jsd_GetErrorReporter(JSDContext* jsdc,
JSD_ErrorReporter* reporter,
void** callerdata)
{
JSD_LOCK();
if( reporter )
*reporter = jsdc->errorReporter;
if( callerdata )
*callerdata = jsdc->errorReporterData;
JSD_UNLOCK();
return JS_TRUE;
}
示例11: jsd_SetInterruptHook
JSBool
jsd_SetInterruptHook(JSDContext* jsdc,
JSD_ExecutionHookProc hook,
void* callerdata)
{
JSD_LOCK();
jsdc->interruptHookData = callerdata;
jsdc->interruptHook = hook;
JS_SetInterrupt(jsdc->jsrt, jsd_InterruptHandler, (void*) jsdc);
JSD_UNLOCK();
return JS_TRUE;
}
示例12: jsd_SetExecutionHook
JSBool
jsd_SetExecutionHook(JSDContext* jsdc,
JSDScript* jsdscript,
jsuword pc,
JSD_ExecutionHookProc hook,
void* callerdata)
{
JSDExecHook* jsdhook;
JSD_LOCK();
if( ! hook )
{
jsd_ClearExecutionHook(jsdc, jsdscript, pc);
JSD_UNLOCK();
return JS_TRUE;
}
jsdhook = _findHook(jsdc, jsdscript, pc);
if( jsdhook )
{
jsdhook->hook = hook;
jsdhook->callerdata = callerdata;
JSD_UNLOCK();
return JS_TRUE;
}
/* else... */
jsdhook = (JSDExecHook*)calloc(1, sizeof(JSDExecHook));
if( ! jsdhook ) {
JSD_UNLOCK();
return JS_FALSE;
}
jsdhook->jsdscript = jsdscript;
jsdhook->pc = pc;
jsdhook->hook = hook;
jsdhook->callerdata = callerdata;
if( ! JS_SetTrap(jsdc->dumbContext, jsdscript->script,
(jsbytecode*)pc, jsd_TrapHandler,
(void*) PRIVATE_TO_JSVAL(jsdhook)) )
{
free(jsdhook);
JSD_UNLOCK();
return JS_FALSE;
}
JS_APPEND_LINK(&jsdhook->links, &jsdscript->hooks);
JSD_UNLOCK();
return JS_TRUE;
}
示例13: jsd_EnableSingleStepInterrupts
JSBool
jsd_EnableSingleStepInterrupts(JSDContext* jsdc, JSDScript* jsdscript, JSBool enable)
{
JSCrossCompartmentCall *call;
JSBool rv;
call = JS_EnterCrossCompartmentCallScript(jsdc->dumbContext, jsdscript->script);
if(!call)
return JS_FALSE;
JSD_LOCK();
rv = JS_SetSingleStepMode(jsdc->dumbContext, jsdscript->script, enable);
JSD_UNLOCK();
JS_LeaveCrossCompartmentCall(call);
return rv;
}
示例14: jsd_DestroyScriptHookProc
void
jsd_DestroyScriptHookProc(
JSFreeOp *fop,
JSScript *script_,
void* callerdata )
{
JSDScript* jsdscript = NULL;
JSDContext* jsdc = (JSDContext*) callerdata;
JS::RootedScript script(jsdc->dumbContext, script_);
JSD_ScriptHookProc hook;
void* hookData;
JSD_ASSERT_VALID_CONTEXT(jsdc);
if( JSD_IS_DANGEROUS_THREAD(jsdc) )
return;
JSD_LOCK_SCRIPTS(jsdc);
jsdscript = jsd_FindJSDScript(jsdc, script);
JSD_UNLOCK_SCRIPTS(jsdc);
if( ! jsdscript )
return;
#ifdef JSD_DUMP
JSD_LOCK_SCRIPTS(jsdc);
_dumpJSDScript(jsdc, jsdscript, "***DESTROY Script: ");
JSD_UNLOCK_SCRIPTS(jsdc);
#endif /* JSD_DUMP */
/* local in case hook gets cleared on another thread */
JSD_LOCK();
hook = (jsdscript->flags & JSD_SCRIPT_CALL_DESTROY_HOOK_BIT) ? jsdc->scriptHook : NULL;
hookData = jsdc->scriptHookData;
JSD_UNLOCK();
if( hook )
hook(jsdc, jsdscript, JS_FALSE, hookData);
JSD_LOCK_SCRIPTS(jsdc);
JS_HashTableRemove(jsdc->scriptsTable, (void *)script);
JSD_UNLOCK_SCRIPTS(jsdc);
#ifdef JSD_DUMP
JSD_LOCK_SCRIPTS(jsdc);
_dumpJSDScriptList(jsdc);
JSD_UNLOCK_SCRIPTS(jsdc);
#endif /* JSD_DUMP */
}
示例15: jsd_TrapHandler
JSTrapStatus
jsd_TrapHandler(JSContext *cx, JSScript *script_, jsbytecode *pc, jsval *rval,
jsval closure)
{
JS::RootedScript script(cx, script_);
JSDExecHook* jsdhook = (JSDExecHook*) JSVAL_TO_PRIVATE(closure);
JSD_ExecutionHookProc hook;
void* hookData;
JSDContext* jsdc;
JSDScript* jsdscript;
JSD_LOCK();
if( NULL == (jsdc = jsd_JSDContextForJSContext(cx)) ||
! _isActiveHook(jsdc, script, jsdhook) )
{
JSD_UNLOCK();
return JSTRAP_CONTINUE;
}
JSD_ASSERT_VALID_EXEC_HOOK(jsdhook);
JS_ASSERT(!jsdhook->pc || jsdhook->pc == (uintptr_t)pc);
JS_ASSERT(jsdhook->jsdscript->script == script);
JS_ASSERT(jsdhook->jsdscript->jsdc == jsdc);
hook = jsdhook->hook;
hookData = jsdhook->callerdata;
jsdscript = jsdhook->jsdscript;
/* do not use jsdhook-> after this point */
JSD_UNLOCK();
if( ! jsdc || ! jsdc->inited )
return JSTRAP_CONTINUE;
if( JSD_IS_DANGEROUS_THREAD(jsdc) )
return JSTRAP_CONTINUE;
#ifdef LIVEWIRE
if( ! jsdlw_UserCodeAtPC(jsdc, jsdscript, (uintptr_t)pc) )
return JSTRAP_CONTINUE;
#endif
return jsd_CallExecutionHook(jsdc, cx, JSD_HOOK_BREAKPOINT,
hook, hookData, rval);
}