Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: dbus/bus.h

Issue 8161005: Fix a bug in dbus::Bus::AddFilterFunction(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dbus/bus.cc » ('j') | dbus/bus.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/bus.h
diff --git a/dbus/bus.h b/dbus/bus.h
index b64ae8fa98f3e062b5d05a5dfddb754b6817486b..3d64a088f176237fd01fd4544de2d3291e3b1ad9 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,
« no previous file with comments | « no previous file | dbus/bus.cc » ('j') | dbus/bus.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698