summaryrefslogtreecommitdiff
path: root/gjs
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2017-05-01 22:30:16 -0700
committerPhilip Chimento <philip.chimento@gmail.com>2017-07-09 11:41:33 -0700
commita3d22db2918ba1a849afb5f567d2952505c5f851 (patch)
treebbe42b723ac9086f97e92066e62cebbc4008d540 /gjs
parent4a477b1f53ac980867f18cd9776691b2891c90b0 (diff)
downloadgjs-a3d22db2918ba1a849afb5f567d2952505c5f851.tar.gz
js: Adapt to new JS::TraceEdge<T> API
Replacing the old JS_CallFooTracer() API is a new C++ JS::TraceEdge<T>() function. It works the same, but is templated. The old API will be going away in SpiderMonkey 52. https://bugzilla.gnome.org/show_bug.cgi?id=784196
Diffstat (limited to 'gjs')
-rw-r--r--gjs/context.cpp2
-rw-r--r--gjs/coverage.cpp3
-rw-r--r--gjs/jsapi-util-root.h24
3 files changed, 5 insertions, 24 deletions
diff --git a/gjs/context.cpp b/gjs/context.cpp
index fb62bf27..6f8967b0 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -192,7 +192,7 @@ static void
gjs_context_tracer(JSTracer *trc, void *data)
{
GjsContext *gjs_context = reinterpret_cast<GjsContext *>(data);
- JS_CallObjectTracer(trc, &gjs_context->global, "GJS global object");
+ JS::TraceEdge<JSObject *>(trc, &gjs_context->global, "GJS global object");
}
static void
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index 67997d0f..54326c4f 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -1488,7 +1488,8 @@ coverage_statistics_tracer(JSTracer *trc, void *data)
GjsCoverage *coverage = (GjsCoverage *) data;
GjsCoveragePrivate *priv = (GjsCoveragePrivate *) gjs_coverage_get_instance_private(coverage);
- JS_CallObjectTracer(trc, &priv->coverage_statistics, "coverage_statistics");
+ JS::TraceEdge<JSObject *>(trc, &priv->coverage_statistics,
+ "coverage_statistics");
}
/* This function is mainly used in the tests in order to fiddle with
diff --git a/gjs/jsapi-util-root.h b/gjs/jsapi-util-root.h
index 543f5373..ab316520 100644
--- a/gjs/jsapi-util-root.h
+++ b/gjs/jsapi-util-root.h
@@ -66,23 +66,11 @@
*/
template<typename T>
struct GjsHeapOperation {
- static void trace(JSTracer *tracer,
- JS::Heap<T> *thing,
- const char *name);
-
static bool update_after_gc(JS::Heap<T> *location);
};
template<>
struct GjsHeapOperation<JSObject *> {
- static void
- trace(JSTracer *tracer,
- JS::Heap<JSObject *> *thing,
- const char *name)
- {
- JS_CallObjectTracer(tracer, thing, name);
- }
-
static bool
update_after_gc(JS::Heap<JSObject *> *location)
{
@@ -92,15 +80,7 @@ struct GjsHeapOperation<JSObject *> {
};
template<>
-struct GjsHeapOperation<JS::Value> {
- static void
- trace(JSTracer *tracer,
- JS::Heap<JS::Value> *thing,
- const char *name)
- {
- JS_CallValueTracer(tracer, thing, name);
- }
-};
+struct GjsHeapOperation<JS::Value> {};
/* GjsMaybeOwned is intended only for use in heap allocation. Do not allocate it
* on the stack, and do not allocate any instances of structures that have it as
@@ -316,7 +296,7 @@ public:
{
debug("trace()");
g_assert(!m_rooted);
- GjsHeapOperation<T>::trace(tracer, &m_heap, name);
+ JS::TraceEdge<T>(tracer, &m_heap, name);
}
/* If not tracing, then you must call this method during GC in order to