Chromium Code Reviews| Index: dbus/bus.cc |
| =================================================================== |
| --- dbus/bus.cc (revision 99574) |
| +++ dbus/bus.cc (working copy) |
| @@ -11,6 +11,7 @@ |
| #include "base/bind.h" |
| #include "base/logging.h" |
| #include "base/message_loop.h" |
| +#include "base/message_loop_proxy.h" |
| #include "base/stl_util.h" |
| #include "base/threading/thread.h" |
| #include "base/threading/thread_restrictions.h" |
| @@ -168,8 +169,7 @@ |
| Bus::Options::Options() |
| : bus_type(SESSION), |
| - connection_type(PRIVATE), |
| - dbus_thread(NULL) { |
| + connection_type(PRIVATE) { |
| } |
| Bus::Options::~Options() { |
| @@ -183,20 +183,10 @@ |
| connection_(NULL), |
| origin_loop_(MessageLoop::current()), |
| origin_thread_id_(base::PlatformThread::CurrentId()), |
| - dbus_thread_id_(base::kInvalidThreadId), |
| async_operations_set_up_(false), |
| shutdown_completed_(false), |
| num_pending_watches_(0), |
| num_pending_timeouts_(0) { |
| - if (dbus_thread_) { |
|
Mike Mammarella
2011/09/04 19:23:52
These DCHECKs are the only thing really "lost" in
satorux1
2011/09/06 17:15:57
Never mind. The program will fail soon, if the mes
|
| - dbus_thread_id_ = dbus_thread_->thread_id(); |
| - DCHECK(dbus_thread_->IsRunning()) |
| - << "The D-Bus thread should be running"; |
| - DCHECK_EQ(MessageLoop::TYPE_IO, |
| - dbus_thread_->message_loop()->type()) |
| - << "The D-Bus thread should have an MessageLoopForIO attached"; |
| - } |
| - |
| // This is safe to call multiple times. |
| dbus_threads_init_default(); |
| } |
| @@ -577,7 +567,7 @@ |
| void Bus::PostTaskToDBusThread(const tracked_objects::Location& from_here, |
| const base::Closure& task) { |
| if (dbus_thread_) |
| - dbus_thread_->message_loop()->PostTask(from_here, task); |
| + dbus_thread_->PostTask(from_here, task); |
| else |
| origin_loop_->PostTask(from_here, task); |
| } |
| @@ -587,7 +577,7 @@ |
| const base::Closure& task, |
| int delay_ms) { |
| if (dbus_thread_) |
| - dbus_thread_->message_loop()->PostDelayedTask(from_here, task, delay_ms); |
| + dbus_thread_->PostDelayedTask(from_here, task, delay_ms); |
| else |
| origin_loop_->PostDelayedTask(from_here, task, delay_ms); |
| } |
| @@ -604,7 +594,7 @@ |
| base::ThreadRestrictions::AssertIOAllowed(); |
| if (dbus_thread_) { |
| - DCHECK_EQ(dbus_thread_id_, base::PlatformThread::CurrentId()); |
| + DCHECK(dbus_thread_->BelongsToCurrentThread()); |
| } else { |
| AssertOnOriginThread(); |
| } |