[gjs/wip/js24: 5/12] Misc js24 API changes



commit 801e42517bbd9f180c2a6615c7d18d0af8e93ea6
Author: Tim Lunn <tim feathertop org>
Date:   Sat Sep 28 11:13:21 2013 +1000

    Misc js24 API changes
    
    JS_EncodeStringToBuffer takes add context as first argument,
    JS_NewRuntime adds a JS_NO_HELPER_THREADS flag
    Update to new JS_Call*Tracer API
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711046

 gi/closure.cpp            |    2 +-
 gi/keep-alive.cpp         |    3 ++-
 gjs/context.cpp           |    2 +-
 gjs/jsapi-util-string.cpp |    2 +-
 gjs/jsapi-util.cpp        |    2 +-
 5 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gi/closure.cpp b/gi/closure.cpp
index b03882b..68b3ff5 100644
--- a/gi/closure.cpp
+++ b/gi/closure.cpp
@@ -338,7 +338,7 @@ gjs_closure_trace(GClosure *closure,
     if (c->obj == NULL)
         return;
 
-    JS_CALL_OBJECT_TRACER(tracer, c->obj, "signal connection");
+    JS_CallObjectTracer(tracer, &c->obj, "signal connection");
 }
 
 GClosure*
diff --git a/gi/keep-alive.cpp b/gi/keep-alive.cpp
index bf89d04..8eee636 100644
--- a/gi/keep-alive.cpp
+++ b/gi/keep-alive.cpp
@@ -124,7 +124,8 @@ trace_foreach(void *key,
         jsval val;
         JS_SET_TRACING_DETAILS(tracer, NULL, "keep-alive", 0);
         val = OBJECT_TO_JSVAL(child->child);
-        JS_CallTracer(tracer, JSVAL_TO_TRACEABLE (val), JSTRACE_OBJECT);
+        g_assert (JSVAL_TO_TRACEABLE (val));
+        JS_CallValueTracer(tracer, &val, "keep-alive::val");
     }
 }
 
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 46e59c8..0136370 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -566,7 +566,7 @@ gjs_context_constructor (GType                  type,
 
     js_context = GJS_CONTEXT(object);
 
-    js_context->runtime = JS_NewRuntime(32*1024*1024 /* max bytes */);
+    js_context->runtime = JS_NewRuntime(32*1024*1024 /* max bytes */, JS_NO_HELPER_THREADS);
     JS_SetNativeStackQuota(js_context->runtime, 1024*1024);
     if (js_context->runtime == NULL)
         g_error("Failed to create javascript runtime");
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index d4b96d0..af58564 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -56,7 +56,7 @@ gjs_string_to_utf8 (JSContext  *context,
 
     if (utf8_string_p) {
         bytes = (char*) g_malloc((len + 1) * sizeof(char));
-        JS_EncodeStringToBuffer(str, bytes, len);
+        JS_EncodeStringToBuffer(context, str, bytes, len);
         bytes[len] = '\0';
         *utf8_string_p = bytes;
     }
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 67de0f3..98cf0a8 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -338,7 +338,7 @@ gjs_value_debug_string(JSContext      *context,
     size_t len = JS_GetStringEncodingLength(context, str);
     if (len != (size_t)(-1)) {
         bytes = (char*) g_malloc((len + 1) * sizeof(char));
-        JS_EncodeStringToBuffer(str, bytes, len);
+        JS_EncodeStringToBuffer(context, str, bytes, len);
         bytes[len] = '\0';
     } else {
         bytes = g_strdup("[invalid string]");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]