static void
ide_autotools_build_system_init (IdeAutotoolsBuildSystem *self)
{
  /*
   * We actually only use this task cache for one instance, but it really
   * makes it convenient to cache the result of even a single item so we
   * can avoid async races in replies, as well as avoiding duplicate work.
   *
   * We don't require a ref/unref for the populate callback data since we
   * will always have a GTask queued holding a reference during the lifetime
   * of the populate callback execution.
   */
  self->task_cache = egg_task_cache_new (g_str_hash,
                                         g_str_equal,
                                         (GBoxedCopyFunc)g_strdup,
                                         g_free,
                                         g_object_ref,
                                         g_object_unref,
                                         DEFAULT_MAKECACHE_TTL,
                                         populate_cache_cb,
                                         self,
                                         NULL);

  egg_task_cache_set_name (self->task_cache, "makecache");
}
static void
ide_clang_service_start (IdeService *service)
{
  IdeClangService *self = (IdeClangService *)service;

  g_return_if_fail (IDE_IS_CLANG_SERVICE (self));
  g_return_if_fail (!self->index);

  self->cancellable = g_cancellable_new ();

  self->units_cache = egg_task_cache_new ((GHashFunc)ide_file_hash,
                                          (GEqualFunc)ide_file_equal,
                                          g_object_ref,
                                          g_object_unref,
                                          g_object_ref,
                                          g_object_unref,
                                          DEFAULT_EVICTION_MSEC,
                                          ide_clang_service_get_translation_unit_worker,
                                          g_object_ref (self),
                                          g_object_unref);

  self->index = clang_createIndex (0, 0);
  clang_CXIndex_setGlobalOptions (self->index,
                                  CXGlobalOpt_ThreadBackgroundPriorityForAll);
}
Example #3
0
static void
ide_gettext_diagnostic_provider_init (IdeGettextDiagnosticProvider *self)
{
  self->diagnostics_cache = egg_task_cache_new ((GHashFunc)ide_file_hash,
                                                (GEqualFunc)ide_file_equal,
                                                g_object_ref,
                                                g_object_unref,
                                                g_object_ref,
                                                g_object_unref,
                                                20 * 1000L,
                                                populate_cache,
                                                self,
                                                NULL);

  egg_task_cache_set_name (self->diagnostics_cache, "gettext diagnostic cache");
}