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

Unified Diff: chromeos/dbus/fake_shill_ipconfig_client.cc

Issue 2871653002: Remove raw base::DictionaryValue::SetWithoutPathExpansion in //chromeos (Closed)
Patch Set: Minor Fix Created 3 years, 7 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 | « chromeos/dbus/fake_shill_device_client.cc ('k') | chromeos/dbus/fake_shill_manager_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/fake_shill_ipconfig_client.cc
diff --git a/chromeos/dbus/fake_shill_ipconfig_client.cc b/chromeos/dbus/fake_shill_ipconfig_client.cc
index 47ae343eb532c305cc63ec1b922219ed7c40c797..11deee66f429f683feb746e42f5f7b4aa942975c 100644
--- a/chromeos/dbus/fake_shill_ipconfig_client.cc
+++ b/chromeos/dbus/fake_shill_ipconfig_client.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/location.h"
+#include "base/memory/ptr_util.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -61,17 +62,13 @@ void FakeShillIPConfigClient::SetProperty(
const base::Value& value,
const VoidDBusMethodCallback& callback) {
base::DictionaryValue* dict = NULL;
- if (ipconfigs_.GetDictionaryWithoutPathExpansion(ipconfig_path.value(),
- &dict)) {
- // Update existing ip config stub object's properties.
- dict->SetWithoutPathExpansion(name, value.DeepCopy());
- } else {
- // Create a new stub ipconfig object, and update its properties.
- base::DictionaryValue* dvalue = new base::DictionaryValue;
- dvalue->SetWithoutPathExpansion(name, value.DeepCopy());
- ipconfigs_.SetWithoutPathExpansion(ipconfig_path.value(),
- dvalue);
+ if (!ipconfigs_.GetDictionaryWithoutPathExpansion(ipconfig_path.value(),
+ &dict)) {
+ dict = ipconfigs_.SetDictionaryWithoutPathExpansion(
+ ipconfig_path.value(), base::MakeUnique<base::DictionaryValue>());
}
+ // Update existing ip config stub object's properties.
+ dict->SetWithoutPathExpansion(name, base::MakeUnique<base::Value>(value));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS));
}
@@ -100,7 +97,8 @@ FakeShillIPConfigClient::GetTestInterface() {
void FakeShillIPConfigClient::AddIPConfig(
const std::string& ip_config_path,
const base::DictionaryValue& properties) {
- ipconfigs_.SetWithoutPathExpansion(ip_config_path, properties.DeepCopy());
+ ipconfigs_.SetWithoutPathExpansion(ip_config_path,
+ base::MakeUnique<base::Value>(properties));
}
// Private methods
« no previous file with comments | « chromeos/dbus/fake_shill_device_client.cc ('k') | chromeos/dbus/fake_shill_manager_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698