OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BUS_H_ | 5 #ifndef DBUS_BUS_H_ |
6 #define DBUS_BUS_H_ | 6 #define DBUS_BUS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // The object proxy is used to call methods of remote objects, and | 189 // The object proxy is used to call methods of remote objects, and |
190 // receive signals from them. | 190 // receive signals from them. |
191 // | 191 // |
192 // |service_name| looks like "org.freedesktop.NetworkManager", and | 192 // |service_name| looks like "org.freedesktop.NetworkManager", and |
193 // |object_path| looks like "/org/freedesktop/NetworkManager/Devices/0". | 193 // |object_path| looks like "/org/freedesktop/NetworkManager/Devices/0". |
194 // | 194 // |
195 // Must be called in the origin thread. | 195 // Must be called in the origin thread. |
196 virtual ObjectProxy* GetObjectProxy(const std::string& service_name, | 196 virtual ObjectProxy* GetObjectProxy(const std::string& service_name, |
197 const std::string& object_path); | 197 const std::string& object_path); |
198 | 198 |
| 199 // Same as above, but also takes a bitfield of ObjectProxy::Options. |
| 200 // See object_proxy.h for available options. |
| 201 virtual ObjectProxy* GetObjectProxyWithOptions( |
| 202 const std::string& service_name, |
| 203 const std::string& object_path, |
| 204 int options); |
| 205 |
199 // Gets the exported object for the given service name and the object | 206 // Gets the exported object for the given service name and the object |
200 // path. The caller must not delete the returned object. | 207 // path. The caller must not delete the returned object. |
201 // | 208 // |
202 // Returns an existing exported object if the bus object already owns | 209 // Returns an existing exported object if the bus object already owns |
203 // the exported object for the given service name and the object path. | 210 // the exported object for the given service name and the object path. |
204 // Never returns NULL. | 211 // Never returns NULL. |
205 // | 212 // |
206 // The bus will own all exported objects created by the bus, to ensure | 213 // The bus will own all exported objects created by the bus, to ensure |
207 // that the exported objects are unregistered at the shutdown time of | 214 // that the exported objects are unregistered at the shutdown time of |
208 // the bus. | 215 // the bus. |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 | 459 |
453 std::set<std::string> owned_service_names_; | 460 std::set<std::string> owned_service_names_; |
454 // The following sets are used to check if rules/object_paths/filters | 461 // The following sets are used to check if rules/object_paths/filters |
455 // are properly cleaned up before destruction of the bus object. | 462 // are properly cleaned up before destruction of the bus object. |
456 std::set<std::string> match_rules_added_; | 463 std::set<std::string> match_rules_added_; |
457 std::set<std::string> registered_object_paths_; | 464 std::set<std::string> registered_object_paths_; |
458 std::set<std::pair<DBusHandleMessageFunction, void*> > | 465 std::set<std::pair<DBusHandleMessageFunction, void*> > |
459 filter_functions_added_; | 466 filter_functions_added_; |
460 | 467 |
461 // ObjectProxyTable is used to hold the object proxies created by the | 468 // ObjectProxyTable is used to hold the object proxies created by the |
462 // bus object. Key is a concatenated string of service name + object path, | 469 // bus object. Key is a pair; the first part is a concatenated string of |
463 // like "org.chromium.TestService/org/chromium/TestObject". | 470 // service name + object path, like |
464 typedef std::map<std::string, | 471 // "org.chromium.TestService/org/chromium/TestObject". |
| 472 // The second part is the ObjectProxy::Options for the proxy. |
| 473 typedef std::map<std::pair<std::string, int>, |
465 scoped_refptr<dbus::ObjectProxy> > ObjectProxyTable; | 474 scoped_refptr<dbus::ObjectProxy> > ObjectProxyTable; |
466 ObjectProxyTable object_proxy_table_; | 475 ObjectProxyTable object_proxy_table_; |
467 | 476 |
468 // ExportedObjectTable is used to hold the exported objects created by | 477 // ExportedObjectTable is used to hold the exported objects created by |
469 // the bus object. Key is a concatenated string of service name + | 478 // the bus object. Key is a concatenated string of service name + |
470 // object path, like "org.chromium.TestService/org/chromium/TestObject". | 479 // object path, like "org.chromium.TestService/org/chromium/TestObject". |
471 typedef std::map<std::string, | 480 typedef std::map<std::string, |
472 scoped_refptr<dbus::ExportedObject> > ExportedObjectTable; | 481 scoped_refptr<dbus::ExportedObject> > ExportedObjectTable; |
473 ExportedObjectTable exported_object_table_; | 482 ExportedObjectTable exported_object_table_; |
474 | 483 |
475 bool async_operations_set_up_; | 484 bool async_operations_set_up_; |
476 bool shutdown_completed_; | 485 bool shutdown_completed_; |
477 | 486 |
478 // Counters to make sure that OnAddWatch()/OnRemoveWatch() and | 487 // Counters to make sure that OnAddWatch()/OnRemoveWatch() and |
479 // OnAddTimeout()/OnRemoveTimeou() are balanced. | 488 // OnAddTimeout()/OnRemoveTimeou() are balanced. |
480 int num_pending_watches_; | 489 int num_pending_watches_; |
481 int num_pending_timeouts_; | 490 int num_pending_timeouts_; |
482 | 491 |
483 DISALLOW_COPY_AND_ASSIGN(Bus); | 492 DISALLOW_COPY_AND_ASSIGN(Bus); |
484 }; | 493 }; |
485 | 494 |
486 } // namespace dbus | 495 } // namespace dbus |
487 | 496 |
488 #endif // DBUS_BUS_H_ | 497 #endif // DBUS_BUS_H_ |
OLD | NEW |