| OLD | NEW |
| 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 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <Winsock2.h> | 10 #include <Winsock2.h> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "base/metrics/histogram_macros.h" | 28 #include "base/metrics/histogram_macros.h" |
| 29 #include "base/metrics/sparse_histogram.h" | 29 #include "base/metrics/sparse_histogram.h" |
| 30 #include "base/profiler/scoped_tracker.h" | 30 #include "base/profiler/scoped_tracker.h" |
| 31 #include "base/single_thread_task_runner.h" | 31 #include "base/single_thread_task_runner.h" |
| 32 #include "base/stl_util.h" | 32 #include "base/stl_util.h" |
| 33 #include "base/strings/string_util.h" | 33 #include "base/strings/string_util.h" |
| 34 #include "base/strings/utf_string_conversions.h" | 34 #include "base/strings/utf_string_conversions.h" |
| 35 #include "base/thread_task_runner_handle.h" | 35 #include "base/thread_task_runner_handle.h" |
| 36 #include "base/threading/worker_pool.h" | 36 #include "base/threading/worker_pool.h" |
| 37 #include "base/time/time.h" | 37 #include "base/time/time.h" |
| 38 #include "base/trace_event/trace_event.h" |
| 38 #include "base/values.h" | 39 #include "base/values.h" |
| 39 #include "net/base/address_family.h" | 40 #include "net/base/address_family.h" |
| 40 #include "net/base/address_list.h" | 41 #include "net/base/address_list.h" |
| 41 #include "net/base/host_port_pair.h" | 42 #include "net/base/host_port_pair.h" |
| 42 #include "net/base/ip_address.h" | 43 #include "net/base/ip_address.h" |
| 43 #include "net/base/ip_endpoint.h" | 44 #include "net/base/ip_endpoint.h" |
| 44 #include "net/base/net_errors.h" | 45 #include "net/base/net_errors.h" |
| 45 #include "net/base/url_util.h" | 46 #include "net/base/url_util.h" |
| 46 #include "net/dns/address_sorter.h" | 47 #include "net/dns/address_sorter.h" |
| 47 #include "net/dns/dns_client.h" | 48 #include "net/dns/dns_client.h" |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 params_.unresponsive_delay *= params_.retry_factor; | 762 params_.unresponsive_delay *= params_.retry_factor; |
| 762 StartLookupAttempt(); | 763 StartLookupAttempt(); |
| 763 } | 764 } |
| 764 | 765 |
| 765 // Callback for when DoLookup() completes (runs on task runner thread). | 766 // Callback for when DoLookup() completes (runs on task runner thread). |
| 766 void OnLookupComplete(const AddressList& results, | 767 void OnLookupComplete(const AddressList& results, |
| 767 const base::TimeTicks& start_time, | 768 const base::TimeTicks& start_time, |
| 768 const uint32_t attempt_number, | 769 const uint32_t attempt_number, |
| 769 int error, | 770 int error, |
| 770 const int os_error) { | 771 const int os_error) { |
| 772 TRACE_EVENT0("net", "ProcTask::OnLookupComplete"); |
| 771 DCHECK(task_runner_->BelongsToCurrentThread()); | 773 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 772 // If results are empty, we should return an error. | 774 // If results are empty, we should return an error. |
| 773 bool empty_list_on_ok = (error == OK && results.empty()); | 775 bool empty_list_on_ok = (error == OK && results.empty()); |
| 774 UMA_HISTOGRAM_BOOLEAN("DNS.EmptyAddressListAndNoError", empty_list_on_ok); | 776 UMA_HISTOGRAM_BOOLEAN("DNS.EmptyAddressListAndNoError", empty_list_on_ok); |
| 775 if (empty_list_on_ok) | 777 if (empty_list_on_ok) |
| 776 error = ERR_NAME_NOT_RESOLVED; | 778 error = ERR_NAME_NOT_RESOLVED; |
| 777 | 779 |
| 778 bool was_retry_attempt = attempt_number > 1; | 780 bool was_retry_attempt = attempt_number > 1; |
| 779 | 781 |
| 780 // Ideally the following code would be part of host_resolver_proc.cc, | 782 // Ideally the following code would be part of host_resolver_proc.cc, |
| (...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2460 dns_client_->SetConfig(dns_config); | 2462 dns_client_->SetConfig(dns_config); |
| 2461 num_dns_failures_ = 0; | 2463 num_dns_failures_ = 0; |
| 2462 if (dns_client_->GetConfig()) | 2464 if (dns_client_->GetConfig()) |
| 2463 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); | 2465 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); |
| 2464 } | 2466 } |
| 2465 | 2467 |
| 2466 AbortDnsTasks(); | 2468 AbortDnsTasks(); |
| 2467 } | 2469 } |
| 2468 | 2470 |
| 2469 } // namespace net | 2471 } // namespace net |
| OLD | NEW |