| 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 #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 26 matching lines...) Expand all Loading... |
| 37 #include "base/threading/worker_pool.h" | 37 #include "base/threading/worker_pool.h" |
| 38 #include "base/time/time.h" | 38 #include "base/time/time.h" |
| 39 #include "base/trace_event/trace_event.h" | 39 #include "base/trace_event/trace_event.h" |
| 40 #include "base/values.h" | 40 #include "base/values.h" |
| 41 #include "net/base/address_family.h" | 41 #include "net/base/address_family.h" |
| 42 #include "net/base/address_list.h" | 42 #include "net/base/address_list.h" |
| 43 #include "net/base/host_port_pair.h" | 43 #include "net/base/host_port_pair.h" |
| 44 #include "net/base/ip_address.h" | 44 #include "net/base/ip_address.h" |
| 45 #include "net/base/ip_endpoint.h" | 45 #include "net/base/ip_endpoint.h" |
| 46 #include "net/base/net_errors.h" | 46 #include "net/base/net_errors.h" |
| 47 #include "net/base/trace_constants.h" |
| 47 #include "net/base/url_util.h" | 48 #include "net/base/url_util.h" |
| 48 #include "net/dns/address_sorter.h" | 49 #include "net/dns/address_sorter.h" |
| 49 #include "net/dns/dns_client.h" | 50 #include "net/dns/dns_client.h" |
| 50 #include "net/dns/dns_config_service.h" | 51 #include "net/dns/dns_config_service.h" |
| 51 #include "net/dns/dns_protocol.h" | 52 #include "net/dns/dns_protocol.h" |
| 52 #include "net/dns/dns_reloader.h" | 53 #include "net/dns/dns_reloader.h" |
| 53 #include "net/dns/dns_response.h" | 54 #include "net/dns/dns_response.h" |
| 54 #include "net/dns/dns_transaction.h" | 55 #include "net/dns/dns_transaction.h" |
| 55 #include "net/dns/dns_util.h" | 56 #include "net/dns/dns_util.h" |
| 56 #include "net/dns/host_resolver_proc.h" | 57 #include "net/dns/host_resolver_proc.h" |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 params_.unresponsive_delay *= params_.retry_factor; | 764 params_.unresponsive_delay *= params_.retry_factor; |
| 764 StartLookupAttempt(); | 765 StartLookupAttempt(); |
| 765 } | 766 } |
| 766 | 767 |
| 767 // Callback for when DoLookup() completes (runs on task runner thread). | 768 // Callback for when DoLookup() completes (runs on task runner thread). |
| 768 void OnLookupComplete(const AddressList& results, | 769 void OnLookupComplete(const AddressList& results, |
| 769 const base::TimeTicks& start_time, | 770 const base::TimeTicks& start_time, |
| 770 const uint32_t attempt_number, | 771 const uint32_t attempt_number, |
| 771 int error, | 772 int error, |
| 772 const int os_error) { | 773 const int os_error) { |
| 773 TRACE_EVENT0("net", "ProcTask::OnLookupComplete"); | 774 TRACE_EVENT0(kNetTracingCategory, "ProcTask::OnLookupComplete"); |
| 774 DCHECK(network_task_runner_->BelongsToCurrentThread()); | 775 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
| 775 // If results are empty, we should return an error. | 776 // If results are empty, we should return an error. |
| 776 bool empty_list_on_ok = (error == OK && results.empty()); | 777 bool empty_list_on_ok = (error == OK && results.empty()); |
| 777 UMA_HISTOGRAM_BOOLEAN("DNS.EmptyAddressListAndNoError", empty_list_on_ok); | 778 UMA_HISTOGRAM_BOOLEAN("DNS.EmptyAddressListAndNoError", empty_list_on_ok); |
| 778 if (empty_list_on_ok) | 779 if (empty_list_on_ok) |
| 779 error = ERR_NAME_NOT_RESOLVED; | 780 error = ERR_NAME_NOT_RESOLVED; |
| 780 | 781 |
| 781 bool was_retry_attempt = attempt_number > 1; | 782 bool was_retry_attempt = attempt_number > 1; |
| 782 | 783 |
| 783 // Ideally the following code would be part of host_resolver_proc.cc, | 784 // Ideally the following code would be part of host_resolver_proc.cc, |
| (...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2609 if (job_) | 2610 if (job_) |
| 2610 job_->CancelRequest(this); | 2611 job_->CancelRequest(this); |
| 2611 } | 2612 } |
| 2612 | 2613 |
| 2613 void HostResolverImpl::RequestImpl::ChangeRequestPriority( | 2614 void HostResolverImpl::RequestImpl::ChangeRequestPriority( |
| 2614 RequestPriority priority) { | 2615 RequestPriority priority) { |
| 2615 job_->ChangeRequestPriority(this, priority); | 2616 job_->ChangeRequestPriority(this, priority); |
| 2616 } | 2617 } |
| 2617 | 2618 |
| 2618 } // namespace net | 2619 } // namespace net |
| OLD | NEW |