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

Unified Diff: net/http/http_server_properties_manager.cc

Issue 2884933002: Remove raw base::DictionaryValue::SetWithoutPathExpansion (Closed)
Patch Set: Include 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 | « ipc/ipc_message_utils_unittest.cc ('k') | net/http/http_server_properties_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_server_properties_manager.cc
diff --git a/net/http/http_server_properties_manager.cc b/net/http/http_server_properties_manager.cc
index f927874e489ab48d7fde1305362de816c20491b0..cf3e08cbba574377dcee57e94a145e1c4f9cb045 100644
--- a/net/http/http_server_properties_manager.cc
+++ b/net/http/http_server_properties_manager.cc
@@ -1013,7 +1013,7 @@ void HttpServerPropertiesManager::UpdatePrefsOnPrefThread(
// Persist properties to the prefs in the MRU order.
base::DictionaryValue http_server_properties_dict;
- base::ListValue* servers_list = new base::ListValue;
+ auto servers_list = base::MakeUnique<base::ListValue>();
for (ServerPrefMap::const_reverse_iterator map_it = server_pref_map.rbegin();
map_it != server_pref_map.rend(); ++map_it) {
const url::SchemeHostPort server = map_it->first;
@@ -1037,7 +1037,7 @@ void HttpServerPropertiesManager::UpdatePrefsOnPrefThread(
}
http_server_properties_dict.SetWithoutPathExpansion(kServersKey,
- servers_list);
+ std::move(servers_list));
SetVersion(&http_server_properties_dict, kVersionNumber);
SaveSupportsQuicToPrefs(last_quic_address, &http_server_properties_dict);
@@ -1088,8 +1088,8 @@ void HttpServerPropertiesManager::SaveAlternativeServiceToServerPrefs(
}
if (alternative_service_list->GetSize() == 0)
return;
- server_pref_dict->SetWithoutPathExpansion(kAlternativeServiceKey,
- alternative_service_list.release());
+ server_pref_dict->SetWithoutPathExpansion(
+ kAlternativeServiceKey, std::move(alternative_service_list));
}
void HttpServerPropertiesManager::SaveSupportsQuicToPrefs(
@@ -1098,11 +1098,11 @@ void HttpServerPropertiesManager::SaveSupportsQuicToPrefs(
if (!last_quic_address || !last_quic_address->IsValid())
return;
- base::DictionaryValue* supports_quic_dict = new base::DictionaryValue;
+ auto supports_quic_dict = base::MakeUnique<base::DictionaryValue>();
supports_quic_dict->SetBoolean(kUsedQuicKey, true);
supports_quic_dict->SetString(kAddressKey, last_quic_address->ToString());
- http_server_properties_dict->SetWithoutPathExpansion(kSupportsQuicKey,
- supports_quic_dict);
+ http_server_properties_dict->SetWithoutPathExpansion(
+ kSupportsQuicKey, std::move(supports_quic_dict));
}
void HttpServerPropertiesManager::SaveNetworkStatsToServerPrefs(
@@ -1111,14 +1111,14 @@ void HttpServerPropertiesManager::SaveNetworkStatsToServerPrefs(
if (!server_network_stats)
return;
- base::DictionaryValue* server_network_stats_dict = new base::DictionaryValue;
+ auto server_network_stats_dict = base::MakeUnique<base::DictionaryValue>();
// Becasue JSON doesn't support int64_t, persist int64_t as a string.
server_network_stats_dict->SetInteger(
kSrttKey, static_cast<int>(server_network_stats->srtt.ToInternalValue()));
// TODO(rtenneti): When QUIC starts using bandwidth_estimate, then persist
// bandwidth_estimate.
- server_pref_dict->SetWithoutPathExpansion(kNetworkStatsKey,
- server_network_stats_dict);
+ server_pref_dict->SetWithoutPathExpansion(
+ kNetworkStatsKey, std::move(server_network_stats_dict));
}
void HttpServerPropertiesManager::SaveQuicServerInfoMapToServerPrefs(
@@ -1127,18 +1127,18 @@ void HttpServerPropertiesManager::SaveQuicServerInfoMapToServerPrefs(
if (!quic_server_info_map)
return;
- base::DictionaryValue* quic_servers_dict = new base::DictionaryValue;
+ auto quic_servers_dict = base::MakeUnique<base::DictionaryValue>();
for (const std::pair<QuicServerId, std::string>& entry :
*quic_server_info_map) {
const QuicServerId& server_id = entry.first;
- base::DictionaryValue* quic_server_pref_dict = new base::DictionaryValue;
+ auto quic_server_pref_dict = base::MakeUnique<base::DictionaryValue>();
quic_server_pref_dict->SetStringWithoutPathExpansion(kServerInfoKey,
entry.second);
- quic_servers_dict->SetWithoutPathExpansion(server_id.ToString(),
- quic_server_pref_dict);
+ quic_servers_dict->SetWithoutPathExpansion(
+ server_id.ToString(), std::move(quic_server_pref_dict));
}
- http_server_properties_dict->SetWithoutPathExpansion(kQuicServers,
- quic_servers_dict);
+ http_server_properties_dict->SetWithoutPathExpansion(
+ kQuicServers, std::move(quic_servers_dict));
}
void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() {
« no previous file with comments | « ipc/ipc_message_utils_unittest.cc ('k') | net/http/http_server_properties_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698