Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: dbus/bus.cc

Issue 11266020: dbus: Reuse is_set() function from ScopedDBusError API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | dbus/scoped_dbus_error.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // TODO(satorux): 5 // TODO(satorux):
6 // - Handle "disconnected" signal. 6 // - Handle "disconnected" signal.
7 7
8 #include "dbus/bus.h" 8 #include "dbus/bus.h"
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } else { 298 } else {
299 const DBusBusType dbus_bus_type = static_cast<DBusBusType>(bus_type_); 299 const DBusBusType dbus_bus_type = static_cast<DBusBusType>(bus_type_);
300 if (connection_type_ == PRIVATE) { 300 if (connection_type_ == PRIVATE) {
301 connection_ = dbus_bus_get_private(dbus_bus_type, error.get()); 301 connection_ = dbus_bus_get_private(dbus_bus_type, error.get());
302 } else { 302 } else {
303 connection_ = dbus_bus_get(dbus_bus_type, error.get()); 303 connection_ = dbus_bus_get(dbus_bus_type, error.get());
304 } 304 }
305 } 305 }
306 if (!connection_) { 306 if (!connection_) {
307 LOG(ERROR) << "Failed to connect to the bus: " 307 LOG(ERROR) << "Failed to connect to the bus: "
308 << (dbus_error_is_set(error.get()) ? error.message() : ""); 308 << (error.is_set() ? error.message() : "");
309 return false; 309 return false;
310 } 310 }
311 // We shouldn't exit on the disconnected signal. 311 // We shouldn't exit on the disconnected signal.
312 dbus_connection_set_exit_on_disconnect(connection_, false); 312 dbus_connection_set_exit_on_disconnect(connection_, false);
313 313
314 return true; 314 return true;
315 } 315 }
316 316
317 void Bus::ShutdownAndBlock() { 317 void Bus::ShutdownAndBlock() {
318 AssertOnDBusThread(); 318 AssertOnDBusThread();
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 return true; 422 return true;
423 } 423 }
424 424
425 ScopedDBusError error; 425 ScopedDBusError error;
426 const int result = dbus_bus_request_name(connection_, 426 const int result = dbus_bus_request_name(connection_,
427 service_name.c_str(), 427 service_name.c_str(),
428 DBUS_NAME_FLAG_DO_NOT_QUEUE, 428 DBUS_NAME_FLAG_DO_NOT_QUEUE,
429 error.get()); 429 error.get());
430 if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { 430 if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
431 LOG(ERROR) << "Failed to get the ownership of " << service_name << ": " 431 LOG(ERROR) << "Failed to get the ownership of " << service_name << ": "
432 << (dbus_error_is_set(error.get()) ? error.message() : ""); 432 << (error.is_set() ? error.message() : "");
433 return false; 433 return false;
434 } 434 }
435 owned_service_names_.insert(service_name); 435 owned_service_names_.insert(service_name);
436 return true; 436 return true;
437 } 437 }
438 438
439 bool Bus::ReleaseOwnership(const std::string& service_name) { 439 bool Bus::ReleaseOwnership(const std::string& service_name) {
440 DCHECK(connection_); 440 DCHECK(connection_);
441 // dbus_bus_request_name() is a blocking call. 441 // dbus_bus_request_name() is a blocking call.
442 AssertOnDBusThread(); 442 AssertOnDBusThread();
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 } 830 }
831 831
832 void Bus::OnDispatchStatusChangedThunk(DBusConnection* connection, 832 void Bus::OnDispatchStatusChangedThunk(DBusConnection* connection,
833 DBusDispatchStatus status, 833 DBusDispatchStatus status,
834 void* data) { 834 void* data) {
835 Bus* self = static_cast<Bus*>(data); 835 Bus* self = static_cast<Bus*>(data);
836 self->OnDispatchStatusChanged(connection, status); 836 self->OnDispatchStatusChanged(connection, status);
837 } 837 }
838 838
839 } // namespace dbus 839 } // namespace dbus
OLDNEW
« no previous file with comments | « no previous file | dbus/scoped_dbus_error.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698