| Index: dbus/bus.cc
|
| ===================================================================
|
| --- dbus/bus.cc (revision 183314)
|
| +++ dbus/bus.cc (working copy)
|
| @@ -13,7 +13,6 @@
|
| #include "base/threading/thread_restrictions.h"
|
| #include "base/time.h"
|
| #include "dbus/exported_object.h"
|
| -#include "dbus/object_path.h"
|
| #include "dbus/object_proxy.h"
|
| #include "dbus/scoped_dbus_error.h"
|
|
|
| @@ -30,7 +29,7 @@
|
| // communication.
|
| class Watch : public base::MessagePumpLibevent::Watcher {
|
| public:
|
| - Watch(DBusWatch* watch)
|
| + explicit Watch(DBusWatch* watch)
|
| : raw_watch_(watch) {
|
| dbus_watch_set_data(raw_watch_, this, NULL);
|
| }
|
| @@ -101,7 +100,7 @@
|
| // Bus::OnRemoveTimeout().
|
| class Timeout : public base::RefCountedThreadSafe<Timeout> {
|
| public:
|
| - Timeout(DBusTimeout* timeout)
|
| + explicit Timeout(DBusTimeout* timeout)
|
| : raw_timeout_(timeout),
|
| monitoring_is_active_(false),
|
| is_completed(false) {
|
| @@ -181,7 +180,7 @@
|
| Bus::Bus(const Options& options)
|
| : bus_type_(options.bus_type),
|
| connection_type_(options.connection_type),
|
| - dbus_thread_message_loop_proxy_(options.dbus_thread_message_loop_proxy),
|
| + dbus_task_runner_(options.dbus_task_runner),
|
| on_shutdown_(false /* manual_reset */, false /* initially_signaled */),
|
| connection_(NULL),
|
| origin_thread_id_(base::PlatformThread::CurrentId()),
|
| @@ -196,7 +195,7 @@
|
| // The origin message loop is unnecessary if the client uses synchronous
|
| // functions only.
|
| if (MessageLoop::current())
|
| - origin_message_loop_proxy_ = MessageLoop::current()->message_loop_proxy();
|
| + origin_task_runner_ = MessageLoop::current()->message_loop_proxy();
|
| }
|
|
|
| Bus::~Bus() {
|
| @@ -308,12 +307,12 @@
|
|
|
| // Post the task to perform the final unregistration to the D-Bus thread.
|
| // Since the registration also happens on the D-Bus thread in
|
| - // TryRegisterObjectPath(), and the message loop proxy we post to is a
|
| - // MessageLoopProxy which inherits from SequencedTaskRunner, there is a
|
| - // guarantee that this will happen before any future registration call.
|
| - PostTaskToDBusThread(FROM_HERE, base::Bind(
|
| - &Bus::UnregisterExportedObjectInternal,
|
| - this, exported_object));
|
| + // TryRegisterObjectPath(), and the task runner we post to is a
|
| + // SequencedTaskRunner, there is a guarantee that this will happen before any
|
| + // future registration call.
|
| + PostTaskToDBusThread(FROM_HERE,
|
| + base::Bind(&Bus::UnregisterExportedObjectInternal,
|
| + this, exported_object));
|
| }
|
|
|
| void Bus::UnregisterExportedObjectInternal(
|
| @@ -438,7 +437,7 @@
|
|
|
| void Bus::ShutdownOnDBusThreadAndBlock() {
|
| AssertOnOriginThread();
|
| - DCHECK(dbus_thread_message_loop_proxy_.get());
|
| + DCHECK(dbus_task_runner_.get());
|
|
|
| PostTaskToDBusThread(FROM_HERE, base::Bind(
|
| &Bus::ShutdownOnDBusThreadAndBlockInternal,
|
| @@ -742,21 +741,21 @@
|
|
|
| void Bus::PostTaskToOriginThread(const tracked_objects::Location& from_here,
|
| const base::Closure& task) {
|
| - DCHECK(origin_message_loop_proxy_.get());
|
| - if (!origin_message_loop_proxy_->PostTask(from_here, task)) {
|
| + DCHECK(origin_task_runner_.get());
|
| + if (!origin_task_runner_->PostTask(from_here, task)) {
|
| LOG(WARNING) << "Failed to post a task to the origin message loop";
|
| }
|
| }
|
|
|
| void Bus::PostTaskToDBusThread(const tracked_objects::Location& from_here,
|
| const base::Closure& task) {
|
| - if (dbus_thread_message_loop_proxy_.get()) {
|
| - if (!dbus_thread_message_loop_proxy_->PostTask(from_here, task)) {
|
| + if (dbus_task_runner_.get()) {
|
| + if (!dbus_task_runner_->PostTask(from_here, task)) {
|
| LOG(WARNING) << "Failed to post a task to the D-Bus thread message loop";
|
| }
|
| } else {
|
| - DCHECK(origin_message_loop_proxy_.get());
|
| - if (!origin_message_loop_proxy_->PostTask(from_here, task)) {
|
| + DCHECK(origin_task_runner_.get());
|
| + if (!origin_task_runner_->PostTask(from_here, task)) {
|
| LOG(WARNING) << "Failed to post a task to the origin message loop";
|
| }
|
| }
|
| @@ -766,22 +765,21 @@
|
| const tracked_objects::Location& from_here,
|
| const base::Closure& task,
|
| base::TimeDelta delay) {
|
| - if (dbus_thread_message_loop_proxy_.get()) {
|
| - if (!dbus_thread_message_loop_proxy_->PostDelayedTask(
|
| + if (dbus_task_runner_.get()) {
|
| + if (!dbus_task_runner_->PostDelayedTask(
|
| from_here, task, delay)) {
|
| LOG(WARNING) << "Failed to post a task to the D-Bus thread message loop";
|
| }
|
| } else {
|
| - DCHECK(origin_message_loop_proxy_.get());
|
| - if (!origin_message_loop_proxy_->PostDelayedTask(
|
| - from_here, task, delay)) {
|
| + DCHECK(origin_task_runner_.get());
|
| + if (!origin_task_runner_->PostDelayedTask(from_here, task, delay)) {
|
| LOG(WARNING) << "Failed to post a task to the origin message loop";
|
| }
|
| }
|
| }
|
|
|
| bool Bus::HasDBusThread() {
|
| - return dbus_thread_message_loop_proxy_.get() != NULL;
|
| + return dbus_task_runner_.get() != NULL;
|
| }
|
|
|
| void Bus::AssertOnOriginThread() {
|
| @@ -791,8 +789,8 @@
|
| void Bus::AssertOnDBusThread() {
|
| base::ThreadRestrictions::AssertIOAllowed();
|
|
|
| - if (dbus_thread_message_loop_proxy_.get()) {
|
| - DCHECK(dbus_thread_message_loop_proxy_->BelongsToCurrentThread());
|
| + if (dbus_task_runner_.get()) {
|
| + DCHECK(dbus_task_runner_->RunsTasksOnCurrentThread());
|
| } else {
|
| AssertOnOriginThread();
|
| }
|
| @@ -928,9 +926,9 @@
|
| }
|
|
|
| DBusHandlerResult Bus::OnConnectionDisconnectedFilter(
|
| - DBusConnection *connection,
|
| - DBusMessage *message,
|
| - void *data) {
|
| + DBusConnection* connection,
|
| + DBusMessage* message,
|
| + void* data) {
|
| if (dbus_message_is_signal(message,
|
| DBUS_INTERFACE_LOCAL,
|
| kDisconnectedSignal)) {
|
|
|