当前位置: 首页>>代码示例>>C++>>正文


C++ JS_DestroyRuntime函数代码示例

本文整理汇总了C++中JS_DestroyRuntime函数的典型用法代码示例。如果您正苦于以下问题:C++ JS_DestroyRuntime函数的具体用法?C++ JS_DestroyRuntime怎么用?C++ JS_DestroyRuntime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了JS_DestroyRuntime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sm_stop

void sm_stop(spidermonkey_vm *vm) {
  begin_request(vm);
  spidermonkey_state *state = (spidermonkey_state *) JS_GetContextPrivate(vm->context);
  state->terminate = 1;
  JS_SetContextPrivate(vm->context, state);

  //Wait for any executing function to stop
  //before beginning to free up any memory.
  while (JS_IsRunning(vm->context))  {
      sleep(1);
  }

  end_request(vm);

  //Now we should be free to proceed with
  //freeing up memory without worrying about
  //crashing the VM.
  if (state != NULL) {
    if (state->error != NULL) {
      free_error(state);
    }
    driver_free(state);
  }
  JS_SetContextPrivate(vm->context, NULL);
  JS_DestroyContext(vm->context);
  JS_DestroyRuntime(vm->runtime);
  driver_free(vm);
}
开发者ID:systra,项目名称:erlang_js,代码行数:28,代码来源:spidermonkey.c

示例2: JS_DestroyRuntime

JsParser::~JsParser() {
  /** The world is over */
  //  JS_DestroyContext(js_context);
  JS_DestroyRuntime(js_runtime);
  JS_ShutDown();
  func("JsParser::close()");
}
开发者ID:dyne,项目名称:FreeJ,代码行数:7,代码来源:jsparser.cpp

示例3: lwqq_js_close

void lwqq_js_close(lwqq_js_t* js)
{
    JS_DestroyContext(js->context);
    JS_DestroyRuntime(js->runtime);
    JS_ShutDown();
    s_free(js);
}
开发者ID:fsky,项目名称:webqq,代码行数:7,代码来源:lwjs.c

示例4: gjs_runtime_destroy

/**
 * gjs_runtime_destroy:
 * @runtime: a #JSRuntime
 *
 * Calls JS_DestroyRuntime() on runtime and frees data allocated by
 * gjs_runtime_init(); these are unified into a single call because we
 * need to order things so that the allocated data is cleaned up
 * after JS_DestroyRuntime(). We might have finalizers run by
 * JS_DestroyRuntime() that rely on the information stored in the data,
 * such as the dynamic class structs.
 *
 * This should only be called by GJS, not by applications.
 */
void
gjs_runtime_destroy(JSRuntime *runtime)
{
    RuntimeData *rd;
    void *key;
    void *value;

    rd = JS_GetRuntimePrivate(runtime);
    if (rd->context_stack != NULL || rd->current_frame.depth != 0)
        gjs_fatal("gjs_runtime_destroy() called during gjs_push_context()");

    gjs_debug(GJS_DEBUG_CONTEXT,
              "Destroying JS runtime");

    JS_DestroyRuntime(runtime);

    gjs_debug(GJS_DEBUG_CONTEXT,
              "Destroying any remaining dataset items on runtime");

    while (gjs_g_hash_table_remove_one(rd->dynamic_classes, &key, &value)) {
        JSClass *clasp = value;

        gjs_debug(GJS_DEBUG_GREPO,
                  "Finalizing dynamic class '%s'",
                  clasp->name);

        g_free( (char*) clasp->name); /* we know we malloc'd the char* even though it's const */
        g_slice_free(DynamicJSClass, (DynamicJSClass*) clasp);
    }

    g_hash_table_destroy(rd->dynamic_classes);
    g_slice_free(RuntimeData, rd);
}
开发者ID:BabeNovelty,项目名称:glib-win32,代码行数:46,代码来源:jsapi-util-vs10.c

示例5: main

int main(int argc, const char *argv[]) {
    /* Initialize the JS engine -- new/required as of SpiderMonkey 31. */
    /*if (!JS_Init())
       return 1;*/

    /* Create a JS runtime. */
    JSRuntime *rt = JS_NewRuntime(8L * 1024L * 1024L, JS_NO_HELPER_THREADS);
    if (!rt)
       return 1;

    /* Create a context. */
    JSContext *cx = JS_NewContext(rt, 8192);
    if (!cx)
       return 1;
    JS_SetOptions(cx, JSOPTION_VAROBJFIX);
    JS_SetErrorReporter(cx, reportError);

    int status = run(cx);

    JS_DestroyContext(cx);
    JS_DestroyRuntime(rt);

    /* Shut down the JS engine. */
    JS_ShutDown();

    return status;
}
开发者ID:AdrianArroyoCalle,项目名称:test-embed-language,代码行数:27,代码来源:main.cpp

示例6: _egueb_script_js_sm_scripter_free

static void _egueb_script_js_sm_scripter_free(void *prv)
{
	Egueb_Script_Js_Sm_Scripter *thiz = prv;

	JS_DestroyContext(thiz->cx);
	JS_DestroyRuntime(thiz->rt);
	free(thiz);
}
开发者ID:turran,项目名称:egueb-script,代码行数:8,代码来源:egueb_script_js_sm.c

