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

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

Issue 1059843002: Refactor NetLog::LogLevel --> NetLogCaptureMode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again to fix a merge conflict Created 5 years, 8 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
« no previous file with comments | « net/dns/dns_transaction.cc ('k') | net/filter/sdch_filter.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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 return false; 290 return false;
291 default: 291 default:
292 NOTREACHED(); 292 NOTREACHED();
293 return false; 293 return false;
294 } 294 }
295 } 295 }
296 return true; 296 return true;
297 } 297 }
298 298
299 // Creates NetLog parameters when the resolve failed. 299 // Creates NetLog parameters when the resolve failed.
300 base::Value* NetLogProcTaskFailedCallback(uint32 attempt_number, 300 base::Value* NetLogProcTaskFailedCallback(
301 int net_error, 301 uint32 attempt_number,
302 int os_error, 302 int net_error,
303 NetLog::LogLevel /* log_level */) { 303 int os_error,
304 NetLogCaptureMode /* capture_mode */) {
304 base::DictionaryValue* dict = new base::DictionaryValue(); 305 base::DictionaryValue* dict = new base::DictionaryValue();
305 if (attempt_number) 306 if (attempt_number)
306 dict->SetInteger("attempt_number", attempt_number); 307 dict->SetInteger("attempt_number", attempt_number);
307 308
308 dict->SetInteger("net_error", net_error); 309 dict->SetInteger("net_error", net_error);
309 310
310 if (os_error) { 311 if (os_error) {
311 dict->SetInteger("os_error", os_error); 312 dict->SetInteger("os_error", os_error);
312 #if defined(OS_POSIX) 313 #if defined(OS_POSIX)
313 dict->SetString("os_error_string", gai_strerror(os_error)); 314 dict->SetString("os_error_string", gai_strerror(os_error));
(...skipping 11 matching lines...) Expand all
325 LocalFree(error_string); 326 LocalFree(error_string);
326 #endif 327 #endif
327 } 328 }
328 329
329 return dict; 330 return dict;
330 } 331 }
331 332
332 // Creates NetLog parameters when the DnsTask failed. 333 // Creates NetLog parameters when the DnsTask failed.
333 base::Value* NetLogDnsTaskFailedCallback(int net_error, 334 base::Value* NetLogDnsTaskFailedCallback(int net_error,
334 int dns_error, 335 int dns_error,
335 NetLog::LogLevel /* log_level */) { 336 NetLogCaptureMode /* capture_mode */) {
336 base::DictionaryValue* dict = new base::DictionaryValue(); 337 base::DictionaryValue* dict = new base::DictionaryValue();
337 dict->SetInteger("net_error", net_error); 338 dict->SetInteger("net_error", net_error);
338 if (dns_error) 339 if (dns_error)
339 dict->SetInteger("dns_error", dns_error); 340 dict->SetInteger("dns_error", dns_error);
340 return dict; 341 return dict;
341 }; 342 };
342 343
343 // Creates NetLog parameters containing the information in a RequestInfo object, 344 // Creates NetLog parameters containing the information in a RequestInfo object,
344 // along with the associated NetLog::Source. 345 // along with the associated NetLog::Source.
345 base::Value* NetLogRequestInfoCallback(const HostResolver::RequestInfo* info, 346 base::Value* NetLogRequestInfoCallback(const HostResolver::RequestInfo* info,
346 NetLog::LogLevel /* log_level */) { 347 NetLogCaptureMode /* capture_mode */) {
347 base::DictionaryValue* dict = new base::DictionaryValue(); 348 base::DictionaryValue* dict = new base::DictionaryValue();
348 349
349 dict->SetString("host", info->host_port_pair().ToString()); 350 dict->SetString("host", info->host_port_pair().ToString());
350 dict->SetInteger("address_family", 351 dict->SetInteger("address_family",
351 static_cast<int>(info->address_family())); 352 static_cast<int>(info->address_family()));
352 dict->SetBoolean("allow_cached_response", info->allow_cached_response()); 353 dict->SetBoolean("allow_cached_response", info->allow_cached_response());
353 dict->SetBoolean("is_speculative", info->is_speculative()); 354 dict->SetBoolean("is_speculative", info->is_speculative());
354 return dict; 355 return dict;
355 } 356 }
356 357
357 // Creates NetLog parameters for the creation of a HostResolverImpl::Job. 358 // Creates NetLog parameters for the creation of a HostResolverImpl::Job.
358 base::Value* NetLogJobCreationCallback(const NetLog::Source& source, 359 base::Value* NetLogJobCreationCallback(const NetLog::Source& source,
359 const std::string* host, 360 const std::string* host,
360 NetLog::LogLevel /* log_level */) { 361 NetLogCaptureMode /* capture_mode */) {
361 base::DictionaryValue* dict = new base::DictionaryValue(); 362 base::DictionaryValue* dict = new base::DictionaryValue();
362 source.AddToEventParameters(dict); 363 source.AddToEventParameters(dict);
363 dict->SetString("host", *host); 364 dict->SetString("host", *host);
364 return dict; 365 return dict;
365 } 366 }
366 367
367 // Creates NetLog parameters for HOST_RESOLVER_IMPL_JOB_ATTACH/DETACH events. 368 // Creates NetLog parameters for HOST_RESOLVER_IMPL_JOB_ATTACH/DETACH events.
368 base::Value* NetLogJobAttachCallback(const NetLog::Source& source, 369 base::Value* NetLogJobAttachCallback(const NetLog::Source& source,
369 RequestPriority priority, 370 RequestPriority priority,
370 NetLog::LogLevel /* log_level */) { 371 NetLogCaptureMode /* capture_mode */) {
371 base::DictionaryValue* dict = new base::DictionaryValue(); 372 base::DictionaryValue* dict = new base::DictionaryValue();
372 source.AddToEventParameters(dict); 373 source.AddToEventParameters(dict);
373 dict->SetString("priority", RequestPriorityToString(priority)); 374 dict->SetString("priority", RequestPriorityToString(priority));
374 return dict; 375 return dict;
375 } 376 }
376 377
377 // Creates NetLog parameters for the DNS_CONFIG_CHANGED event. 378 // Creates NetLog parameters for the DNS_CONFIG_CHANGED event.
378 base::Value* NetLogDnsConfigCallback(const DnsConfig* config, 379 base::Value* NetLogDnsConfigCallback(const DnsConfig* config,
379 NetLog::LogLevel /* log_level */) { 380 NetLogCaptureMode /* capture_mode */) {
380 return config->ToValue(); 381 return config->ToValue();
381 } 382 }
382 383
383 // The logging routines are defined here because some requests are resolved 384 // The logging routines are defined here because some requests are resolved
384 // without a Request object. 385 // without a Request object.
385 386
386 // Logs when a request has just been started. 387 // Logs when a request has just been started.
387 void LogStartRequest(const BoundNetLog& source_net_log, 388 void LogStartRequest(const BoundNetLog& source_net_log,
388 const HostResolver::RequestInfo& info) { 389 const HostResolver::RequestInfo& info) {
389 source_net_log.BeginEvent( 390 source_net_log.BeginEvent(
(...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after
2391 dns_client_->SetConfig(dns_config); 2392 dns_client_->SetConfig(dns_config);
2392 num_dns_failures_ = 0; 2393 num_dns_failures_ = 0;
2393 if (dns_client_->GetConfig()) 2394 if (dns_client_->GetConfig())
2394 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); 2395 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true);
2395 } 2396 }
2396 2397
2397 AbortDnsTasks(); 2398 AbortDnsTasks();
2398 } 2399 }
2399 2400
2400 } // namespace net 2401 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/dns_transaction.cc ('k') | net/filter/sdch_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698