Chromium Code Reviews| Index: dbus/bus.cc |
| diff --git a/dbus/bus.cc b/dbus/bus.cc |
| index 2be649e55931c558ed7e98a1a9428cc1b7c19658..40490466b6b91f271095fab8a87605666141d7c5 100644 |
| --- a/dbus/bus.cc |
| +++ b/dbus/bus.cc |
| @@ -501,21 +501,23 @@ void Bus::ShutdownOnDBusThreadAndBlock() { |
| } |
| void Bus::RequestOwnership(const std::string& service_name, |
| + ServiceOwnershipOptions options, |
| OnOwnershipCallback on_ownership_callback) { |
| AssertOnOriginThread(); |
| PostTaskToDBusThread(FROM_HERE, base::Bind( |
| &Bus::RequestOwnershipInternal, |
| - this, service_name, on_ownership_callback)); |
| + this, service_name, options, on_ownership_callback)); |
| } |
| void Bus::RequestOwnershipInternal(const std::string& service_name, |
| + ServiceOwnershipOptions options, |
| OnOwnershipCallback on_ownership_callback) { |
| AssertOnDBusThread(); |
| bool success = Connect(); |
| if (success) |
| - success = RequestOwnershipAndBlock(service_name); |
| + success = RequestOwnershipAndBlock(service_name, options); |
| PostTaskToOriginThread(FROM_HERE, |
| base::Bind(on_ownership_callback, |
| @@ -523,7 +525,8 @@ void Bus::RequestOwnershipInternal(const std::string& service_name, |
| success)); |
| } |
| -bool Bus::RequestOwnershipAndBlock(const std::string& service_name) { |
| +bool Bus::RequestOwnershipAndBlock(const std::string& service_name, |
| + ServiceOwnershipOptions options) { |
| DCHECK(connection_); |
| // dbus_bus_request_name() is a blocking call. |
| AssertOnDBusThread(); |
| @@ -536,7 +539,7 @@ bool Bus::RequestOwnershipAndBlock(const std::string& service_name) { |
| ScopedDBusError error; |
| const int result = dbus_bus_request_name(connection_, |
| service_name.c_str(), |
| - DBUS_NAME_FLAG_DO_NOT_QUEUE, |
| + options, |
| error.get()); |
| if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { |
| LOG(ERROR) << "Failed to get the ownership of " << service_name << ": " |
| @@ -567,8 +570,9 @@ bool Bus::ReleaseOwnership(const std::string& service_name) { |
| owned_service_names_.erase(found); |
| return true; |
| } else { |
| + std::string res_str = base::StringPrintf("%d", result); |
| LOG(ERROR) << "Failed to release the ownership of " << service_name << ": " |
| - << (error.is_set() ? error.message() : ""); |
| + << (error.is_set() ? error.message() : res_str); |
|
satorux1
2013/07/26 00:50:12
Maybe we should always print the error code:
LOG(
Chris Masone
2013/07/26 17:37:24
Done.
|
| return false; |
| } |
| } |