[gjs: 7/10] union: Use separate memory counters
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 7/10] union: Use separate memory counters
- Date: Sun, 2 Dec 2018 02:09:33 +0000 (UTC)
commit 03a3a34270b73ed8fd4a65daa67976086ea8b108
Author: Philip Chimento <philip chimento gmail com>
Date: Thu Nov 22 23:41:19 2018 -0500
union: Use separate memory counters
Previously, unions used the "boxed" memory counter. There is no reason to
do that, and we are going to refactor the boxed memory counters into
boxed_instance and boxed_prototype, so unions should use their own
counter.
gi/union.cpp | 8 ++++----
gjs/mem.cpp | 2 ++
gjs/mem.h | 1 +
3 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/gi/union.cpp b/gi/union.cpp
index 9cc5e2e7..89c35a02 100644
--- a/gi/union.cpp
+++ b/gi/union.cpp
@@ -184,7 +184,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(union)
priv = g_slice_new0(Union);
- GJS_INC_COUNTER(boxed);
+ GJS_INC_COUNTER(union);
g_assert(priv_from_js(context, object) == NULL);
JS_SetPrivate(object, priv);
@@ -261,7 +261,7 @@ union_finalize(JSFreeOp *fop,
priv->info = NULL;
}
- GJS_DEC_COUNTER(boxed);
+ GJS_DEC_COUNTER(union);
g_slice_free(Union, priv);
}
@@ -348,7 +348,7 @@ gjs_define_union_class(JSContext *context,
return false;
}
- GJS_INC_COUNTER(boxed);
+ GJS_INC_COUNTER(union);
priv = g_slice_new0(Union);
priv->info = info;
g_base_info_ref( (GIBaseInfo*) priv->info);
@@ -401,7 +401,7 @@ gjs_union_from_c_union(JSContext *context,
obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto);
- GJS_INC_COUNTER(boxed);
+ GJS_INC_COUNTER(union);
priv = g_slice_new0(Union);
JS_SetPrivate(obj, priv);
priv->info = info;
diff --git a/gjs/mem.cpp b/gjs/mem.cpp
index 6ce2eb8a..1dc07a5b 100644
--- a/gjs/mem.cpp
+++ b/gjs/mem.cpp
@@ -46,6 +46,7 @@ GJS_DEFINE_COUNTER(object_instance)
GJS_DEFINE_COUNTER(object_prototype)
GJS_DEFINE_COUNTER(param)
GJS_DEFINE_COUNTER(repo)
+GJS_DEFINE_COUNTER(union)
#define GJS_LIST_COUNTER(name) \
& gjs_counter_ ## name
@@ -65,6 +66,7 @@ static GjsMemCounter* counters[] = {
GJS_LIST_COUNTER(object_prototype),
GJS_LIST_COUNTER(param),
GJS_LIST_COUNTER(repo),
+ GJS_LIST_COUNTER(union),
};
// clang-format on
diff --git a/gjs/mem.h b/gjs/mem.h
index 6d2e6ca7..0bbd9ba3 100644
--- a/gjs/mem.h
+++ b/gjs/mem.h
@@ -53,6 +53,7 @@ GJS_DECLARE_COUNTER(object_instance)
GJS_DECLARE_COUNTER(object_prototype)
GJS_DECLARE_COUNTER(param)
GJS_DECLARE_COUNTER(repo)
+GJS_DECLARE_COUNTER(union)
#define GJS_INC_COUNTER(name) \
do { \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]