summaryrefslogtreecommitdiffstats
path: root/dbus/bus.h
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-06 00:20:53 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-06 00:20:53 +0000
commit12e2599805235b139796ffee9598e8c95768b21a (patch)
treeac743b9e174698ebdeb96f8ffaba3e356db71cc3 /dbus/bus.h
parentb1e2d361992fb4dfed9422df35f161442850909a (diff)
downloadchromium_src-12e2599805235b139796ffee9598e8c95768b21a.zip
chromium_src-12e2599805235b139796ffee9598e8c95768b21a.tar.gz
chromium_src-12e2599805235b139796ffee9598e8c95768b21a.tar.bz2
Fix a bug in dbus::Bus::AddFilterFunction().
We should not reject the same function if it's associated with different data. BUG=99258 TEST=adde a unit test and confirmed it passed. Review URL: http://codereview.chromium.org/8161005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104208 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/bus.h')
-rw-r--r--dbus/bus.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/dbus/bus.h b/dbus/bus.h
index b64ae8f..3d64a08 100644
--- a/dbus/bus.h
+++ b/dbus/bus.h
@@ -9,6 +9,7 @@
#include <map>
#include <set>
#include <string>
+#include <utility>
#include <dbus/dbus.h>
#include "base/callback.h"
@@ -284,22 +285,24 @@ class Bus : public base::RefCountedThreadSafe<Bus> {
virtual void Send(DBusMessage* request, uint32* serial);
// Adds the message filter function. |filter_function| will be called
- // when incoming messages are received.
+ // when incoming messages are received. Returns true on success.
//
// When a new incoming message arrives, filter functions are called in
// the order that they were added until the the incoming message is
// handled by a filter function.
//
- // The same filter function must not be added more than once.
+ // The same filter function associated with the same user data cannot be
+ // added more than once. Returns false for this case.
//
// BLOCKING CALL.
- virtual void AddFilterFunction(DBusHandleMessageFunction filter_function,
+ virtual bool AddFilterFunction(DBusHandleMessageFunction filter_function,
void* user_data);
// Removes the message filter previously added by AddFilterFunction().
+ // Returns true on success.
//
// BLOCKING CALL.
- virtual void RemoveFilterFunction(DBusHandleMessageFunction filter_function,
+ virtual bool RemoveFilterFunction(DBusHandleMessageFunction filter_function,
void* user_data);
// Adds the match rule. Messages that match the rule will be processed
@@ -444,7 +447,8 @@ class Bus : public base::RefCountedThreadSafe<Bus> {
// are properly cleaned up before destruction of the bus object.
std::set<std::string> match_rules_added_;
std::set<std::string> registered_object_paths_;
- std::set<DBusHandleMessageFunction> filter_functions_added_;
+ std::set<std::pair<DBusHandleMessageFunction, void*> >
+ filter_functions_added_;
// ObjectProxyTable is used to hold the object proxies created by the
// bus object. Key is a concatenated string of service name + object path,