[tracker/tracker-0.8] tracker-store: Compress the SubjectsChanged signal for multivalue fields
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.8] tracker-store: Compress the SubjectsChanged signal for multivalue fields
- Date: Thu, 17 Jun 2010 15:37:54 +0000 (UTC)
commit aafe6fc050994e5a0b28a3e43ac1f2151f75c89e
Author: Philip Van Hoof <philip codeminded be>
Date: Fri Jun 11 16:04:51 2010 +0200
tracker-store: Compress the SubjectsChanged signal for multivalue fields
src/tracker-store/tracker-resource-class.c | 27 ++++++++++++++++++++++++---
1 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/src/tracker-store/tracker-resource-class.c b/src/tracker-store/tracker-resource-class.c
index 41f1953..9d8eb13 100644
--- a/src/tracker-store/tracker-resource-class.c
+++ b/src/tracker-store/tracker-resource-class.c
@@ -315,6 +315,28 @@ has_already (GPtrArray *array, const gchar *uri)
return FALSE;
}
+static gboolean
+has_already_updated (GPtrArray *array,
+ const gchar *uri,
+ TrackerProperty *predicate)
+{
+ guint i;
+
+ if (!array) {
+ return FALSE;
+ }
+
+ for (i = 0; i < array->len; i++) {
+ ChangedItem *item = array->pdata[i];
+
+ if (item->predicate == predicate && g_strcmp0 (item->uri, uri) == 0) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
void
tracker_resource_class_add_event (TrackerResourceClass *object,
const gchar *uri,
@@ -338,9 +360,8 @@ tracker_resource_class_add_event (TrackerResourceClass *object,
g_ptr_array_add (priv->adds, g_string_chunk_insert_const (priv->changed_strings, uri));
}
break;
- case TRACKER_DBUS_EVENTS_TYPE_UPDATE: {
- /* Duplicate checking slows down too much
- if (!changed_has_already (priv->ups, uri, predicate)) { */
+ case TRACKER_DBUS_EVENTS_TYPE_UPDATE:
+ if (!has_already_updated (priv->ups, uri, predicate)) {
ChangedItem *item;
item = g_slice_new (ChangedItem);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]