| 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 | 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 <utility> | 13 #include <utility> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/callback.h" | 16 #include "base/callback.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
| 19 #include "base/threading/platform_thread.h" | 19 #include "base/threading/platform_thread.h" |
| 20 #include "dbus/dbus_export.h" | 20 #include "dbus/dbus_export.h" |
| 21 #include "dbus/object_path.h" | 21 #include "dbus/object_path.h" |
| 22 | 22 |
| 23 namespace base { | 23 namespace base { |
| 24 class SequencedTaskRunner; | 24 class SequencedTaskRunner; |
| 25 class SingleThreadTaskRunner; | 25 class SingleThreadTaskRunner; |
| 26 class TaskRunner; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace tracked_objects { | 29 namespace tracked_objects { |
| 29 class Location; | 30 class Location; |
| 30 } | 31 } |
| 31 | 32 |
| 32 namespace dbus { | 33 namespace dbus { |
| 33 | 34 |
| 34 class ExportedObject; | 35 class ExportedObject; |
| 35 class ObjectManager; | 36 class ObjectManager; |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 virtual bool TryRegisterObjectPath(const ObjectPath& object_path, | 523 virtual bool TryRegisterObjectPath(const ObjectPath& object_path, |
| 523 const DBusObjectPathVTable* vtable, | 524 const DBusObjectPathVTable* vtable, |
| 524 void* user_data, | 525 void* user_data, |
| 525 DBusError* error); | 526 DBusError* error); |
| 526 | 527 |
| 527 // Unregister the object path. | 528 // Unregister the object path. |
| 528 // | 529 // |
| 529 // BLOCKING CALL. | 530 // BLOCKING CALL. |
| 530 virtual void UnregisterObjectPath(const ObjectPath& object_path); | 531 virtual void UnregisterObjectPath(const ObjectPath& object_path); |
| 531 | 532 |
| 532 // Posts |task| to the task runner of the D-Bus thread. On completion, |reply| | 533 // Returns the task runner of the D-Bus thread. |
| 533 // is posted to the origin thread. | 534 virtual base::TaskRunner* GetDBusTaskRunner(); |
| 534 virtual void PostTaskToDBusThreadAndReply( | |
| 535 const tracked_objects::Location& from_here, | |
| 536 const base::Closure& task, | |
| 537 const base::Closure& reply); | |
| 538 | 535 |
| 539 // Posts the task to the task runner of the thread that created the bus. | 536 // Returns the task runner of the thread that created the bus. |
| 540 virtual void PostTaskToOriginThread( | 537 virtual base::TaskRunner* GetOriginTaskRunner(); |
| 541 const tracked_objects::Location& from_here, | |
| 542 const base::Closure& task); | |
| 543 | |
| 544 // Posts the task to the task runner of the D-Bus thread. If D-Bus | |
| 545 // thread is not supplied, the task runner of the origin thread will be | |
| 546 // used. | |
| 547 virtual void PostTaskToDBusThread( | |
| 548 const tracked_objects::Location& from_here, | |
| 549 const base::Closure& task); | |
| 550 | |
| 551 // Posts the delayed task to the task runner of the D-Bus thread. If | |
| 552 // D-Bus thread is not supplied, the task runner of the origin thread | |
| 553 // will be used. | |
| 554 virtual void PostDelayedTaskToDBusThread( | |
| 555 const tracked_objects::Location& from_here, | |
| 556 const base::Closure& task, | |
| 557 base::TimeDelta delay); | |
| 558 | 538 |
| 559 // Returns true if the bus has the D-Bus thread. | 539 // Returns true if the bus has the D-Bus thread. |
| 560 virtual bool HasDBusThread(); | 540 virtual bool HasDBusThread(); |
| 561 | 541 |
| 562 // Check whether the current thread is on the origin thread (the thread | 542 // Check whether the current thread is on the origin thread (the thread |
| 563 // that created the bus). If not, DCHECK will fail. | 543 // that created the bus). If not, DCHECK will fail. |
| 564 virtual void AssertOnOriginThread(); | 544 virtual void AssertOnOriginThread(); |
| 565 | 545 |
| 566 // Check whether the current thread is on the D-Bus thread. If not, | 546 // Check whether the current thread is on the D-Bus thread. If not, |
| 567 // DCHECK will fail. If the D-Bus thread is not supplied, it calls | 547 // DCHECK will fail. If the D-Bus thread is not supplied, it calls |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 | 744 |
| 765 std::string address_; | 745 std::string address_; |
| 766 base::Closure on_disconnected_closure_; | 746 base::Closure on_disconnected_closure_; |
| 767 | 747 |
| 768 DISALLOW_COPY_AND_ASSIGN(Bus); | 748 DISALLOW_COPY_AND_ASSIGN(Bus); |
| 769 }; | 749 }; |
| 770 | 750 |
| 771 } // namespace dbus | 751 } // namespace dbus |
| 772 | 752 |
| 773 #endif // DBUS_BUS_H_ | 753 #endif // DBUS_BUS_H_ |
| OLD | NEW |