[gnome-builder] highlighter: add note about desired frame clock usage



commit 9c97af7855211538835719350b2bb1616a41c4a8
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jun 14 14:04:43 2017 -0700

    highlighter: add note about desired frame clock usage
    
    If the highlighter had access to a GdkFrameClock, it would be nice to use
    that to drive the buffer scanning. We could increase our quanta and be
    more sure that we would not stomp on the next frame.
    
    Also, lower the priority just a bit more so other callbacks fire before
    our scanning work (we use G_PRIORITY_LOW all over the place).

 libide/highlighting/ide-highlight-engine.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/libide/highlighting/ide-highlight-engine.c b/libide/highlighting/ide-highlight-engine.c
index 8bd8a24..f06fd39 100644
--- a/libide/highlighting/ide-highlight-engine.c
+++ b/libide/highlighting/ide-highlight-engine.c
@@ -386,10 +386,19 @@ ide_highlight_engine_queue_work (IdeHighlightEngine *self)
   if ((self->highlighter == NULL) || (self->buffer == NULL) || (self->work_timeout != 0))
     return;
 
-  self->work_timeout =  gdk_threads_add_idle_full (G_PRIORITY_LOW,
-                                                   ide_highlight_engine_work_timeout_handler,
-                                                   self,
-                                                   NULL);
+  /*
+   * NOTE: It would be really nice if we could use the GdkFrameClock here to
+   *       drive the next update instead of a timeout. It's possible that our
+   *       callback could get scheduled right before the frame processing would
+   *       begin. However, since that gets driven by something like a Wayland
+   *       callback, it won't yet be scheduled. So instead our function gets
+   *       called and we potentially cause a frame to drop.
+   */
+
+  self->work_timeout = gdk_threads_add_idle_full (G_PRIORITY_LOW + 1,
+                                                  ide_highlight_engine_work_timeout_handler,
+                                                  self,
+                                                  NULL);
 }
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]