| Index: net/log/net_log_util.cc
|
| diff --git a/net/log/net_log_util.cc b/net/log/net_log_util.cc
|
| index cc426455ccabc464e27c6d85e8f955e2910134b8..427749a1355d122d2bb54b6570481203c0172039 100644
|
| --- a/net/log/net_log_util.cc
|
| +++ b/net/log/net_log_util.cc
|
| @@ -11,6 +11,7 @@
|
|
|
| #include "base/bind.h"
|
| #include "base/logging.h"
|
| +#include "base/memory/ptr_util.h"
|
| #include "base/metrics/field_trial.h"
|
| #include "base/strings/string_number_conversions.h"
|
| #include "base/strings/string_split.h"
|
| @@ -264,7 +265,8 @@ std::unique_ptr<base::DictionaryValue> GetNetConstants() {
|
| // TODO(eroman): This is here for compatibility in loading new log files with
|
| // older builds of Chrome. Safe to remove this once M45 is on the stable
|
| // channel.
|
| - constants_dict->Set("logLevelType", new base::DictionaryValue());
|
| + constants_dict->Set("logLevelType",
|
| + base::MakeUnique<base::DictionaryValue>());
|
|
|
| // Information about the relationship between address family enums and
|
| // their symbolic names.
|
| @@ -303,19 +305,20 @@ std::unique_ptr<base::DictionaryValue> GetNetConstants() {
|
|
|
| // "clientInfo" key is required for some WriteToFileNetLogObserver log
|
| // readers. Provide a default empty value for compatibility.
|
| - constants_dict->Set("clientInfo", new base::DictionaryValue());
|
| + constants_dict->Set("clientInfo", base::MakeUnique<base::DictionaryValue>());
|
|
|
| // Add a list of active field experiments.
|
| {
|
| base::FieldTrial::ActiveGroups active_groups;
|
| base::FieldTrialList::GetActiveFieldTrialGroups(&active_groups);
|
| - base::ListValue* field_trial_groups = new base::ListValue();
|
| + auto field_trial_groups = base::MakeUnique<base::ListValue>();
|
| for (base::FieldTrial::ActiveGroups::const_iterator it =
|
| active_groups.begin();
|
| it != active_groups.end(); ++it) {
|
| field_trial_groups->AppendString(it->trial_name + ":" + it->group_name);
|
| }
|
| - constants_dict->Set("activeFieldTrialGroups", field_trial_groups);
|
| + constants_dict->Set("activeFieldTrialGroups",
|
| + std::move(field_trial_groups));
|
| }
|
|
|
| return constants_dict;
|
| @@ -349,14 +352,14 @@ NET_EXPORT std::unique_ptr<base::DictionaryValue> GetNetInfo(
|
| const ProxyRetryInfoMap& bad_proxies_map =
|
| context->proxy_service()->proxy_retry_info();
|
|
|
| - base::ListValue* list = new base::ListValue();
|
| + auto list = base::MakeUnique<base::ListValue>();
|
|
|
| for (ProxyRetryInfoMap::const_iterator it = bad_proxies_map.begin();
|
| it != bad_proxies_map.end(); ++it) {
|
| const std::string& proxy_uri = it->first;
|
| const ProxyRetryInfo& retry_info = it->second;
|
|
|
| - std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
| + auto dict = base::MakeUnique<base::DictionaryValue>();
|
| dict->SetString("proxy_uri", proxy_uri);
|
| dict->SetString("bad_until",
|
| NetLog::TickCountToString(retry_info.bad_until));
|
| @@ -364,7 +367,8 @@ NET_EXPORT std::unique_ptr<base::DictionaryValue> GetNetInfo(
|
| list->Append(std::move(dict));
|
| }
|
|
|
| - net_info_dict->Set(NetInfoSourceToString(NET_INFO_BAD_PROXIES), list);
|
| + net_info_dict->Set(NetInfoSourceToString(NET_INFO_BAD_PROXIES),
|
| + std::move(list));
|
| }
|
|
|
| if (info_sources & NET_INFO_HOST_RESOLVER) {
|
| @@ -372,13 +376,13 @@ NET_EXPORT std::unique_ptr<base::DictionaryValue> GetNetInfo(
|
| DCHECK(host_resolver);
|
| HostCache* cache = host_resolver->GetHostCache();
|
| if (cache) {
|
| - std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
| + auto dict = base::MakeUnique<base::DictionaryValue>();
|
| std::unique_ptr<base::Value> dns_config =
|
| host_resolver->GetDnsConfigAsValue();
|
| if (dns_config)
|
| dict->Set("dns_config", std::move(dns_config));
|
|
|
| - base::DictionaryValue* cache_info_dict = new base::DictionaryValue();
|
| + auto cache_info_dict = base::MakeUnique<base::DictionaryValue>();
|
|
|
| cache_info_dict->SetInteger("capacity",
|
| static_cast<int>(cache->max_entries()));
|
| @@ -386,7 +390,7 @@ NET_EXPORT std::unique_ptr<base::DictionaryValue> GetNetInfo(
|
|
|
| cache_info_dict->Set("entries",
|
| cache->GetAsListValue(/*include_staleness=*/true));
|
| - dict->Set("cache", cache_info_dict);
|
| + dict->Set("cache", std::move(cache_info_dict));
|
| net_info_dict->Set(NetInfoSourceToString(NET_INFO_HOST_RESOLVER),
|
| std::move(dict));
|
| }
|
| @@ -406,7 +410,7 @@ NET_EXPORT std::unique_ptr<base::DictionaryValue> GetNetInfo(
|
| }
|
|
|
| if (info_sources & NET_INFO_SPDY_STATUS) {
|
| - base::DictionaryValue* status_dict = new base::DictionaryValue();
|
| + auto status_dict = base::MakeUnique<base::DictionaryValue>();
|
|
|
| status_dict->SetBoolean("enable_http2",
|
| http_network_session->params().enable_http2);
|
| @@ -424,7 +428,7 @@ NET_EXPORT std::unique_ptr<base::DictionaryValue> GetNetInfo(
|
| }
|
|
|
| net_info_dict->Set(NetInfoSourceToString(NET_INFO_SPDY_STATUS),
|
| - status_dict);
|
| + std::move(status_dict));
|
| }
|
|
|
| if (info_sources & NET_INFO_ALT_SVC_MAPPINGS) {
|
| @@ -441,8 +445,8 @@ NET_EXPORT std::unique_ptr<base::DictionaryValue> GetNetInfo(
|
| }
|
|
|
| if (info_sources & NET_INFO_HTTP_CACHE) {
|
| - base::DictionaryValue* info_dict = new base::DictionaryValue();
|
| - base::DictionaryValue* stats_dict = new base::DictionaryValue();
|
| + auto info_dict = base::MakeUnique<base::DictionaryValue>();
|
| + auto stats_dict = base::MakeUnique<base::DictionaryValue>();
|
|
|
| disk_cache::Backend* disk_cache = GetDiskCacheBackend(context);
|
|
|
| @@ -455,9 +459,10 @@ NET_EXPORT std::unique_ptr<base::DictionaryValue> GetNetInfo(
|
| stats[i].second);
|
| }
|
| }
|
| - info_dict->Set("stats", stats_dict);
|
| + info_dict->Set("stats", std::move(stats_dict));
|
|
|
| - net_info_dict->Set(NetInfoSourceToString(NET_INFO_HTTP_CACHE), info_dict);
|
| + net_info_dict->Set(NetInfoSourceToString(NET_INFO_HTTP_CACHE),
|
| + std::move(info_dict));
|
| }
|
|
|
| if (info_sources & NET_INFO_SDCH) {
|
|
|