[gtk+/gtk-3-20] frame-clock: avoid g_signal_emit_by_name()
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-20] frame-clock: avoid g_signal_emit_by_name()
- Date: Tue, 19 Apr 2016 14:58:11 +0000 (UTC)
commit 373749649ea1755ba86df159ea25e3aafd29ac74
Author: Christian Hergert <christian hergert me>
Date: Mon Apr 18 14:16:20 2016 -0700
frame-clock: avoid g_signal_emit_by_name()
These were showing up higher in Sysprof profiles.
The simple fix is to avoid the emit_by_name() and let the interface emit
the signals directly. No function preconditions are provided since these
are internal API.
gdk/gdkframeclock.c | 42 ++++++++++++++++++++++++++++++++++++++++++
gdk/gdkframeclockidle.c | 14 +++++++-------
gdk/gdkframeclockprivate.h | 8 ++++++++
3 files changed, 57 insertions(+), 7 deletions(-)
---
diff --git a/gdk/gdkframeclock.c b/gdk/gdkframeclock.c
index 9399ab9..f84aee7 100644
--- a/gdk/gdkframeclock.c
+++ b/gdk/gdkframeclock.c
@@ -603,3 +603,45 @@ gdk_frame_clock_get_refresh_info (GdkFrameClock *frame_clock,
frame_counter--;
}
}
+
+void
+_gdk_frame_clock_emit_flush_events (GdkFrameClock *frame_clock)
+{
+ g_signal_emit (frame_clock, signals[FLUSH_EVENTS], 0);
+}
+
+void
+_gdk_frame_clock_emit_before_paint (GdkFrameClock *frame_clock)
+{
+ g_signal_emit (frame_clock, signals[BEFORE_PAINT], 0);
+}
+
+void
+_gdk_frame_clock_emit_update (GdkFrameClock *frame_clock)
+{
+ g_signal_emit (frame_clock, signals[UPDATE], 0);
+}
+
+void
+_gdk_frame_clock_emit_layout (GdkFrameClock *frame_clock)
+{
+ g_signal_emit (frame_clock, signals[LAYOUT], 0);
+}
+
+void
+_gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock)
+{
+ g_signal_emit (frame_clock, signals[PAINT], 0);
+}
+
+void
+_gdk_frame_clock_emit_after_paint (GdkFrameClock *frame_clock)
+{
+ g_signal_emit (frame_clock, signals[AFTER_PAINT], 0);
+}
+
+void
+_gdk_frame_clock_emit_resume_events (GdkFrameClock *frame_clock)
+{
+ g_signal_emit (frame_clock, signals[RESUME_EVENTS], 0);
+}
diff --git a/gdk/gdkframeclockidle.c b/gdk/gdkframeclockidle.c
index 0d7e000..12897f4 100644
--- a/gdk/gdkframeclockidle.c
+++ b/gdk/gdkframeclockidle.c
@@ -307,7 +307,7 @@ gdk_frame_clock_flush_idle (void *data)
priv->phase = GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS;
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS;
- g_signal_emit_by_name (G_OBJECT (clock), "flush-events");
+ _gdk_frame_clock_emit_flush_events (clock);
if ((priv->requested & ~GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS) != 0 ||
priv->updating_count > 0)
@@ -366,7 +366,7 @@ gdk_frame_clock_paint_idle (void *data)
* in them.
*/
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT;
- g_signal_emit_by_name (G_OBJECT (clock), "before-paint");
+ _gdk_frame_clock_emit_before_paint (clock);
priv->phase = GDK_FRAME_CLOCK_PHASE_UPDATE;
}
/* fallthrough */
@@ -377,7 +377,7 @@ gdk_frame_clock_paint_idle (void *data)
priv->updating_count > 0)
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_UPDATE;
- g_signal_emit_by_name (G_OBJECT (clock), "update");
+ _gdk_frame_clock_emit_update (clock);
}
}
/* fallthrough */
@@ -405,7 +405,7 @@ gdk_frame_clock_paint_idle (void *data)
priv->freeze_count == 0 && iter++ < 4)
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_LAYOUT;
- g_signal_emit_by_name (G_OBJECT (clock), "layout");
+ _gdk_frame_clock_emit_layout (clock);
}
if (iter == 5)
g_warning ("gdk-frame-clock: layout continuously requested, giving up after 4 tries");
@@ -427,7 +427,7 @@ gdk_frame_clock_paint_idle (void *data)
if (priv->requested & GDK_FRAME_CLOCK_PHASE_PAINT)
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_PAINT;
- g_signal_emit_by_name (G_OBJECT (clock), "paint");
+ _gdk_frame_clock_emit_paint (clock);
}
}
/* fallthrough */
@@ -435,7 +435,7 @@ gdk_frame_clock_paint_idle (void *data)
if (priv->freeze_count == 0)
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_AFTER_PAINT;
- g_signal_emit_by_name (G_OBJECT (clock), "after-paint");
+ _gdk_frame_clock_emit_after_paint (clock);
/* the ::after-paint phase doesn't get repeated on freeze/thaw,
*/
priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
@@ -462,7 +462,7 @@ gdk_frame_clock_paint_idle (void *data)
if (priv->requested & GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS)
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS;
- g_signal_emit_by_name (G_OBJECT (clock), "resume-events");
+ _gdk_frame_clock_emit_resume_events (clock);
}
if (priv->freeze_count == 0)
diff --git a/gdk/gdkframeclockprivate.h b/gdk/gdkframeclockprivate.h
index 5181d74..cda5aff 100644
--- a/gdk/gdkframeclockprivate.h
+++ b/gdk/gdkframeclockprivate.h
@@ -113,6 +113,14 @@ void _gdk_frame_clock_debug_print_timings (GdkFrameClock *clock,
GdkFrameTimings *_gdk_frame_timings_new (gint64 frame_counter);
+void _gdk_frame_clock_emit_flush_events (GdkFrameClock *frame_clock);
+void _gdk_frame_clock_emit_before_paint (GdkFrameClock *frame_clock);
+void _gdk_frame_clock_emit_update (GdkFrameClock *frame_clock);
+void _gdk_frame_clock_emit_layout (GdkFrameClock *frame_clock);
+void _gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock);
+void _gdk_frame_clock_emit_after_paint (GdkFrameClock *frame_clock);
+void _gdk_frame_clock_emit_resume_events (GdkFrameClock *frame_clock);
+
G_END_DECLS
#endif /* __GDK_FRAME_CLOCK_PRIVATE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]