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

Unified Diff: dbus/object_proxy.cc

Issue 8536007: dbus: Add ObjectProxy::EmptyResponseCallback(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 9 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 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 1a3b7e04872b64801c9f4e5fbf65ad90a2007d06..d9a53d9a3aee69bc5fdd40248744e51a1c9981f5 100644
--- a/dbus/object_proxy.cc
+++ b/dbus/object_proxy.cc
@@ -29,6 +29,10 @@ std::string GetAbsoluteSignalName(
return interface_name + "." + signal_name;
}
+// An empty function used for ObjectProxy::EmptyResponseCallback().
+void EmptyResponseCallbackBody(dbus::Response* unused_response) {
+}
+
} // namespace
namespace dbus {
@@ -140,6 +144,11 @@ void ObjectProxy::Detach() {
}
}
+// static
+ObjectProxy::ResponseCallback ObjectProxy::EmptyResponseCallback() {
+ return base::Bind(&EmptyResponseCallbackBody);
+}
+
ObjectProxy::OnPendingCallIsCompleteData::OnPendingCallIsCompleteData(
ObjectProxy* in_object_proxy,
ResponseCallback in_response_callback,
@@ -212,7 +221,7 @@ void ObjectProxy::RunResponseCallback(ResponseCallback response_callback,
DBusMessage* response_message) {
bus_->AssertOnOriginThread();
- bool response_callback_called = false;
+ bool method_call_successful = false;
if (!response_message) {
// The response is not received.
response_callback.Run(NULL);
@@ -235,14 +244,14 @@ void ObjectProxy::RunResponseCallback(ResponseCallback response_callback,
dbus::Response::FromRawMessage(response_message));
// The response is successfully received.
response_callback.Run(response.get());
- response_callback_called = true;
+ method_call_successful = true;
// Record time spent for the method call. Don't include failures.
UMA_HISTOGRAM_TIMES("DBus.AsyncMethodCallTime",
base::TimeTicks::Now() - start_time);
}
// Record if the method call is successful, or not. 1 if successful.
UMA_HISTOGRAM_ENUMERATION("DBus.AsyncMethodCallSuccess",
- response_callback_called,
+ method_call_successful,
kSuccessRatioHistogramMaxValue);
}
« 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