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

Unified Diff: dbus/object_proxy.cc

Issue 563763004: Add ObjectProxy::CallMethodAndBlockWithErrorDetails methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed review comment Created 6 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dbus/object_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/object_proxy.cc
diff --git a/dbus/object_proxy.cc b/dbus/object_proxy.cc
index 016425dd50b7c5bd702e0d539bbb6fe1379de1c3..59584f2ce34fa750783b378d2f84f48485ebfdfc 100644
--- a/dbus/object_proxy.cc
+++ b/dbus/object_proxy.cc
@@ -66,8 +66,8 @@ ObjectProxy::~ObjectProxy() {
// Originally we tried to make |method_call| a const reference, but we
// gave up as dbus_connection_send_with_reply_and_block() takes a
// non-const pointer of DBusMessage as the second parameter.
-scoped_ptr<Response> ObjectProxy::CallMethodAndBlock(MethodCall* method_call,
- int timeout_ms) {
+scoped_ptr<Response> ObjectProxy::CallMethodAndBlockWithErrorDetails(
+ MethodCall* method_call, int timeout_ms, ScopedDBusError* error) {
bus_->AssertOnDBusThread();
if (!bus_->Connect() ||
@@ -77,12 +77,10 @@ scoped_ptr<Response> ObjectProxy::CallMethodAndBlock(MethodCall* method_call,
DBusMessage* request_message = method_call->raw_message();
- ScopedDBusError error;
-
// Send the message synchronously.
const base::TimeTicks start_time = base::TimeTicks::Now();
DBusMessage* response_message =
- bus_->SendWithReplyAndBlock(request_message, timeout_ms, error.get());
+ bus_->SendWithReplyAndBlock(request_message, timeout_ms, error->get());
// Record if the method call is successful, or not. 1 if successful.
UMA_HISTOGRAM_ENUMERATION("DBus.SyncMethodCallSuccess",
response_message ? 1 : 0,
@@ -94,8 +92,8 @@ scoped_ptr<Response> ObjectProxy::CallMethodAndBlock(MethodCall* method_call,
if (!response_message) {
LogMethodCallFailure(method_call->GetInterface(),
method_call->GetMember(),
- error.is_set() ? error.name() : "unknown error type",
- error.is_set() ? error.message() : "");
+ error->is_set() ? error->name() : "unknown error type",
+ error->is_set() ? error->message() : "");
return scoped_ptr<Response>();
}
// Record time spent for the method call. Don't include failures.
@@ -105,6 +103,12 @@ scoped_ptr<Response> ObjectProxy::CallMethodAndBlock(MethodCall* method_call,
return Response::FromRawMessage(response_message);
}
+scoped_ptr<Response> ObjectProxy::CallMethodAndBlock(MethodCall* method_call,
+ int timeout_ms) {
+ ScopedDBusError error;
+ return CallMethodAndBlockWithErrorDetails(method_call, timeout_ms, &error);
+}
+
void ObjectProxy::CallMethod(MethodCall* method_call,
int timeout_ms,
ResponseCallback callback) {
« no previous file with comments | « dbus/object_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698