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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 params_.unresponsive_delay *= params_.retry_factor; | 758 params_.unresponsive_delay *= params_.retry_factor; |
758 StartLookupAttempt(); | 759 StartLookupAttempt(); |
759 } | 760 } |
760 | 761 |
761 // Callback for when DoLookup() completes (runs on task runner thread). | 762 // Callback for when DoLookup() completes (runs on task runner thread). |
762 void OnLookupComplete(const AddressList& results, | 763 void OnLookupComplete(const AddressList& results, |
763 const base::TimeTicks& start_time, | 764 const base::TimeTicks& start_time, |
764 const uint32_t attempt_number, | 765 const uint32_t attempt_number, |
765 int error, | 766 int error, |
766 const int os_error) { | 767 const int os_error) { |
| 768 TRACE_EVENT0("net", "net::ProcTask::OnLookupComplete"); |
767 DCHECK(task_runner_->BelongsToCurrentThread()); | 769 DCHECK(task_runner_->BelongsToCurrentThread()); |
768 // If results are empty, we should return an error. | 770 // If results are empty, we should return an error. |
769 bool empty_list_on_ok = (error == OK && results.empty()); | 771 bool empty_list_on_ok = (error == OK && results.empty()); |
770 UMA_HISTOGRAM_BOOLEAN("DNS.EmptyAddressListAndNoError", empty_list_on_ok); | 772 UMA_HISTOGRAM_BOOLEAN("DNS.EmptyAddressListAndNoError", empty_list_on_ok); |
771 if (empty_list_on_ok) | 773 if (empty_list_on_ok) |
772 error = ERR_NAME_NOT_RESOLVED; | 774 error = ERR_NAME_NOT_RESOLVED; |
773 | 775 |
774 bool was_retry_attempt = attempt_number > 1; | 776 bool was_retry_attempt = attempt_number > 1; |
775 | 777 |
776 // Ideally the following code would be part of host_resolver_proc.cc, | 778 // Ideally the following code would be part of host_resolver_proc.cc, |
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2442 dns_client_->SetConfig(dns_config); | 2444 dns_client_->SetConfig(dns_config); |
2443 num_dns_failures_ = 0; | 2445 num_dns_failures_ = 0; |
2444 if (dns_client_->GetConfig()) | 2446 if (dns_client_->GetConfig()) |
2445 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); | 2447 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); |
2446 } | 2448 } |
2447 | 2449 |
2448 AbortDnsTasks(); | 2450 AbortDnsTasks(); |
2449 } | 2451 } |
2450 | 2452 |
2451 } // namespace net | 2453 } // namespace net |
OLD | NEW |