Convert callers of base::DeepCopy() to base::CreateDeepCopy() in //remoting
BUG=581865
R=kelvinp@chromium.org
Review-Url: https://codereview.chromium.org/1945443002
Cr-Commit-Position: refs/heads/master@{#391137}
diff --git a/remoting/host/it2me/it2me_native_messaging_host.cc b/remoting/host/it2me/it2me_native_messaging_host.cc
index 4d41d6a..fc7190c 100644
--- a/remoting/host/it2me/it2me_native_messaging_host.cc
+++ b/remoting/host/it2me/it2me_native_messaging_host.cc
@@ -87,7 +87,7 @@
// might be a string or a number, so cope with both.
const base::Value* id;
if (message_dict->Get("id", &id))
- response->Set("id", id->DeepCopy());
+ response->Set("id", id->CreateDeepCopy());
std::string type;
if (!message_dict->GetString("type", &type)) {
diff --git a/remoting/host/policy_watcher.cc b/remoting/host/policy_watcher.cc
index 9672729..ce590480 100644
--- a/remoting/host/policy_watcher.cc
+++ b/remoting/host/policy_watcher.cc
@@ -52,7 +52,7 @@
std::unique_ptr<base::DictionaryValue> CopyValuesAndAddDefaults(
const base::DictionaryValue& from,
const base::DictionaryValue& default_values) {
- std::unique_ptr<base::DictionaryValue> to(default_values.DeepCopy());
+ std::unique_ptr<base::DictionaryValue> to(default_values.CreateDeepCopy());
for (base::DictionaryValue::Iterator i(default_values); !i.IsAtEnd();
i.Advance()) {
const base::Value* value = nullptr;
@@ -63,7 +63,7 @@
}
CHECK(value->IsType(i.value().GetType()));
- to->Set(i.key(), value->DeepCopy());
+ to->Set(i.key(), value->CreateDeepCopy());
}
return to;
@@ -99,7 +99,7 @@
// TODO(lukasza): Removing this somewhat brittle filtering will be possible
// after having separate, Chromoting-specific schema.
if (key.find(kPolicyNameSubstring) != std::string::npos) {
- policy_dict->Set(key, value->DeepCopy());
+ policy_dict->Set(key, value->CreateDeepCopy());
}
}
@@ -243,7 +243,7 @@
std::string key) {
const base::Value* value;
if (from.Get(key, &value)) {
- to.Set(key, value->DeepCopy());
+ to.Set(key, value->CreateDeepCopy());
}
}
} // namespace
@@ -259,7 +259,7 @@
base::Value* old_policy;
if (!(old_policies_->Get(iter.key(), &old_policy) &&
old_policy->Equals(&iter.value()))) {
- changed_policies->Set(iter.key(), iter.value().DeepCopy());
+ changed_policies->Set(iter.key(), iter.value().CreateDeepCopy());
}
iter.Advance();
}
diff --git a/remoting/host/setup/me2me_native_messaging_host.cc b/remoting/host/setup/me2me_native_messaging_host.cc
index 7af0d13..2d9d811 100644
--- a/remoting/host/setup/me2me_native_messaging_host.cc
+++ b/remoting/host/setup/me2me_native_messaging_host.cc
@@ -63,7 +63,7 @@
std::unique_ptr<base::DictionaryValue> result;
const base::DictionaryValue* config_dict;
if (message->GetDictionary("config", &config_dict)) {
- result.reset(config_dict->DeepCopy());
+ result = config_dict->CreateDeepCopy();
} else {
LOG(ERROR) << "'config' dictionary not found";
}
@@ -127,7 +127,7 @@
// might be a string or a number, so cope with both.
const base::Value* id;
if (message_dict->Get("id", &id))
- response->Set("id", id->DeepCopy());
+ response->Set("id", id->CreateDeepCopy());
std::string type;
if (!message_dict->GetString("type", &type)) {
diff --git a/remoting/host/setup/me2me_native_messaging_host_unittest.cc b/remoting/host/setup/me2me_native_messaging_host_unittest.cc
index 09020da..f0317a16 100644
--- a/remoting/host/setup/me2me_native_messaging_host_unittest.cc
+++ b/remoting/host/setup/me2me_native_messaging_host_unittest.cc
@@ -498,14 +498,14 @@
// Following messages require a "config" dictionary.
base::DictionaryValue config;
config.SetBoolean("update", true);
- message.Set("config", config.DeepCopy());
+ message.Set("config", config.CreateDeepCopy());
message.SetInteger("id", next_id++);
message.SetString("type", "updateDaemonConfig");
WriteMessageToInputPipe(message);
config.Clear();
config.SetBoolean("start", true);
- message.Set("config", config.DeepCopy());
+ message.Set("config", config.CreateDeepCopy());
message.SetBoolean("consent", true);
message.SetInteger("id", next_id++);
message.SetString("type", "startDaemon");
@@ -625,7 +625,7 @@
TEST_F(Me2MeNativeMessagingHostTest, StartDaemonNoConsent) {
base::DictionaryValue message;
message.SetString("type", "startDaemon");
- message.Set("config", base::DictionaryValue().DeepCopy());
+ message.Set("config", base::DictionaryValue().CreateDeepCopy());
TestBadRequest(message);
}
diff --git a/remoting/signaling/chromoting_event.cc b/remoting/signaling/chromoting_event.cc
index 7b52c9be..a284fa3 100644
--- a/remoting/signaling/chromoting_event.cc
+++ b/remoting/signaling/chromoting_event.cc
@@ -25,7 +25,7 @@
ChromotingEvent::ChromotingEvent(const ChromotingEvent& other) {
try_count_ = other.try_count_;
- values_map_.reset(other.values_map_->DeepCopy());
+ values_map_ = other.values_map_->CreateDeepCopy();
}
ChromotingEvent::ChromotingEvent(ChromotingEvent&& other) {
@@ -38,7 +38,7 @@
ChromotingEvent& ChromotingEvent::operator=(const ChromotingEvent& other) {
if (this != &other) {
try_count_ = other.try_count_;
- values_map_.reset(other.values_map_->DeepCopy());
+ values_map_ = other.values_map_->CreateDeepCopy();
}
return *this;
}
@@ -94,7 +94,7 @@
std::unique_ptr<base::DictionaryValue> ChromotingEvent::CopyDictionaryValue()
const {
- return std::unique_ptr<base::DictionaryValue>(values_map_->DeepCopy());
+ return values_map_->CreateDeepCopy();
}
// static