OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_BASE_HOST_RESOLVER_H_ | 5 #ifndef NET_BASE_HOST_RESOLVER_H_ |
6 #define NET_BASE_HOST_RESOLVER_H_ | 6 #define NET_BASE_HOST_RESOLVER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 // This class represents the task of resolving hostnames (or IP address | 22 // This class represents the task of resolving hostnames (or IP address |
23 // literal) to an AddressList object. | 23 // literal) to an AddressList object. |
24 // | 24 // |
25 // HostResolver can handle multiple requests at a time, so when cancelling a | 25 // HostResolver can handle multiple requests at a time, so when cancelling a |
26 // request the RequestHandle that was returned by Resolve() needs to be | 26 // request the RequestHandle that was returned by Resolve() needs to be |
27 // given. A simpler alternative for consumers that only have 1 outstanding | 27 // given. A simpler alternative for consumers that only have 1 outstanding |
28 // request at a time is to create a SingleRequestHostResolver wrapper around | 28 // request at a time is to create a SingleRequestHostResolver wrapper around |
29 // HostResolver (which will automatically cancel the single request when it | 29 // HostResolver (which will automatically cancel the single request when it |
30 // goes out of scope). | 30 // goes out of scope). |
31 class HostResolver : public base::RefCounted<HostResolver> { | 31 class HostResolver : public base::RefCountedThreadSafe<HostResolver> { |
32 public: | 32 public: |
33 // The parameters for doing a Resolve(). |hostname| and |port| are required, | 33 // The parameters for doing a Resolve(). |hostname| and |port| are required, |
34 // the rest are optional (and have reasonable defaults). | 34 // the rest are optional (and have reasonable defaults). |
35 class RequestInfo { | 35 class RequestInfo { |
36 public: | 36 public: |
37 RequestInfo(const std::string& hostname, int port) | 37 RequestInfo(const std::string& hostname, int port) |
38 : hostname_(hostname), | 38 : hostname_(hostname), |
39 port_(port), | 39 port_(port), |
40 allow_cached_response_(true), | 40 allow_cached_response_(true), |
41 is_speculative_(false) {} | 41 is_speculative_(false) {} |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 }; | 183 }; |
184 | 184 |
185 // Creates a HostResolver implementation that queries the underlying system. | 185 // Creates a HostResolver implementation that queries the underlying system. |
186 // (Except if a unit-test has changed the global HostResolverProc using | 186 // (Except if a unit-test has changed the global HostResolverProc using |
187 // ScopedHostResolverProc to intercept requests to the system). | 187 // ScopedHostResolverProc to intercept requests to the system). |
188 HostResolver* CreateSystemHostResolver(); | 188 HostResolver* CreateSystemHostResolver(); |
189 | 189 |
190 } // namespace net | 190 } // namespace net |
191 | 191 |
192 #endif // NET_BASE_HOST_RESOLVER_H_ | 192 #endif // NET_BASE_HOST_RESOLVER_H_ |
OLD | NEW |