[gjs] runtime: Adapt to new JSFinalizeCallback
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] runtime: Adapt to new JSFinalizeCallback
- Date: Wed, 15 Feb 2017 04:04:43 +0000 (UTC)
commit c735ea817d541493154998201ae2201f02852ca1
Author: Philip Chimento <philip chimento gmail com>
Date: Wed Jan 11 23:43:11 2017 -0800
runtime: Adapt to new JSFinalizeCallback
JSFinalizeCallback now allows a user-data parameter, so we can get rid of
some fiddling with runtime private data.
https://bugzilla.gnome.org/show_bug.cgi?id=777962
gjs/runtime.cpp | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/gjs/runtime.cpp b/gjs/runtime.cpp
index eebeaf4..a431d12 100644
--- a/gjs/runtime.cpp
+++ b/gjs/runtime.cpp
@@ -174,13 +174,10 @@ static JSLocaleCallbacks gjs_locale_callbacks =
static void
gjs_finalize_callback(JSFreeOp *fop,
JSFinalizeStatus status,
- bool isCompartment)
+ bool isCompartment,
+ void *user_data)
{
- JSRuntime *runtime;
- RuntimeData *data;
-
- runtime = fop->runtime();
- data = (RuntimeData*) JS_GetRuntimePrivate(runtime);
+ RuntimeData *data = static_cast<RuntimeData *>(user_data);
/* Implementation note for mozjs 24:
sweeping happens in two phases, in the first phase all
@@ -309,7 +306,7 @@ gjs_runtime_for_current_thread(void)
JS_SetNativeStackQuota(runtime, 1024*1024);
JS_SetGCParameter(runtime, JSGC_MAX_BYTES, 0xffffffff);
JS_SetLocaleCallbacks(runtime, &gjs_locale_callbacks);
- JS_SetFinalizeCallback(runtime, gjs_finalize_callback);
+ JS_AddFinalizeCallback(runtime, gjs_finalize_callback, data);
JS_SetErrorReporter(runtime, gjs_error_reporter);
g_private_set(&thread_runtime, runtime);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]