| 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> |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 #include <cmath> | 13 #include <cmath> |
| 14 #include <utility> | 14 #include <utility> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
| 18 #include "base/bind.h" | 18 #include "base/bind.h" |
| 19 #include "base/bind_helpers.h" | 19 #include "base/bind_helpers.h" |
| 20 #include "base/callback.h" | 20 #include "base/callback.h" |
| 21 #include "base/compiler_specific.h" | 21 #include "base/compiler_specific.h" |
| 22 #include "base/debug/debugger.h" | 22 #include "base/debug/debugger.h" |
| 23 #include "base/debug/stack_trace.h" | 23 #include "base/debug/stack_trace.h" |
| 24 #include "base/message_loop/message_loop_proxy.h" | 24 #include "base/message_loop/message_loop_proxy.h" |
| 25 #include "base/metrics/field_trial.h" | 25 #include "base/metrics/field_trial.h" |
| 26 #include "base/metrics/histogram.h" | 26 #include "base/metrics/histogram.h" |
| 27 #include "base/profiler/scoped_tracker.h" |
| 27 #include "base/stl_util.h" | 28 #include "base/stl_util.h" |
| 28 #include "base/strings/string_util.h" | 29 #include "base/strings/string_util.h" |
| 29 #include "base/strings/utf_string_conversions.h" | 30 #include "base/strings/utf_string_conversions.h" |
| 30 #include "base/threading/worker_pool.h" | 31 #include "base/threading/worker_pool.h" |
| 31 #include "base/time/time.h" | 32 #include "base/time/time.h" |
| 32 #include "base/values.h" | 33 #include "base/values.h" |
| 33 #include "net/base/address_family.h" | 34 #include "net/base/address_family.h" |
| 34 #include "net/base/address_list.h" | 35 #include "net/base/address_list.h" |
| 35 #include "net/base/dns_reloader.h" | 36 #include "net/base/dns_reloader.h" |
| 36 #include "net/base/dns_util.h" | 37 #include "net/base/dns_util.h" |
| (...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1864 DCHECK_GT(value, 0u); | 1865 DCHECK_GT(value, 0u); |
| 1865 max_queued_jobs_ = value; | 1866 max_queued_jobs_ = value; |
| 1866 } | 1867 } |
| 1867 | 1868 |
| 1868 int HostResolverImpl::Resolve(const RequestInfo& info, | 1869 int HostResolverImpl::Resolve(const RequestInfo& info, |
| 1869 RequestPriority priority, | 1870 RequestPriority priority, |
| 1870 AddressList* addresses, | 1871 AddressList* addresses, |
| 1871 const CompletionCallback& callback, | 1872 const CompletionCallback& callback, |
| 1872 RequestHandle* out_req, | 1873 RequestHandle* out_req, |
| 1873 const BoundNetLog& source_net_log) { | 1874 const BoundNetLog& source_net_log) { |
| 1875 // TODO(eroman): Remove ScopedTracker below once crbug.com/455942 is fixed. |
| 1876 tracked_objects::ScopedTracker tracking_profile( |
| 1877 FROM_HERE_WITH_EXPLICIT_FUNCTION("455942 HostResolverImpl::Resolve")); |
| 1878 |
| 1874 DCHECK(addresses); | 1879 DCHECK(addresses); |
| 1875 DCHECK(CalledOnValidThread()); | 1880 DCHECK(CalledOnValidThread()); |
| 1876 DCHECK_EQ(false, callback.is_null()); | 1881 DCHECK_EQ(false, callback.is_null()); |
| 1877 | 1882 |
| 1878 // Check that the caller supplied a valid hostname to resolve. | 1883 // Check that the caller supplied a valid hostname to resolve. |
| 1879 std::string labeled_hostname; | 1884 std::string labeled_hostname; |
| 1880 if (!DNSDomainFromDot(info.hostname(), &labeled_hostname)) | 1885 if (!DNSDomainFromDot(info.hostname(), &labeled_hostname)) |
| 1881 return ERR_NAME_NOT_RESOLVED; | 1886 return ERR_NAME_NOT_RESOLVED; |
| 1882 | 1887 |
| 1883 LogStartRequest(source_net_log, info); | 1888 LogStartRequest(source_net_log, info); |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2392 dns_client_->SetConfig(dns_config); | 2397 dns_client_->SetConfig(dns_config); |
| 2393 num_dns_failures_ = 0; | 2398 num_dns_failures_ = 0; |
| 2394 if (dns_client_->GetConfig()) | 2399 if (dns_client_->GetConfig()) |
| 2395 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); | 2400 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); |
| 2396 } | 2401 } |
| 2397 | 2402 |
| 2398 AbortDnsTasks(); | 2403 AbortDnsTasks(); |
| 2399 } | 2404 } |
| 2400 | 2405 |
| 2401 } // namespace net | 2406 } // namespace net |
| OLD | NEW |