Index: net/log/net_log_util.cc |
diff --git a/net/log/net_log_util.cc b/net/log/net_log_util.cc |
index 4170d1c2375debf90b30f0502161e3723d64a0af..fd9debf9adf8dc3d6cfcdcac8ee02b08d3657517 100644 |
--- a/net/log/net_log_util.cc |
+++ b/net/log/net_log_util.cc |
@@ -128,9 +128,9 @@ bool RequestCreatedBefore(const URLRequest* request1, |
// Returns a Value representing the state of a pre-existing URLRequest when |
// net-internals was opened. |
-base::Value* GetRequestStateAsValue(const net::URLRequest* request, |
- NetLogCaptureMode capture_mode) { |
- return request->GetStateAsValue().release(); |
+scoped_ptr<base::Value> GetRequestStateAsValue(const net::URLRequest* request, |
+ NetLogCaptureMode capture_mode) { |
+ return request->GetStateAsValue().Pass(); |
} |
} // namespace |
@@ -328,35 +328,37 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( |
if (info_sources & NET_INFO_PROXY_SETTINGS) { |
ProxyService* proxy_service = context->proxy_service(); |
- base::DictionaryValue* dict = new base::DictionaryValue(); |
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
if (proxy_service->fetched_config().is_valid()) |
dict->Set("original", proxy_service->fetched_config().ToValue()); |
if (proxy_service->config().is_valid()) |
dict->Set("effective", proxy_service->config().ToValue()); |
- net_info_dict->Set(NetInfoSourceToString(NET_INFO_PROXY_SETTINGS), dict); |
+ net_info_dict->Set(NetInfoSourceToString(NET_INFO_PROXY_SETTINGS), |
+ dict.get()); |
} |
if (info_sources & NET_INFO_BAD_PROXIES) { |
const ProxyRetryInfoMap& bad_proxies_map = |
context->proxy_service()->proxy_retry_info(); |
- base::ListValue* list = new base::ListValue(); |
+ scoped_ptr<base::ListValue> list(new 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; |
- base::DictionaryValue* dict = new base::DictionaryValue(); |
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
dict->SetString("proxy_uri", proxy_uri); |
dict->SetString("bad_until", |
NetLog::TickCountToString(retry_info.bad_until)); |
- list->Append(dict); |
+ list->Append(dict.Pass()); |
} |
- net_info_dict->Set(NetInfoSourceToString(NET_INFO_BAD_PROXIES), list); |
+ net_info_dict->Set(NetInfoSourceToString(NET_INFO_BAD_PROXIES), |
+ list.Pass()); |
} |
if (info_sources & NET_INFO_HOST_RESOLVER) { |
@@ -364,10 +366,10 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( |
DCHECK(host_resolver); |
HostCache* cache = host_resolver->GetHostCache(); |
if (cache) { |
- base::DictionaryValue* dict = new base::DictionaryValue(); |
- base::Value* dns_config = host_resolver->GetDnsConfigAsValue(); |
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
+ scoped_ptr<base::Value> dns_config(host_resolver->GetDnsConfigAsValue()); |
if (dns_config) |
- dict->Set("dns_config", dns_config); |
+ dict->Set("dns_config", dns_config.Pass()); |
dict->SetInteger( |
"default_address_family", |
@@ -378,14 +380,15 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( |
cache_info_dict->SetInteger("capacity", |
static_cast<int>(cache->max_entries())); |
- base::ListValue* entry_list = new base::ListValue(); |
+ scoped_ptr<base::ListValue> entry_list(new base::ListValue()); |
HostCache::EntryMap::Iterator it(cache->entries()); |
for (; it.HasNext(); it.Advance()) { |
const HostCache::Key& key = it.key(); |
const HostCache::Entry& entry = it.value(); |
- base::DictionaryValue* entry_dict = new base::DictionaryValue(); |
+ scoped_ptr<base::DictionaryValue> entry_dict( |
+ new base::DictionaryValue()); |
entry_dict->SetString("hostname", key.hostname); |
entry_dict->SetInteger("address_family", |
@@ -397,19 +400,20 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( |
entry_dict->SetInteger("error", entry.error); |
} else { |
// Append all of the resolved addresses. |
- base::ListValue* address_list = new base::ListValue(); |
+ scoped_ptr<base::ListValue> address_list(new base::ListValue()); |
for (size_t i = 0; i < entry.addrlist.size(); ++i) { |
address_list->AppendString(entry.addrlist[i].ToStringWithoutPort()); |
} |
- entry_dict->Set("addresses", address_list); |
+ entry_dict->Set("addresses", address_list.Pass()); |
} |
- entry_list->Append(entry_dict); |
+ entry_list->Append(entry_dict.Pass()); |
} |
- cache_info_dict->Set("entries", entry_list); |
+ cache_info_dict->Set("entries", entry_list.Pass()); |
dict->Set("cache", cache_info_dict); |
- net_info_dict->Set(NetInfoSourceToString(NET_INFO_HOST_RESOLVER), dict); |
+ net_info_dict->Set(NetInfoSourceToString(NET_INFO_HOST_RESOLVER), |
+ dict.get()); |
} |
} |
@@ -519,7 +523,7 @@ NET_EXPORT void CreateNetLogEntriesForActiveObjects( |
ScopedVector<NetLog::Entry> entries; |
for (const auto& request : requests) { |
NetLog::ParametersCallback callback = |
- base::Bind(&GetRequestStateAsValue, base::Unretained(request)); |
+ base::Bind(GetRequestStateAsValue, base::Unretained(request)); |
// Note that passing the hardcoded NetLogCaptureMode::Default() below is |
// fine, since GetRequestStateAsValue() ignores the capture mode. |