Chromium Code Reviews| 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 // BLOCKING CALL. Must be called in the origin thread. | |
|
satorux1
2012/03/13 18:27:25
On what thread this function is called? For instan
keybuk
2012/03/13 18:32:41
probably the UI thread ... alternate suggestions w
satorux1
2012/03/13 18:42:01
maybe:
1) add a callback parameter to UnregisterE
keybuk
2012/03/13 18:53:31
1) there's no place to call because the destructor
satorux1
2012/03/13 18:56:36
re 2, i meant to just post tasks to d-bus thread f
| |
| 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(), |completion| is | |
| 433 // the waitable event that allows the caller to block until complete. | |
| 434 void UnregisterExportedObjectInternal(const ObjectPath& object_path, | |
| 435 base::WaitableEvent* completion); | |
| 436 | |
| 423 // Helper function used for ShutdownOnDBusThreadAndBlock(). | 437 // Helper function used for ShutdownOnDBusThreadAndBlock(). |
| 424 void ShutdownOnDBusThreadAndBlockInternal(); | 438 void ShutdownOnDBusThreadAndBlockInternal(); |
| 425 | 439 |
| 426 // Helper function used for RequestOwnership(). | 440 // Helper function used for RequestOwnership(). |
| 427 void RequestOwnershipInternal(const std::string& service_name, | 441 void RequestOwnershipInternal(const std::string& service_name, |
| 428 OnOwnershipCallback on_ownership_callback); | 442 OnOwnershipCallback on_ownership_callback); |
| 429 | 443 |
| 430 // Called when the ownership request is completed. | 444 // Called when the ownership request is completed. |
| 431 void OnOwnership(OnOwnershipCallback on_ownership_callback, | 445 void OnOwnership(OnOwnershipCallback on_ownership_callback, |
| 432 const std::string& service_name, | 446 const std::string& service_name, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 // OnAddTimeout()/OnRemoveTimeou() are balanced. | 526 // OnAddTimeout()/OnRemoveTimeou() are balanced. |
| 513 int num_pending_watches_; | 527 int num_pending_watches_; |
| 514 int num_pending_timeouts_; | 528 int num_pending_timeouts_; |
| 515 | 529 |
| 516 DISALLOW_COPY_AND_ASSIGN(Bus); | 530 DISALLOW_COPY_AND_ASSIGN(Bus); |
| 517 }; | 531 }; |
| 518 | 532 |
| 519 } // namespace dbus | 533 } // namespace dbus |
| 520 | 534 |
| 521 #endif // DBUS_BUS_H_ | 535 #endif // DBUS_BUS_H_ |
| OLD | NEW |