static void
gbp_git_buffer_change_monitor_queue_update (GbpGitBufferChangeMonitor *self,
                                            gboolean                  fast)
{
  guint delay;

  g_assert (GBP_IS_GIT_BUFFER_CHANGE_MONITOR (self));

  fast = !!fast;

  /* Re-use existing source if this is slow */
  if (fast == SLOW && self->queued_source)
    return;

  delay = g_delay[fast];

  g_clear_handle_id (&self->queued_source, g_source_remove);

  self->queued_source =
    gdk_threads_add_timeout_full (G_PRIORITY_HIGH,
                                  delay,
                                  (GSourceFunc) queued_update_source_cb,
                                  g_object_ref (self),
                                  g_object_unref);
}
Exemple #2
0
static gboolean
on_web_process_terminated_restart (WebKitWebView                     *web_view,
                                   WebKitWebProcessTerminationReason  reason,
                                   struct RestartData                *restart)
{
#if GLIB_CHECK_VERSION(2, 56, 0)
    g_clear_handle_id (&restart->tries_timeout_id, g_source_remove);
#else
    if (restart->tries_timeout_id) {
        g_source_remove (restart->tries_timeout_id);
        restart->tries_timeout_id = 0;
    }
#endif // GLIB_CHECK_VERSION

    if (++restart->tries >= restart->max_tries) {
        g_critical ("Renderer process terminated and failed to recover within %ums",
                    restart->try_window_ms);
        // Chain up to the handler that renders an error page.
        return cog_handle_web_view_web_process_terminated (web_view, reason, NULL);
    }

    g_warning ("Renderer process terminated, restarting (attempt %u/%u).",
               restart->tries, restart->max_tries);
    webkit_web_view_reload (web_view);

    // Reset the count of attempts if the Web process does not crash again
    // during the configure time window.
    restart->tries_timeout_id = g_timeout_add (restart->try_window_ms,
                                               (GSourceFunc) reset_recovery_tries,
                                               restart);
    return TRUE;
}
static void
gbp_git_buffer_change_monitor_destroy (IdeObject *object)
{
  GbpGitBufferChangeMonitor *self = (GbpGitBufferChangeMonitor *)object;

  if (self->buffer_signals)
    {
      dzl_signal_group_set_target (self->buffer_signals, NULL);
      g_clear_object (&self->buffer_signals);
    }

  if (self->proxy != NULL)
    {
      ipc_git_change_monitor_call_close (self->proxy, NULL, NULL, NULL);
      g_clear_object (&self->proxy);
    }

  g_clear_pointer (&self->cache, line_cache_free);
  g_clear_handle_id (&self->queued_source, g_source_remove);

  IDE_OBJECT_CLASS (gbp_git_buffer_change_monitor_parent_class)->destroy (object);
}