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

Unified Diff: chromeos/dbus/shill_client_helper.cc

Issue 11367048: This is the first pass at making GetIPConfigs asynchronous. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
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 side-by-side diff with in-line comments
Download patch
Index: chromeos/dbus/shill_client_helper.cc
diff --git a/chromeos/dbus/shill_client_helper.cc b/chromeos/dbus/shill_client_helper.cc
index f6d0fdce4e394b1af18eb16e3173eb58f764a678..11d965d297414a49e00a8c3f0864a09017b7bb3f 100644
--- a/chromeos/dbus/shill_client_helper.cc
+++ b/chromeos/dbus/shill_client_helper.cc
@@ -277,19 +277,22 @@ void ShillClientHelper::OnDictionaryValueMethod(
const DictionaryValueCallback& callback,
dbus::Response* response) {
if (!response) {
- base::DictionaryValue result;
- callback.Run(DBUS_METHOD_CALL_FAILURE, result);
+ scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue);
+ callback.Run(DBUS_METHOD_CALL_FAILURE, result.Pass());
return;
}
dbus::MessageReader reader(response);
- scoped_ptr<base::Value> value(dbus::PopDataAsValue(&reader));
+ base::Value* value = dbus::PopDataAsValue(&reader);
base::DictionaryValue* result = NULL;
- if (!value.get() || !value->GetAsDictionary(&result)) {
- base::DictionaryValue result;
- callback.Run(DBUS_METHOD_CALL_FAILURE, result);
+ if (!value || !value->GetAsDictionary(&result)) {
+ delete value;
+ scoped_ptr<base::DictionaryValue> empty_ptr(new base::DictionaryValue);
+ callback.Run(DBUS_METHOD_CALL_FAILURE, empty_ptr.Pass());
return;
}
- callback.Run(DBUS_METHOD_CALL_SUCCESS, *result);
+
+ scoped_ptr<base::DictionaryValue> result_ptr(result);
+ callback.Run(DBUS_METHOD_CALL_SUCCESS, result_ptr.Pass());
}
void ShillClientHelper::OnVoidMethodWithErrorCallback(
@@ -303,13 +306,15 @@ void ShillClientHelper::OnDictionaryValueMethodWithErrorCallback(
const ErrorCallback& error_callback,
dbus::Response* response) {
dbus::MessageReader reader(response);
- scoped_ptr<base::Value> value(dbus::PopDataAsValue(&reader));
+ base::Value* value(dbus::PopDataAsValue(&reader));
base::DictionaryValue* result = NULL;
- if (!value.get() || !value->GetAsDictionary(&result)) {
+ if (!value || !value->GetAsDictionary(&result)) {
+ delete value;
error_callback.Run(kInvalidResponseErrorName, kInvalidResponseErrorMessage);
return;
}
- callback.Run(*result);
+ scoped_ptr<base::DictionaryValue> result_ptr(result);
+ callback.Run(result_ptr.Pass());
}
void ShillClientHelper::OnError(const ErrorCallback& error_callback,

Powered by Google App Engine
This is Rietveld 408576698