| 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 #ifndef NET_DNS_HOST_RESOLVER_IMPL_H_ | 5 #ifndef NET_DNS_HOST_RESOLVER_IMPL_H_ |
| 6 #define NET_DNS_HOST_RESOLVER_IMPL_H_ | 6 #define NET_DNS_HOST_RESOLVER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/strings/string_piece.h" | 16 #include "base/strings/string_piece.h" |
| 17 #include "base/threading/non_thread_safe.h" | 17 #include "base/threading/non_thread_safe.h" |
| 18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "base/timer/timer.h" | 19 #include "base/timer/timer.h" |
| 20 #include "net/base/net_export.h" | 20 #include "net/base/net_export.h" |
| 21 #include "net/base/network_change_notifier.h" | 21 #include "net/base/network_change_notifier.h" |
| 22 #include "net/dns/host_cache.h" | 22 #include "net/dns/host_cache.h" |
| 23 #include "net/dns/host_resolver.h" | 23 #include "net/dns/host_resolver.h" |
| 24 #include "net/dns/host_resolver_proc.h" | 24 #include "net/dns/host_resolver_proc.h" |
| 25 | 25 |
| 26 namespace net { | 26 namespace net { |
| 27 | 27 |
| 28 class AddressList; | 28 class AddressList; |
| 29 class NetLogWithSource; | |
| 30 class DnsClient; | 29 class DnsClient; |
| 31 class IPAddress; | 30 class IPAddress; |
| 32 class NetLog; | 31 class NetLog; |
| 32 class NetLogWithSource; |
| 33 | 33 |
| 34 // For each hostname that is requested, HostResolver creates a | 34 // For each hostname that is requested, HostResolver creates a |
| 35 // HostResolverImpl::Job. When this job gets dispatched it creates a ProcTask | 35 // HostResolverImpl::Job. When this job gets dispatched it creates a ProcTask |
| 36 // which runs the given HostResolverProc on a worker thread (a WorkerPool | 36 // which runs the given HostResolverProc on a worker thread (a WorkerPool |
| 37 // thread, in production code.) If requests for that same host are made during | 37 // thread, in production code.) If requests for that same host are made during |
| 38 // the job's lifetime, they are attached to the existing job rather than | 38 // the job's lifetime, they are attached to the existing job rather than |
| 39 // creating a new one. This avoids doing parallel resolves for the same host. | 39 // creating a new one. This avoids doing parallel resolves for the same host. |
| 40 // | 40 // |
| 41 // The way these classes fit together is illustrated by: | 41 // The way these classes fit together is illustrated by: |
| 42 // | 42 // |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 // This function is only exposed so it can be unit-tested. | 390 // This function is only exposed so it can be unit-tested. |
| 391 // TODO(tfarina): It would be better to change the tests so this function | 391 // TODO(tfarina): It would be better to change the tests so this function |
| 392 // gets exercised indirectly through HostResolverImpl. | 392 // gets exercised indirectly through HostResolverImpl. |
| 393 NET_EXPORT_PRIVATE bool ResolveLocalHostname(base::StringPiece host, | 393 NET_EXPORT_PRIVATE bool ResolveLocalHostname(base::StringPiece host, |
| 394 uint16_t port, | 394 uint16_t port, |
| 395 AddressList* address_list); | 395 AddressList* address_list); |
| 396 | 396 |
| 397 } // namespace net | 397 } // namespace net |
| 398 | 398 |
| 399 #endif // NET_DNS_HOST_RESOLVER_IMPL_H_ | 399 #endif // NET_DNS_HOST_RESOLVER_IMPL_H_ |
| OLD | NEW |