[gjs/wip/ptomato/mozjs38: 9/17] runtime: Adapt to new JSFinalizeCallback



commit 3e178ae33dbacae18deeba43d15218b5efe7e239
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 5ae5397..5ddf4b0 100644
--- a/gjs/runtime.cpp
+++ b/gjs/runtime.cpp
@@ -169,13 +169,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
@@ -269,7 +266,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]