diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-27 07:26:34 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-27 07:26:34 +0000 |
commit | ea78b1e8f6004bab26387cdd2a6bff6ccf108de6 (patch) | |
tree | d0ff8009b98d1db53852c85e6ecec3c307b46db2 /dbus/bus.cc | |
parent | e2dcc6bf7ba98799e0e289505dd685889dd5ccb2 (diff) | |
download | chromium_src-ea78b1e8f6004bab26387cdd2a6bff6ccf108de6.zip chromium_src-ea78b1e8f6004bab26387cdd2a6bff6ccf108de6.tar.gz chromium_src-ea78b1e8f6004bab26387cdd2a6bff6ccf108de6.tar.bz2 |
Minor cleanups and improvements for the D-Bus library.
- Add mock_export_object.{cc,h} to dbus.gyp, which were missing.
- Add a comment about shutdown of Bus in bus.h.
- Update mock_unittest.cc to call ShutdownAndBlock().
- Replace DCHECKs with LOG(ERROR)s followed by early exit.
- Add virtual to SetUp() and TearDown() in tests.
- Renamed a member variable to make it clearer.
BUG=chromium:90036
TEST=dbus_unittests
Review URL: http://codereview.chromium.org/7745044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98560 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/bus.cc')
-rw-r--r-- | dbus/bus.cc | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/dbus/bus.cc b/dbus/bus.cc index a259bc0..550f390 100644 --- a/dbus/bus.cc +++ b/dbus/bus.cc @@ -182,7 +182,7 @@ Bus::Bus(const Options& options) origin_loop_(MessageLoop::current()), origin_thread_id_(base::PlatformThread::CurrentId()), dbus_thread_id_(base::kInvalidThreadId), - async_operations_are_set_up_(false), + async_operations_set_up_(false), num_pending_watches_(0), num_pending_timeouts_(0) { if (dbus_thread_) { @@ -370,7 +370,7 @@ bool Bus::SetUpAsyncOperations() { DCHECK(connection_); AssertOnDBusThread(); - if (async_operations_are_set_up_) + if (async_operations_set_up_) return true; // Process all the incoming data if any, so that OnDispatchStatus() will @@ -400,7 +400,7 @@ bool Bus::SetUpAsyncOperations() { this, NULL); - async_operations_are_set_up_ = true; + async_operations_set_up_ = true; return true; } @@ -500,9 +500,11 @@ bool Bus::TryRegisterObjectPath(const std::string& object_path, DCHECK(connection_); AssertOnDBusThread(); - DCHECK(registered_object_paths_.find(object_path) == - registered_object_paths_.end()) - << "Object path already registered: " << object_path; + if (registered_object_paths_.find(object_path) != + registered_object_paths_.end()) { + LOG(ERROR) << "Object path already registered: " << object_path; + return false; + } const bool success = dbus_connection_try_register_object_path( connection_, @@ -519,9 +521,12 @@ void Bus::UnregisterObjectPath(const std::string& object_path) { DCHECK(connection_); AssertOnDBusThread(); - DCHECK(registered_object_paths_.find(object_path) != - registered_object_paths_.end()) - << "Requested to unregister an unknown object path: " << object_path; + if (registered_object_paths_.find(object_path) == + registered_object_paths_.end()) { + LOG(ERROR) << "Requested to unregister an unknown object path: " + << object_path; + return; + } const bool success = dbus_connection_unregister_object_path( connection_, |