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

Unified Diff: net/dns/host_resolver_impl.cc

Issue 1149763005: Change NetLog::ParametersCallback to return a scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments on ownership removed Created 5 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 | « net/dns/dns_transaction.cc ('k') | net/filter/filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/host_resolver_impl.cc
diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc
index 9c0a5bb943f3360c70b7b4a0fc0f24ffda4804cd..3a04df12f751c6d288f678c5dd6b671e44878321 100644
--- a/net/dns/host_resolver_impl.cc
+++ b/net/dns/host_resolver_impl.cc
@@ -312,12 +312,12 @@ bool IsAllIPv4Loopback(const AddressList& addresses) {
}
// Creates NetLog parameters when the resolve failed.
-base::Value* NetLogProcTaskFailedCallback(
+scoped_ptr<base::Value> NetLogProcTaskFailedCallback(
uint32 attempt_number,
int net_error,
int os_error,
NetLogCaptureMode /* capture_mode */) {
- base::DictionaryValue* dict = new base::DictionaryValue();
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
if (attempt_number)
dict->SetInteger("attempt_number", attempt_number);
@@ -342,67 +342,73 @@ base::Value* NetLogProcTaskFailedCallback(
#endif
}
- return dict;
+ return dict.Pass();
}
// Creates NetLog parameters when the DnsTask failed.
-base::Value* NetLogDnsTaskFailedCallback(int net_error,
- int dns_error,
- NetLogCaptureMode /* capture_mode */) {
- base::DictionaryValue* dict = new base::DictionaryValue();
+scoped_ptr<base::Value> NetLogDnsTaskFailedCallback(
+ int net_error,
+ int dns_error,
+ NetLogCaptureMode /* capture_mode */) {
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetInteger("net_error", net_error);
if (dns_error)
dict->SetInteger("dns_error", dns_error);
- return dict;
+ return dict.Pass();
};
// Creates NetLog parameters containing the information in a RequestInfo object,
// along with the associated NetLog::Source.
-base::Value* NetLogRequestInfoCallback(const HostResolver::RequestInfo* info,
- NetLogCaptureMode /* capture_mode */) {
- base::DictionaryValue* dict = new base::DictionaryValue();
+scoped_ptr<base::Value> NetLogRequestInfoCallback(
+ const HostResolver::RequestInfo* info,
+ NetLogCaptureMode /* capture_mode */) {
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString("host", info->host_port_pair().ToString());
dict->SetInteger("address_family",
static_cast<int>(info->address_family()));
dict->SetBoolean("allow_cached_response", info->allow_cached_response());
dict->SetBoolean("is_speculative", info->is_speculative());
- return dict;
+ return dict.Pass();
}
// Creates NetLog parameters for the creation of a HostResolverImpl::Job.
-base::Value* NetLogJobCreationCallback(const NetLog::Source& source,
- const std::string* host,
- NetLogCaptureMode /* capture_mode */) {
- base::DictionaryValue* dict = new base::DictionaryValue();
- source.AddToEventParameters(dict);
+scoped_ptr<base::Value> NetLogJobCreationCallback(
+ const NetLog::Source& source,
+ const std::string* host,
+ NetLogCaptureMode /* capture_mode */) {
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
+ source.AddToEventParameters(dict.get());
dict->SetString("host", *host);
- return dict;
+ return dict.Pass();
}
// Creates NetLog parameters for HOST_RESOLVER_IMPL_JOB_ATTACH/DETACH events.
-base::Value* NetLogJobAttachCallback(const NetLog::Source& source,
- RequestPriority priority,
- NetLogCaptureMode /* capture_mode */) {
- base::DictionaryValue* dict = new base::DictionaryValue();
- source.AddToEventParameters(dict);
+scoped_ptr<base::Value> NetLogJobAttachCallback(
+ const NetLog::Source& source,
+ RequestPriority priority,
+ NetLogCaptureMode /* capture_mode */) {
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
+ source.AddToEventParameters(dict.get());
dict->SetString("priority", RequestPriorityToString(priority));
- return dict;
+ return dict.Pass();
}
// Creates NetLog parameters for the DNS_CONFIG_CHANGED event.
-base::Value* NetLogDnsConfigCallback(const DnsConfig* config,
- NetLogCaptureMode /* capture_mode */) {
- return config->ToValue();
+scoped_ptr<base::Value> NetLogDnsConfigCallback(
+ const DnsConfig* config,
+ NetLogCaptureMode /* capture_mode */) {
+ return make_scoped_ptr(config->ToValue());
}
-base::Value* NetLogIPv6AvailableCallback(bool ipv6_available,
- bool cached,
- NetLogCaptureMode /* capture_mode */) {
- base::DictionaryValue* dict = new base::DictionaryValue();
+scoped_ptr<base::Value> NetLogIPv6AvailableCallback(
+ bool ipv6_available,
+ bool cached,
+ NetLogCaptureMode /* capture_mode */) {
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetBoolean("ipv6_available", ipv6_available);
dict->SetBoolean("cached", cached);
- return dict;
+ return dict.Pass();
}
// The logging routines are defined here because some requests are resolved
« no previous file with comments | « net/dns/dns_transaction.cc ('k') | net/filter/filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698