OLD | NEW |
1 | 1 |
2 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #ifndef DBUS_BUS_H_ | 6 #ifndef DBUS_BUS_H_ |
7 #define DBUS_BUS_H_ | 7 #define DBUS_BUS_H_ |
8 #pragma once | 8 #pragma once |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // Functions that issue blocking calls are marked "BLOCKING CALL" and | 52 // Functions that issue blocking calls are marked "BLOCKING CALL" and |
53 // these functions should be called in the D-Bus thread (if | 53 // these functions should be called in the D-Bus thread (if |
54 // supplied). AssertOnDBusThread() is placed in these functions. | 54 // supplied). AssertOnDBusThread() is placed in these functions. |
55 // | 55 // |
56 // Note that it's hard to tell if a libdbus function is actually blocking | 56 // Note that it's hard to tell if a libdbus function is actually blocking |
57 // or not (ex. dbus_bus_request_name() internally calls | 57 // or not (ex. dbus_bus_request_name() internally calls |
58 // dbus_connection_send_with_reply_and_block(), which is a blocking | 58 // dbus_connection_send_with_reply_and_block(), which is a blocking |
59 // call). To err on the safe side, we consider all libdbus functions that | 59 // call). To err on the safe side, we consider all libdbus functions that |
60 // deal with the connection to dbus-damoen to be blocking. | 60 // deal with the connection to dbus-damoen to be blocking. |
61 // | 61 // |
| 62 // SHUTDOWN |
| 63 // |
| 64 // The Bus object must be shut down manually by Shutdown() or |
| 65 // ShutdownAndBlock(). We require the manual shutdown as we should not |
| 66 // issue blocking calls in the destructor. |
| 67 // |
62 // EXAMPLE USAGE: | 68 // EXAMPLE USAGE: |
63 // | 69 // |
64 // Synchronous method call: | 70 // Synchronous method call: |
65 // | 71 // |
66 // dbus::Bus::Options options; | 72 // dbus::Bus::Options options; |
67 // // Set up the bus options here. | 73 // // Set up the bus options here. |
68 // ... | 74 // ... |
69 // dbus::Bus bus(options); | 75 // dbus::Bus bus(options); |
70 // | 76 // |
71 // dbus::ObjectProxy* object_proxy = | 77 // dbus::ObjectProxy* object_proxy = |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 scoped_refptr<dbus::ObjectProxy> > ObjectProxyTable; | 447 scoped_refptr<dbus::ObjectProxy> > ObjectProxyTable; |
442 ObjectProxyTable object_proxy_table_; | 448 ObjectProxyTable object_proxy_table_; |
443 | 449 |
444 // ExportedObjectTable is used to hold the exported objects created by | 450 // ExportedObjectTable is used to hold the exported objects created by |
445 // the bus object. Key is a concatenated string of service name + | 451 // the bus object. Key is a concatenated string of service name + |
446 // object path, like "org.chromium.TestService/org/chromium/TestObject". | 452 // object path, like "org.chromium.TestService/org/chromium/TestObject". |
447 typedef std::map<std::string, | 453 typedef std::map<std::string, |
448 scoped_refptr<dbus::ExportedObject> > ExportedObjectTable; | 454 scoped_refptr<dbus::ExportedObject> > ExportedObjectTable; |
449 ExportedObjectTable exported_object_table_; | 455 ExportedObjectTable exported_object_table_; |
450 | 456 |
451 bool async_operations_are_set_up_; | 457 bool async_operations_set_up_; |
452 | 458 |
453 // Counters to make sure that OnAddWatch()/OnRemoveWatch() and | 459 // Counters to make sure that OnAddWatch()/OnRemoveWatch() and |
454 // OnAddTimeout()/OnRemoveTimeou() are balanced. | 460 // OnAddTimeout()/OnRemoveTimeou() are balanced. |
455 int num_pending_watches_; | 461 int num_pending_watches_; |
456 int num_pending_timeouts_; | 462 int num_pending_timeouts_; |
457 | 463 |
458 DISALLOW_COPY_AND_ASSIGN(Bus); | 464 DISALLOW_COPY_AND_ASSIGN(Bus); |
459 }; | 465 }; |
460 | 466 |
461 } // namespace dbus | 467 } // namespace dbus |
462 | 468 |
463 #endif // DBUS_BUS_H_ | 469 #endif // DBUS_BUS_H_ |
OLD | NEW |