| 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" | 
| 11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" | 
| 12 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" | 
| 13 | 13 | 
| 14 class MessageLoop; | 14 class MessageLoop; | 
| 15 | 15 | 
| 16 namespace net { | 16 namespace net { | 
| 17 | 17 | 
| 18 class AddressList; | 18 class AddressList; | 
| 19 | 19 | 
| 20 // This class represents the task of resolving hostnames (or IP address | 20 // This class represents the task of resolving hostnames (or IP address | 
| 21 // literal) to an AddressList object. | 21 // literal) to an AddressList object. | 
| 22 // | 22 // | 
| 23 // HostResolver can handle multiple requests at a time, so when cancelling a | 23 // HostResolver can handle multiple requests at a time, so when cancelling a | 
| 24 // request the RequestHandle that was returned by Resolve() needs to be | 24 // request the RequestHandle that was returned by Resolve() needs to be | 
| 25 // given.  A simpler alternative for consumers that only have 1 outstanding | 25 // given.  A simpler alternative for consumers that only have 1 outstanding | 
| 26 // request at a time is to create a SingleRequestHostResolver wrapper around | 26 // request at a time is to create a SingleRequestHostResolver wrapper around | 
| 27 // HostResolver (which will automatically cancel the single request when it | 27 // HostResolver (which will automatically cancel the single request when it | 
| 28 // goes out of scope). | 28 // goes out of scope). | 
| 29 class HostResolver : public base::RefCounted<HostResolver> { | 29 class HostResolver : public base::RefCountedThreadSafe<HostResolver> { | 
| 30  public: | 30  public: | 
| 31   // The parameters for doing a Resolve(). |hostname| and |port| are required, | 31   // The parameters for doing a Resolve(). |hostname| and |port| are required, | 
| 32   // the rest are optional (and have reasonable defaults). | 32   // the rest are optional (and have reasonable defaults). | 
| 33   class RequestInfo { | 33   class RequestInfo { | 
| 34    public: | 34    public: | 
| 35     RequestInfo(const std::string& hostname, int port) | 35     RequestInfo(const std::string& hostname, int port) | 
| 36         : hostname_(hostname), | 36         : hostname_(hostname), | 
| 37           port_(port), | 37           port_(port), | 
| 38           allow_cached_response_(true), | 38           allow_cached_response_(true), | 
| 39           is_speculative_(false) {} | 39           is_speculative_(false) {} | 
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 168 }; | 168 }; | 
| 169 | 169 | 
| 170 // Creates a HostResolver implementation that queries the underlying system. | 170 // Creates a HostResolver implementation that queries the underlying system. | 
| 171 // (Except if a unit-test has changed the global HostResolverProc using | 171 // (Except if a unit-test has changed the global HostResolverProc using | 
| 172 // ScopedHostResolverProc to intercept requests to the system). | 172 // ScopedHostResolverProc to intercept requests to the system). | 
| 173 HostResolver* CreateSystemHostResolver(); | 173 HostResolver* CreateSystemHostResolver(); | 
| 174 | 174 | 
| 175 }  // namespace net | 175 }  // namespace net | 
| 176 | 176 | 
| 177 #endif  // NET_BASE_HOST_RESOLVER_H_ | 177 #endif  // NET_BASE_HOST_RESOLVER_H_ | 
| OLD | NEW | 
|---|