diff options
author | Christian Hergert <chergert@redhat.com> | 2016-04-26 03:08:11 -0700 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2016-04-26 09:06:07 -0400 |
commit | f27dd214267b5b907411cefb85350acfbb26ac77 (patch) | |
tree | 483d25fff5f17218f2699f125b8c5c152ff11b28 /gdk/gdkframetimings.c | |
parent | 8f64e4a8e3443eb887614e981b4a0f7b6ae3ac96 (diff) | |
download | gtk+-f27dd214267b5b907411cefb85350acfbb26ac77.tar.gz |
frametimings: reuse previous frame timing in common case
Typically, there won't be any references on old frame timings except for
the most recent timing. So instead of discarding these and re-entering
gslice twice, just steal the old frame timing and reuse it.
https://bugzilla.gnome.org/show_bug.cgi?id=765592
Diffstat (limited to 'gdk/gdkframetimings.c')
-rw-r--r-- | gdk/gdkframetimings.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gdk/gdkframetimings.c b/gdk/gdkframetimings.c index 0245d469d2..7b8a3dd88c 100644 --- a/gdk/gdkframetimings.c +++ b/gdk/gdkframetimings.c @@ -17,6 +17,8 @@ #include "config.h" +#include <string.h> + #include "gdkframeclockprivate.h" /** @@ -48,6 +50,21 @@ _gdk_frame_timings_new (gint64 frame_counter) return timings; } +gboolean +_gdk_frame_timings_steal (GdkFrameTimings *timings, + gint64 frame_counter) +{ + if (timings->ref_count == 1) + { + memset (timings, 0, sizeof *timings); + timings->ref_count = 1; + timings->frame_counter = frame_counter; + return TRUE; + } + + return FALSE; +} + /** * gdk_frame_timings_ref: * @timings: a #GdkFrameTimings |