Merge lp:~ted/libdbusmenu/only-top-first into lp:libdbusmenu/0.5

Proposed by Ted Gould
Status: Merged
Merged at revision: 168
Proposed branch: lp:~ted/libdbusmenu/only-top-first
Merge into: lp:libdbusmenu/0.5
Diff against target: 41 lines (+15/-2)
1 file modified
libdbusmenu-glib/client.c (+15/-2)
To merge this branch: bzr merge lp:~ted/libdbusmenu/only-top-first
Reviewer Review Type Date Requested Status
Cody Russell (community) Approve
Review via email: mp+38369@code.launchpad.net

Description of the change

This switches around the way we break up property requests. Currently we do it based on every level of the tree. That makes some sense, but it probably broken up more than we need. This changes it to force a flush at the top level, but then only every 100 menu entries after that. This should reduce the number of dbus calls, but still get us the top level quickly.

To post a comment you must log in.
Revision history for this message
Cody Russell (bratsche) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libdbusmenu-glib/client.c'
2--- libdbusmenu-glib/client.c 2010-10-12 21:24:07 +0000
3+++ libdbusmenu-glib/client.c 2010-10-13 20:52:50 +0000
4@@ -43,6 +43,10 @@
5 #include "server-marshal.h"
6 #include "client-marshal.h"
7
8+/* How many property requests should we queue before
9+ sending the message on dbus */
10+#define MAX_PROPERTIES_TO_QUEUE 100
11+
12 /* Properties */
13 enum {
14 PROP_0,
15@@ -628,6 +632,13 @@
16 priv->delayed_idle = g_idle_add(get_properties_idle, client);
17 }
18
19+ /* Look at how many proprites we have queued up and
20+ make it so that we don't leave too many in one
21+ request. */
22+ if (priv->delayed_property_listeners->len == MAX_PROPERTIES_TO_QUEUE) {
23+ get_properties_flush(client);
24+ }
25+
26 return;
27 }
28
29@@ -1283,8 +1294,10 @@
30
31 /* We've got everything built up at this node and reconcilled */
32
33- /* Flush the properties requests */
34- get_properties_flush(client);
35+ /* Flush the properties requests if this is the first level */
36+ if (dbusmenu_menuitem_get_id(parent) == 0) {
37+ get_properties_flush(client);
38+ }
39
40 /* now it's time to recurse down the tree. */
41 children = node->children;

Subscribers

People subscribed via source and target branches