[gjs/wip/ptomato/mozjs38: 14/22] runtime: Adapt to new	JSFinalizeCallback
- From: Philip Chimento <pchimento src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gjs/wip/ptomato/mozjs38: 14/22] runtime: Adapt to new	JSFinalizeCallback
 
- Date: Mon, 30 Jan 2017 06:47:34 +0000 (UTC)
 
commit 0ccf2d72879357b875f574cefdfcb8728c0c83ce
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.
 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]