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

Side by Side Diff: net/dns/host_resolver_impl.cc

Issue 15662008: Make net and ipc explicitly use the base namespace for Values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/dns/dns_transaction.cc ('k') | net/ftp/ftp_ctrl_response_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/dns/host_resolver_impl.h" 5 #include "net/dns/host_resolver_impl.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <Winsock2.h> 8 #include <Winsock2.h>
9 #elif defined(OS_POSIX) 9 #elif defined(OS_POSIX)
10 #include <netdb.h> 10 #include <netdb.h>
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 } 268 }
269 } 269 }
270 return true; 270 return true;
271 } 271 }
272 272
273 // Creates NetLog parameters when the resolve failed. 273 // Creates NetLog parameters when the resolve failed.
274 base::Value* NetLogProcTaskFailedCallback(uint32 attempt_number, 274 base::Value* NetLogProcTaskFailedCallback(uint32 attempt_number,
275 int net_error, 275 int net_error,
276 int os_error, 276 int os_error,
277 NetLog::LogLevel /* log_level */) { 277 NetLog::LogLevel /* log_level */) {
278 DictionaryValue* dict = new DictionaryValue(); 278 base::DictionaryValue* dict = new base::DictionaryValue();
279 if (attempt_number) 279 if (attempt_number)
280 dict->SetInteger("attempt_number", attempt_number); 280 dict->SetInteger("attempt_number", attempt_number);
281 281
282 dict->SetInteger("net_error", net_error); 282 dict->SetInteger("net_error", net_error);
283 283
284 if (os_error) { 284 if (os_error) {
285 dict->SetInteger("os_error", os_error); 285 dict->SetInteger("os_error", os_error);
286 #if defined(OS_POSIX) 286 #if defined(OS_POSIX)
287 dict->SetString("os_error_string", gai_strerror(os_error)); 287 dict->SetString("os_error_string", gai_strerror(os_error));
288 #elif defined(OS_WIN) 288 #elif defined(OS_WIN)
(...skipping 12 matching lines...) Expand all
301 #endif 301 #endif
302 } 302 }
303 303
304 return dict; 304 return dict;
305 } 305 }
306 306
307 // Creates NetLog parameters when the DnsTask failed. 307 // Creates NetLog parameters when the DnsTask failed.
308 base::Value* NetLogDnsTaskFailedCallback(int net_error, 308 base::Value* NetLogDnsTaskFailedCallback(int net_error,
309 int dns_error, 309 int dns_error,
310 NetLog::LogLevel /* log_level */) { 310 NetLog::LogLevel /* log_level */) {
311 DictionaryValue* dict = new DictionaryValue(); 311 base::DictionaryValue* dict = new base::DictionaryValue();
312 dict->SetInteger("net_error", net_error); 312 dict->SetInteger("net_error", net_error);
313 if (dns_error) 313 if (dns_error)
314 dict->SetInteger("dns_error", dns_error); 314 dict->SetInteger("dns_error", dns_error);
315 return dict; 315 return dict;
316 }; 316 };
317 317
318 // Creates NetLog parameters containing the information in a RequestInfo object, 318 // Creates NetLog parameters containing the information in a RequestInfo object,
319 // along with the associated NetLog::Source. 319 // along with the associated NetLog::Source.
320 base::Value* NetLogRequestInfoCallback(const NetLog::Source& source, 320 base::Value* NetLogRequestInfoCallback(const NetLog::Source& source,
321 const HostResolver::RequestInfo* info, 321 const HostResolver::RequestInfo* info,
322 NetLog::LogLevel /* log_level */) { 322 NetLog::LogLevel /* log_level */) {
323 DictionaryValue* dict = new DictionaryValue(); 323 base::DictionaryValue* dict = new base::DictionaryValue();
324 source.AddToEventParameters(dict); 324 source.AddToEventParameters(dict);
325 325
326 dict->SetString("host", info->host_port_pair().ToString()); 326 dict->SetString("host", info->host_port_pair().ToString());
327 dict->SetInteger("address_family", 327 dict->SetInteger("address_family",
328 static_cast<int>(info->address_family())); 328 static_cast<int>(info->address_family()));
329 dict->SetBoolean("allow_cached_response", info->allow_cached_response()); 329 dict->SetBoolean("allow_cached_response", info->allow_cached_response());
330 dict->SetBoolean("is_speculative", info->is_speculative()); 330 dict->SetBoolean("is_speculative", info->is_speculative());
331 dict->SetInteger("priority", info->priority()); 331 dict->SetInteger("priority", info->priority());
332 return dict; 332 return dict;
333 } 333 }
334 334
335 // Creates NetLog parameters for the creation of a HostResolverImpl::Job. 335 // Creates NetLog parameters for the creation of a HostResolverImpl::Job.
336 base::Value* NetLogJobCreationCallback(const NetLog::Source& source, 336 base::Value* NetLogJobCreationCallback(const NetLog::Source& source,
337 const std::string* host, 337 const std::string* host,
338 NetLog::LogLevel /* log_level */) { 338 NetLog::LogLevel /* log_level */) {
339 DictionaryValue* dict = new DictionaryValue(); 339 base::DictionaryValue* dict = new base::DictionaryValue();
340 source.AddToEventParameters(dict); 340 source.AddToEventParameters(dict);
341 dict->SetString("host", *host); 341 dict->SetString("host", *host);
342 return dict; 342 return dict;
343 } 343 }
344 344
345 // Creates NetLog parameters for HOST_RESOLVER_IMPL_JOB_ATTACH/DETACH events. 345 // Creates NetLog parameters for HOST_RESOLVER_IMPL_JOB_ATTACH/DETACH events.
346 base::Value* NetLogJobAttachCallback(const NetLog::Source& source, 346 base::Value* NetLogJobAttachCallback(const NetLog::Source& source,
347 RequestPriority priority, 347 RequestPriority priority,
348 NetLog::LogLevel /* log_level */) { 348 NetLog::LogLevel /* log_level */) {
349 DictionaryValue* dict = new DictionaryValue(); 349 base::DictionaryValue* dict = new base::DictionaryValue();
350 source.AddToEventParameters(dict); 350 source.AddToEventParameters(dict);
351 dict->SetInteger("priority", priority); 351 dict->SetInteger("priority", priority);
352 return dict; 352 return dict;
353 } 353 }
354 354
355 // Creates NetLog parameters for the DNS_CONFIG_CHANGED event. 355 // Creates NetLog parameters for the DNS_CONFIG_CHANGED event.
356 base::Value* NetLogDnsConfigCallback(const DnsConfig* config, 356 base::Value* NetLogDnsConfigCallback(const DnsConfig* config,
357 NetLog::LogLevel /* log_level */) { 357 NetLog::LogLevel /* log_level */) {
358 return config->ToValue(); 358 return config->ToValue();
359 } 359 }
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 1911
1912 base::Value* HostResolverImpl::GetDnsConfigAsValue() const { 1912 base::Value* HostResolverImpl::GetDnsConfigAsValue() const {
1913 // Check if async DNS is disabled. 1913 // Check if async DNS is disabled.
1914 if (!dns_client_.get()) 1914 if (!dns_client_.get())
1915 return NULL; 1915 return NULL;
1916 1916
1917 // Check if async DNS is enabled, but we currently have no configuration 1917 // Check if async DNS is enabled, but we currently have no configuration
1918 // for it. 1918 // for it.
1919 const DnsConfig* dns_config = dns_client_->GetConfig(); 1919 const DnsConfig* dns_config = dns_client_->GetConfig();
1920 if (dns_config == NULL) 1920 if (dns_config == NULL)
1921 return new DictionaryValue(); 1921 return new base::DictionaryValue();
1922 1922
1923 return dns_config->ToValue(); 1923 return dns_config->ToValue();
1924 } 1924 }
1925 1925
1926 bool HostResolverImpl::ResolveAsIP(const Key& key, 1926 bool HostResolverImpl::ResolveAsIP(const Key& key,
1927 const RequestInfo& info, 1927 const RequestInfo& info,
1928 int* net_error, 1928 int* net_error,
1929 AddressList* addresses) { 1929 AddressList* addresses) {
1930 DCHECK(addresses); 1930 DCHECK(addresses);
1931 DCHECK(net_error); 1931 DCHECK(net_error);
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 } 2238 }
2239 DnsConfig dns_config; 2239 DnsConfig dns_config;
2240 NetworkChangeNotifier::GetDnsConfig(&dns_config); 2240 NetworkChangeNotifier::GetDnsConfig(&dns_config);
2241 dns_client_->SetConfig(dns_config); 2241 dns_client_->SetConfig(dns_config);
2242 num_dns_failures_ = 0; 2242 num_dns_failures_ = 0;
2243 if (dns_config.IsValid()) 2243 if (dns_config.IsValid())
2244 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); 2244 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true);
2245 } 2245 }
2246 2246
2247 } // namespace net 2247 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/dns_transaction.cc ('k') | net/ftp/ftp_ctrl_response_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698