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

Side by Side Diff: dbus/object_proxy.h

Issue 14333009: D-Bus: allow multiple signal handlers for a signal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dbus/end_to_end_async_unittest.cc ('k') | dbus/object_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DBUS_OBJECT_PROXY_H_ 5 #ifndef DBUS_OBJECT_PROXY_H_
6 #define DBUS_OBJECT_PROXY_H_ 6 #define DBUS_OBJECT_PROXY_H_
7 7
8 #include <dbus/dbus.h> 8 #include <dbus/dbus.h>
9 9
10 #include <map> 10 #include <map>
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 #include <vector>
13 14
14 #include "base/callback.h" 15 #include "base/callback.h"
15 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
16 #include "base/strings/string_piece.h" 17 #include "base/strings/string_piece.h"
17 #include "base/time.h" 18 #include "base/time.h"
18 #include "dbus/dbus_export.h" 19 #include "dbus/dbus_export.h"
19 #include "dbus/object_path.h" 20 #include "dbus/object_path.h"
20 21
21 namespace dbus { 22 namespace dbus {
22 23
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 const std::string& signal_name, 216 const std::string& signal_name,
216 bool success); 217 bool success);
217 218
218 // Handles the incoming request messages and dispatches to the signal 219 // Handles the incoming request messages and dispatches to the signal
219 // callbacks. 220 // callbacks.
220 DBusHandlerResult HandleMessage(DBusConnection* connection, 221 DBusHandlerResult HandleMessage(DBusConnection* connection,
221 DBusMessage* raw_message); 222 DBusMessage* raw_message);
222 223
223 // Runs the method. Helper function for HandleMessage(). 224 // Runs the method. Helper function for HandleMessage().
224 void RunMethod(base::TimeTicks start_time, 225 void RunMethod(base::TimeTicks start_time,
225 SignalCallback signal_callback, 226 std::vector<SignalCallback> signal_callbacks,
226 Signal* signal); 227 Signal* signal);
227 228
228 // Redirects the function call to HandleMessage(). 229 // Redirects the function call to HandleMessage().
229 static DBusHandlerResult HandleMessageThunk(DBusConnection* connection, 230 static DBusHandlerResult HandleMessageThunk(DBusConnection* connection,
230 DBusMessage* raw_message, 231 DBusMessage* raw_message,
231 void* user_data); 232 void* user_data);
232 233
233 // Helper method for logging response errors appropriately. 234 // Helper method for logging response errors appropriately.
234 void LogMethodCallFailure(const base::StringPiece& interface_name, 235 void LogMethodCallFailure(const base::StringPiece& interface_name,
235 const base::StringPiece& method_name, 236 const base::StringPiece& method_name,
(...skipping 25 matching lines...) Expand all
261 DBusHandlerResult HandleNameOwnerChanged(scoped_ptr<dbus::Signal> signal); 262 DBusHandlerResult HandleNameOwnerChanged(scoped_ptr<dbus::Signal> signal);
262 263
263 scoped_refptr<Bus> bus_; 264 scoped_refptr<Bus> bus_;
264 std::string service_name_; 265 std::string service_name_;
265 ObjectPath object_path_; 266 ObjectPath object_path_;
266 267
267 // True if the message filter was added. 268 // True if the message filter was added.
268 bool filter_added_; 269 bool filter_added_;
269 270
270 // The method table where keys are absolute signal names (i.e. interface 271 // The method table where keys are absolute signal names (i.e. interface
271 // name + signal name), and values are the corresponding callbacks. 272 // name + signal name), and values are lists of the corresponding callbacks.
272 typedef std::map<std::string, SignalCallback> MethodTable; 273 typedef std::map<std::string, std::vector<SignalCallback> > MethodTable;
273 MethodTable method_table_; 274 MethodTable method_table_;
274 275
275 // The callback called when NameOwnerChanged signal is received. 276 // The callback called when NameOwnerChanged signal is received.
276 SignalCallback name_owner_changed_callback_; 277 SignalCallback name_owner_changed_callback_;
277 278
278 std::set<std::string> match_rules_; 279 std::set<std::string> match_rules_;
279 280
280 const bool ignore_service_unknown_errors_; 281 const bool ignore_service_unknown_errors_;
281 282
282 // Known name owner of the well-known bus name represnted by |service_name_|. 283 // Known name owner of the well-known bus name represnted by |service_name_|.
283 std::string service_name_owner_; 284 std::string service_name_owner_;
284 285
285 DISALLOW_COPY_AND_ASSIGN(ObjectProxy); 286 DISALLOW_COPY_AND_ASSIGN(ObjectProxy);
286 }; 287 };
287 288
288 } // namespace dbus 289 } // namespace dbus
289 290
290 #endif // DBUS_OBJECT_PROXY_H_ 291 #endif // DBUS_OBJECT_PROXY_H_
OLDNEW
« no previous file with comments | « dbus/end_to_end_async_unittest.cc ('k') | dbus/object_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698