OLD | NEW |
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_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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 // The bus will own all exported objects created by the bus, to ensure | 219 // The bus will own all exported objects created by the bus, to ensure |
220 // that the exported objects are unregistered at the shutdown time of | 220 // that the exported objects are unregistered at the shutdown time of |
221 // the bus. | 221 // the bus. |
222 // | 222 // |
223 // The exported object is used to export methods of local objects, and | 223 // The exported object is used to export methods of local objects, and |
224 // send signal from them. | 224 // send signal from them. |
225 // | 225 // |
226 // Must be called in the origin thread. | 226 // Must be called in the origin thread. |
227 virtual ExportedObject* GetExportedObject(const ObjectPath& object_path); | 227 virtual ExportedObject* GetExportedObject(const ObjectPath& object_path); |
228 | 228 |
| 229 // Unregisters the exported object for the given object path |object_path|. |
| 230 // |
| 231 // Getting an exported object for the same object path after this call |
| 232 // will return a new object, method calls on any remaining copies of the |
| 233 // previous object will not be called. |
| 234 // |
| 235 // Must be called in the origin thread. |
| 236 virtual void UnregisterExportedObject(const ObjectPath& object_path); |
| 237 |
229 // Shuts down the bus and blocks until it's done. More specifically, this | 238 // Shuts down the bus and blocks until it's done. More specifically, this |
230 // function does the following: | 239 // function does the following: |
231 // | 240 // |
232 // - Unregisters the object paths | 241 // - Unregisters the object paths |
233 // - Releases the service names | 242 // - Releases the service names |
234 // - Closes the connection to dbus-daemon. | 243 // - Closes the connection to dbus-daemon. |
235 // | 244 // |
236 // BLOCKING CALL. | 245 // BLOCKING CALL. |
237 virtual void ShutdownAndBlock(); | 246 virtual void ShutdownAndBlock(); |
238 | 247 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 // Returns true if the bus is connected to D-Bus. | 422 // Returns true if the bus is connected to D-Bus. |
414 bool is_connected() { return connection_ != NULL; } | 423 bool is_connected() { return connection_ != NULL; } |
415 | 424 |
416 protected: | 425 protected: |
417 // This is protected, so we can define sub classes. | 426 // This is protected, so we can define sub classes. |
418 virtual ~Bus(); | 427 virtual ~Bus(); |
419 | 428 |
420 private: | 429 private: |
421 friend class base::RefCountedThreadSafe<Bus>; | 430 friend class base::RefCountedThreadSafe<Bus>; |
422 | 431 |
| 432 // Helper function used for UnregisterExportedObject(). |
| 433 void UnregisterExportedObjectInternal( |
| 434 scoped_refptr<dbus::ExportedObject> exported_object); |
| 435 |
423 // Helper function used for ShutdownOnDBusThreadAndBlock(). | 436 // Helper function used for ShutdownOnDBusThreadAndBlock(). |
424 void ShutdownOnDBusThreadAndBlockInternal(); | 437 void ShutdownOnDBusThreadAndBlockInternal(); |
425 | 438 |
426 // Helper function used for RequestOwnership(). | 439 // Helper function used for RequestOwnership(). |
427 void RequestOwnershipInternal(const std::string& service_name, | 440 void RequestOwnershipInternal(const std::string& service_name, |
428 OnOwnershipCallback on_ownership_callback); | 441 OnOwnershipCallback on_ownership_callback); |
429 | 442 |
430 // Called when the ownership request is completed. | 443 // Called when the ownership request is completed. |
431 void OnOwnership(OnOwnershipCallback on_ownership_callback, | 444 void OnOwnership(OnOwnershipCallback on_ownership_callback, |
432 const std::string& service_name, | 445 const std::string& service_name, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 // OnAddTimeout()/OnRemoveTimeou() are balanced. | 525 // OnAddTimeout()/OnRemoveTimeou() are balanced. |
513 int num_pending_watches_; | 526 int num_pending_watches_; |
514 int num_pending_timeouts_; | 527 int num_pending_timeouts_; |
515 | 528 |
516 DISALLOW_COPY_AND_ASSIGN(Bus); | 529 DISALLOW_COPY_AND_ASSIGN(Bus); |
517 }; | 530 }; |
518 | 531 |
519 } // namespace dbus | 532 } // namespace dbus |
520 | 533 |
521 #endif // DBUS_BUS_H_ | 534 #endif // DBUS_BUS_H_ |
OLD | NEW |