[vte] glib: glue: Set source names for debug
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] glib: glue: Set source names for debug
- Date: Sun, 19 Apr 2020 18:04:49 +0000 (UTC)
commit 663983a1d38c782c73bb9af640d6e0beb26e86f6
Author: Christian Persch <chpe src gnome org>
Date: Sun Apr 19 20:03:35 2020 +0200
glib: glue: Set source names for debug
https://gitlab.gnome.org/GNOME/vte/-/issues/231
src/glib-glue.hh | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/glib-glue.hh b/src/glib-glue.hh
index 5a1d7b3d..c2bc373a 100644
--- a/src/glib-glue.hh
+++ b/src/glib-glue.hh
@@ -86,8 +86,10 @@ public:
Timer(callback_type callback,
char const* name)
- : m_callback(callback),
- m_name(name)
+ : m_callback(callback)
+#ifdef VTE_DEBUG
+ , m_name(name)
+#endif
{
}
@@ -123,6 +125,7 @@ public:
s_dispatch_timer_cb,
this,
s_destroy_timer_cb);
+ set_source_name();
}
void schedule_seconds(unsigned int timeout,
@@ -134,6 +137,7 @@ public:
s_dispatch_timer_cb,
this,
s_destroy_timer_cb);
+ set_source_name();
}
void schedule_idle(int priority = Priority::eDEFAULT) noexcept
@@ -143,6 +147,7 @@ public:
s_dispatch_timer_cb,
this,
s_destroy_timer_cb);
+ set_source_name();
}
void abort() noexcept
@@ -157,7 +162,9 @@ public:
private:
callback_type m_callback{};
+#ifdef VTE_DEBUG
char const* m_name{nullptr};
+#endif
guint m_source_id{0};
bool m_rescheduled{false};
@@ -179,6 +186,13 @@ private:
return rv;
}
+ inline void set_source_name() const noexcept
+ {
+ #ifdef VTE_DEBUG
+ g_source_set_name_by_id(m_source_id, m_name);
+ #endif
+ }
+
static gboolean s_dispatch_timer_cb(void* data) noexcept
{
auto timer = reinterpret_cast<Timer*>(data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]