[gjs/wip/require: 22/29] Remove last use of gjs_runtime_get_context, and remove the hook
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/require: 22/29] Remove last use of gjs_runtime_get_context, and remove the hook
- Date: Wed, 15 Jan 2014 16:20:13 +0000 (UTC)
commit 0cf205b72b154a3598e1f2644cc3b67bb16728d1
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Jan 15 10:49:46 2014 -0500
Remove last use of gjs_runtime_get_context, and remove the hook
gi/object.cpp | 22 +++-------------------
gjs/runtime.cpp | 15 ---------------
gjs/runtime.h | 2 --
3 files changed, 3 insertions(+), 36 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 511b28b..3a3a95d 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1010,22 +1010,9 @@ wrapped_gobj_toggle_notify(gpointer data,
GObject *gobj,
gboolean is_last_ref)
{
- JSRuntime *runtime;
- JSContext *context;
gboolean gc_blocked = FALSE;
gboolean toggle_up_queued, toggle_down_queued;
-
- runtime = (JSRuntime*) data;
-
- /* During teardown, this can return NULL if runtime is being destroyed.
- * In that case we effectively already converted to a weak ref without
- * doing anything since the keep alive will be collected.
- * Or if !is_last_ref, we do not want to convert to a strong
- * ref since we want everything collected on runtime destroy.
- */
- context = gjs_runtime_get_context(runtime);
- if (!context)
- return;
+ JSContext *context = (JSContext *) data;
/* We only want to touch javascript from one thread.
* If we're not in that thread, then we need to defer processing
@@ -1158,9 +1145,7 @@ associate_js_gobject (JSContext *context,
object,
priv);
- g_object_add_toggle_ref(gobj,
- wrapped_gobj_toggle_notify,
- JS_GetRuntime(context));
+ g_object_add_toggle_ref(gobj, wrapped_gobj_toggle_notify, context);
}
static JSBool
@@ -1349,8 +1334,7 @@ object_instance_finalize(JSFreeOp *fop,
}
set_js_obj(priv->gobj, NULL);
- g_object_remove_toggle_ref(priv->gobj, wrapped_gobj_toggle_notify,
- fop->runtime());
+ g_object_remove_toggle_ref(priv->gobj, wrapped_gobj_toggle_notify, NULL);
priv->gobj = NULL;
}
diff --git a/gjs/runtime.cpp b/gjs/runtime.cpp
index 339b77b..c9acebd 100644
--- a/gjs/runtime.cpp
+++ b/gjs/runtime.cpp
@@ -45,21 +45,6 @@ get_data(JSRuntime *runtime)
return (GjsRuntimeData*) JS_GetRuntimePrivate(runtime);
}
-/**
- * gjs_runtime_get_context:
- * @runtime: a #JSRuntime
- *
- * Gets the context associated with this runtime.
- *
- * Return value: the context, or %NULL if GJS hasn't been initialized
- * for the runtime or is being shut down.
- */
-JSContext *
-gjs_runtime_get_context(JSRuntime *runtime)
-{
- return get_data(runtime)->context;
-}
-
void
gjs_runtime_init_for_context(JSRuntime *runtime,
JSContext *context)
diff --git a/gjs/runtime.h b/gjs/runtime.h
index 5991d51..17e4364 100644
--- a/gjs/runtime.h
+++ b/gjs/runtime.h
@@ -28,6 +28,4 @@ void gjs_runtime_init_for_context (JSRuntime *runtime,
JSContext *context);
void gjs_runtime_deinit (JSRuntime *runtime);
-JSContext* gjs_runtime_get_context (JSRuntime *runtime);
-
#endif /* __GJS_RUNTIME_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]