[gjs: 5/25] js: Rename JS::AutoFooVector



commit 88e5762da6d7da584f1d06af1a32e9f8f0c638ed
Author: Philip Chimento <philip chimento gmail com>
Date:   Sat May 18 23:00:49 2019 -0700

    js: Rename JS::AutoFooVector
    
    Previously named JS::AutoIdVector, JS::AutoObjectVector, and
    JS::AutoValueVector, in SpiderMonkey 68 these have now become types
    that can be given as a template parameter to JS::Rooted<T>,
    JS::Handle<T>, and JS::MutableHandle<T>, and they have their own typedefs
    as well.

 gi/arg.cpp         | 10 +++++-----
 gi/function.cpp    |  4 ++--
 gi/object.cpp      |  2 +-
 gi/object.h        |  7 +++----
 gi/value.cpp       |  2 +-
 gi/wrapperutils.h  |  7 +++----
 gjs/context.cpp    |  2 +-
 gjs/importer.cpp   |  4 ++--
 gjs/jsapi-util.cpp |  2 +-
 gjs/module.cpp     |  2 +-
 10 files changed, 20 insertions(+), 22 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 3c4e194e..794ddef7 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -572,7 +572,7 @@ gjs_array_from_strv(JSContext             *context,
                     const char           **strv)
 {
     guint i;
-    JS::AutoValueVector elems(context);
+    JS::RootedValueVector elems(context);
 
     /* We treat a NULL strv as an empty array, since this function should always
      * set an array value when returning true.
@@ -1018,7 +1018,7 @@ gjs_array_from_flat_gvalue_array(JSContext             *context,
     }
 
     unsigned int i;
-    JS::AutoValueVector elems(context);
+    JS::RootedValueVector elems(context);
     if (!elems.resize(length)) {
         JS_ReportOutOfMemory(context);
         return false;
@@ -2232,7 +2232,7 @@ gjs_array_from_g_list (JSContext             *context,
 {
     unsigned int i;
     GArgument arg;
-    JS::AutoValueVector elems(context);
+    JS::RootedValueVector elems(context);
 
     i = 0;
     if (list_tag == GI_TYPE_TAG_GLIST) {
@@ -2312,7 +2312,7 @@ gjs_array_from_carray_internal (JSContext             *context,
         return true;
     }
 
-    JS::AutoValueVector elems(context);
+    JS::RootedValueVector elems(context);
     if (!elems.resize(length)) {
         JS_ReportOutOfMemory(context);
         return false;
@@ -2532,7 +2532,7 @@ gjs_array_from_zero_terminated_c_array (JSContext             *context,
     if (element_type == GI_TYPE_TAG_UNICHAR)
         return gjs_string_from_ucs4(context, (gunichar *) c_array, -1, value_p);
 
-    JS::AutoValueVector elems(context);
+    JS::RootedValueVector elems(context);
 
 #define ITERATE(type) \
     do { \
diff --git a/gi/function.cpp b/gi/function.cpp
index 74655ad8..722b243a 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -254,7 +254,7 @@ static void gjs_callback_closure(ffi_cif* cif G_GNUC_UNUSED, void* result,
     }
 
     n_outargs = 0;
-    JS::AutoValueVector jsargs(context);
+    JS::RootedValueVector jsargs(context);
 
     if (!jsargs.reserve(n_args))
         g_error("Unable to reserve space for vector");
@@ -800,7 +800,7 @@ gjs_invoke_c_function(JSContext                             *context,
     bool is_object_method = false;
     GITypeInfo return_info;
     GITypeTag return_tag;
-    JS::AutoValueVector return_values(context);
+    JS::RootedValueVector return_values(context);
     guint8 next_rval = 0; /* index into return_values */
 
     /* Because we can't free a closure while we're in it, we defer
diff --git a/gi/object.cpp b/gi/object.cpp
index 51196819..be1b0b7d 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -860,7 +860,7 @@ bool ObjectPrototype::resolve_impl(JSContext* context, JS::HandleObject obj,
 }
 
 bool ObjectPrototype::new_enumerate_impl(JSContext* cx, JS::HandleObject,
-                                         JS::AutoIdVector& properties,
+                                         JS::MutableHandleIdVector properties,
                                          bool only_enumerable G_GNUC_UNUSED) {
     unsigned n_interfaces;
     GType* interfaces = g_type_interfaces(gtype(), &n_interfaces);
diff --git a/gi/object.h b/gi/object.h
index 47aca983..0935551b 100644
--- a/gi/object.h
+++ b/gi/object.h
@@ -269,10 +269,9 @@ class ObjectPrototype
                       const char* prop_name, bool* resolved);
 
     GJS_JSAPI_RETURN_CONVENTION
-    bool new_enumerate_impl(
-        JSContext* cx, JS::HandleObject obj,
-        JS::AutoIdVector& properties,  // NOLINT(runtime/references)
-        bool only_enumerable);
+    bool new_enumerate_impl(JSContext* cx, JS::HandleObject obj,
+                            JS::MutableHandleIdVector properties,
+                            bool only_enumerable);
     void trace_impl(JSTracer* tracer);
 
     /* JS methods */
diff --git a/gi/value.cpp b/gi/value.cpp
index 02700ac5..e680d36a 100644
--- a/gi/value.cpp
+++ b/gi/value.cpp
@@ -227,7 +227,7 @@ closure_marshal(GClosure        *closure,
         g_base_info_unref((GIBaseInfo *)signal_info);
     }
 
-    JS::AutoValueVector argv(context);
+    JS::RootedValueVector argv(context);
     /* May end up being less */
     if (!argv.reserve(n_param_values))
         g_error("Unable to reserve space");
diff --git a/gi/wrapperutils.h b/gi/wrapperutils.h
index 7c938f2e..11201fb2 100644
--- a/gi/wrapperutils.h
+++ b/gi/wrapperutils.h
@@ -346,10 +346,9 @@ class GIWrapperBase {
      * Prototype::new_enumerate_impl() method.
      */
     GJS_JSAPI_RETURN_CONVENTION
-    static bool new_enumerate(
-        JSContext* cx, JS::HandleObject obj,
-        JS::AutoIdVector& properties,  // NOLINT(runtime/references)
-        bool only_enumerable) {
+    static bool new_enumerate(JSContext* cx, JS::HandleObject obj,
+                              JS::MutableHandleIdVector properties,
+                              bool only_enumerable) {
         Base* priv = Base::for_js(cx, obj);
 
         priv->debug_jsprop("Enumerate hook", "(all)", obj);
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 6373157b..481ec1ac 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -987,7 +987,7 @@ bool GjsContextPrivate::eval_with_scope(JS::HandleObject scope_object,
                                utf16_string.size() - offset,
                                JS::SourceBufferHolder::NoOwnership);
 
-    JS::AutoObjectVector scope_chain(m_cx);
+    JS::RootedObjectVector scope_chain(m_cx);
     if (!scope_chain.append(eval_obj)) {
         JS_ReportOutOfMemory(m_cx);
         return false;
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index acba258a..7e71e727 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -377,7 +377,7 @@ static JSObject* load_module_init(JSContext* cx, JS::HandleObject in_object,
 
 GJS_JSAPI_RETURN_CONVENTION
 static bool load_module_elements(JSContext* cx, JS::HandleObject in_object,
-                                 JS::AutoIdVector& prop_ids,
+                                 JS::MutableHandleIdVector prop_ids,
                                  const char* init_path) {
     size_t ix, length;
     JS::RootedObject module_obj(cx, load_module_init(cx, in_object, init_path));
@@ -622,7 +622,7 @@ static bool do_import(JSContext* context, JS::HandleObject obj, Importer* priv,
  */
 GJS_JSAPI_RETURN_CONVENTION
 static bool importer_new_enumerate(JSContext* context, JS::HandleObject object,
-                                   JS::AutoIdVector& properties,
+                                   JS::MutableHandleIdVector properties,
                                    bool enumerable_only G_GNUC_UNUSED) {
     Importer *priv;
     guint32 search_path_len;
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index e8a35980..4e2c1efb 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -211,7 +211,7 @@ gjs_build_string_array(JSContext   *context,
     if (array_length == -1)
         array_length = g_strv_length(array_values);
 
-    JS::AutoValueVector elems(context);
+    JS::RootedValueVector elems(context);
     if (!elems.reserve(array_length)) {
         JS_ReportOutOfMemory(context);
         return nullptr;
diff --git a/gjs/module.cpp b/gjs/module.cpp
index 727c86fc..f66e8540 100644
--- a/gjs/module.cpp
+++ b/gjs/module.cpp
@@ -105,7 +105,7 @@ class GjsModule {
                                    utf16_string.size() - offset,
                                    JS::SourceBufferHolder::NoOwnership);
 
-        JS::AutoObjectVector scope_chain(cx);
+        JS::RootedObjectVector scope_chain(cx);
         if (!scope_chain.append(module)) {
             JS_ReportOutOfMemory(cx);
             return false;


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