[glib] GDBusProxy: Make interface lookups O(1)



commit b845c62c7feb06f3d16921b5c08065fb13a1030b
Author: David Zeuthen <davidz redhat com>
Date:   Mon Mar 28 11:34:48 2011 -0400

    GDBusProxy: Make interface lookups O(1)
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 gio/gdbusproxy.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c
index 06957f6..ac10aea 100644
--- a/gio/gdbusproxy.c
+++ b/gio/gdbusproxy.c
@@ -166,7 +166,10 @@ g_dbus_proxy_finalize (GObject *object)
     g_hash_table_unref (proxy->priv->properties);
 
   if (proxy->priv->expected_interface != NULL)
-    g_dbus_interface_info_unref (proxy->priv->expected_interface);
+    {
+      g_dbus_interface_info_cache_release (proxy->priv->expected_interface);
+      g_dbus_interface_info_unref (proxy->priv->expected_interface);
+    }
 
   G_OBJECT_CLASS (g_dbus_proxy_parent_class)->finalize (object);
 }
@@ -2093,8 +2096,13 @@ g_dbus_proxy_set_interface_info (GDBusProxy         *proxy,
 {
   g_return_if_fail (G_IS_DBUS_PROXY (proxy));
   if (proxy->priv->expected_interface != NULL)
-    g_dbus_interface_info_unref (proxy->priv->expected_interface);
+    {
+      g_dbus_interface_info_cache_release (proxy->priv->expected_interface);
+      g_dbus_interface_info_unref (proxy->priv->expected_interface);
+    }
   proxy->priv->expected_interface = info != NULL ? g_dbus_interface_info_ref (info) : NULL;
+  if (proxy->priv->expected_interface != NULL)
+    g_dbus_interface_info_cache_build (proxy->priv->expected_interface);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */



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