示例7: ClearReceivers

void
JetpackChild::CleanUp()
{
  ClearReceivers();
  JS_DestroyContext(mCx);
  JS_DestroyRuntime(mRuntime);
  JS_ShutDown();
}
开发者ID:krad-radio,项目名称:mozilla-krad,代码行数:8,代码来源:JetpackChild.cpp

示例8: qq_js_close

void qq_js_close(qq_js_t* js)
{
    JS_DestroyContext(js->context);
    JS_DestroyRuntime(js->runtime);
    JS_ShutDown();
    /*something wrong here*/
    //s_free(js);
}
开发者ID:badcell,项目名称:kopete-lwqq,代码行数:8,代码来源:js.cpp

示例9: Runtime_dealloc

void
Runtime_dealloc(Runtime* self)
{
    if(self->rt != NULL)
    {
        JS_DestroyRuntime(self->rt);
    }
}
开发者ID:smurfix,项目名称:python-spidermonkey,代码行数:8,代码来源:runtime.cpp

示例10: cleanup_smjs

void
cleanup_smjs(struct module *module)
{
	if (!smjs_ctx) return;

	JS_DestroyContext(smjs_ctx);
	JS_DestroyRuntime(smjs_rt);
}
开发者ID:ohmori7,项目名称:kcn-tools,代码行数:8,代码来源:core.c

示例11: SpidermonkeyDestroy

void SpidermonkeyDestroy()
{// begin SpidermonkeyDestroy
#ifdef ADM_JS_THREADSAFE
	JS_SetContextThread(g_pCx);	
#endif
	JS_DestroyContext(g_pCx);
	JS_DestroyRuntime(g_pRt);
}// end SpidermonkeyDestroy
开发者ID:BackupTheBerlios,项目名称:avidemux-svn,代码行数:8,代码来源:ADM_JSGlobal.cpp

示例12: TerminateSpiderMonkey

void TerminateSpiderMonkey(JSContext * context) {

	if (terminated) return;
	JS_DestroyContext(context);
	JS_DestroyRuntime(runtime);
	JS_ShutDown();
	terminated = true;

}
开发者ID:hypersoft,项目名称:smash,代码行数:9,代码来源:smash.cpp

示例13: main

int main(int argc, const char *argv[]) {
    /* JS variables. */
    JSRuntime *rt;
    JSContext *cx;
    JSObject *global;

    /* Create a JS runtime. */
    rt = JS_NewRuntime(8L * 1024L * 1024L,JS_NO_HELPER_THREADS);
    if (rt == NULL)
       return 1;

    /* Create a context. */
    cx = JS_NewContext(rt, 8192);
    if (cx == NULL)
       return 1;
    JS_SetOptions(cx, JSOPTION_VAROBJFIX | JSOPTION_METHODJIT);
    JS_SetVersion(cx, JSVERSION_LATEST);
    JS_SetErrorReporter(cx, reportError);

    /* Create the global object in a new compartment. */
    global = JS_NewGlobalObject(cx, &global_class, NULL);
    if (global == NULL)
       return 1;

    /* Populate the global object with the standard globals, like Object and Array. */
    if (!JS_InitStandardClasses(cx, global))
       return 1;

 
    /* Your application code here. This may include JSAPI calls
     * to create your own custom JavaScript objects and to run scripts.
     *
     * The following example code creates a literal JavaScript script,
     * evaluates it, and prints the result to stdout.
     *
     * Errors are conventionally saved in a JSBool variable named ok.
     */
	
	JS_DefineFunction(cx,global,"print",&js_print,0,0);
	
	// execJsFile(cx,"t.js");
	
	// testObj(cx);
	
	beforeTest(cx);
	execJsFile(cx,"t4.js");
	test(cx);
    
 
    /* End of your application code */
 
    /* Clean things up and shut down SpiderMonkey. */
    JS_DestroyContext(cx);
    JS_DestroyRuntime(rt);
    JS_ShutDown();
    return 0;
}
开发者ID:trarck,项目名称:learnspidermonkey,代码行数:57,代码来源:test_binding_object.cpp

示例14: ctxs_free

static void ctxs_free(ctxStore *self)
{
	if (!self) return;
	if (self->ctx) JS_DestroyContext(self->ctx);
	if (self->run) JS_DestroyRuntime(self->run);
	if (self->cls) px_free(self->cls);
	px_free(self->pac);
	px_free(self);
}
开发者ID:ystk,项目名称:debian-libproxy,代码行数:9,代码来源:pacrunner_mozjs.c

示例15: exitProgram

short exitProgram(JSContext *cx){ //To be called at the very end - Shutdown the whole application
	if(cx)
		JS_DestroyContext(cx);
	JS_DestroyRuntime(runtime);
	TTF_Quit();
	SDL_DestroyRenderer(renderer);
	SDL_Quit();
	JS_ShutDown();
	return 0;
}
开发者ID:joejoyce,项目名称:jsEngine,代码行数:10,代码来源:jsEngine.cpp


注:本文中的JS_DestroyRuntime函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。