| 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_H_ | 5 #ifndef NET_DNS_HOST_RESOLVER_H_ |
| 6 #define NET_DNS_HOST_RESOLVER_H_ | 6 #define NET_DNS_HOST_RESOLVER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 typedef base::Callback<void(std::unique_ptr<const base::Value>)> | 206 typedef base::Callback<void(std::unique_ptr<const base::Value>)> |
| 207 PersistCallback; | 207 PersistCallback; |
| 208 // Configures the HostResolver to be able to persist data (e.g. observed | 208 // Configures the HostResolver to be able to persist data (e.g. observed |
| 209 // performance) between sessions. |persist_callback| is a callback that will | 209 // performance) between sessions. |persist_callback| is a callback that will |
| 210 // be called when the HostResolver wants to persist data; |old_data| is the | 210 // be called when the HostResolver wants to persist data; |old_data| is the |
| 211 // data last persisted by the resolver on the previous session. | 211 // data last persisted by the resolver on the previous session. |
| 212 virtual void InitializePersistence( | 212 virtual void InitializePersistence( |
| 213 const PersistCallback& persist_callback, | 213 const PersistCallback& persist_callback, |
| 214 std::unique_ptr<const base::Value> old_data); | 214 std::unique_ptr<const base::Value> old_data); |
| 215 | 215 |
| 216 // Sets the default AddressFamily to use when requests have left it |
| 217 // unspecified. For example, this could be used to restrict resolution |
| 218 // results to AF_INET by passing in ADDRESS_FAMILY_IPV4, or to |
| 219 // AF_INET6 by passing in ADDRESS_FAMILY_IPV6. See http://crbug.com/696569 for |
| 220 // why this option is necessary. |
| 221 virtual void SetDefaultAddressFamily(AddressFamily address_family); |
| 222 virtual AddressFamily GetDefaultAddressFamily() const; |
| 223 |
| 216 // Creates a HostResolver implementation that queries the underlying system. | 224 // Creates a HostResolver implementation that queries the underlying system. |
| 217 // (Except if a unit-test has changed the global HostResolverProc using | 225 // (Except if a unit-test has changed the global HostResolverProc using |
| 218 // ScopedHostResolverProc to intercept requests to the system). | 226 // ScopedHostResolverProc to intercept requests to the system). |
| 219 static std::unique_ptr<HostResolver> CreateSystemResolver( | 227 static std::unique_ptr<HostResolver> CreateSystemResolver( |
| 220 const Options& options, | 228 const Options& options, |
| 221 NetLog* net_log); | 229 NetLog* net_log); |
| 222 // Same, but explicitly returns the HostResolverImpl. Only used by | 230 // Same, but explicitly returns the HostResolverImpl. Only used by |
| 223 // StaleHostResolver in cronet. | 231 // StaleHostResolver in cronet. |
| 224 static std::unique_ptr<HostResolverImpl> CreateSystemResolverImpl( | 232 static std::unique_ptr<HostResolverImpl> CreateSystemResolverImpl( |
| 225 const Options& options, | 233 const Options& options, |
| 226 NetLog* net_log); | 234 NetLog* net_log); |
| 227 | 235 |
| 228 // As above, but uses default parameters. | 236 // As above, but uses default parameters. |
| 229 static std::unique_ptr<HostResolver> CreateDefaultResolver(NetLog* net_log); | 237 static std::unique_ptr<HostResolver> CreateDefaultResolver(NetLog* net_log); |
| 230 // Same, but explicitly returns the HostResolverImpl. Only used by | 238 // Same, but explicitly returns the HostResolverImpl. Only used by |
| 231 // StaleHostResolver in cronet. | 239 // StaleHostResolver in cronet. |
| 232 static std::unique_ptr<HostResolverImpl> CreateDefaultResolverImpl( | 240 static std::unique_ptr<HostResolverImpl> CreateDefaultResolverImpl( |
| 233 NetLog* net_log); | 241 NetLog* net_log); |
| 234 | 242 |
| 235 protected: | 243 protected: |
| 236 HostResolver(); | 244 HostResolver(); |
| 237 | 245 |
| 238 private: | 246 private: |
| 239 DISALLOW_COPY_AND_ASSIGN(HostResolver); | 247 DISALLOW_COPY_AND_ASSIGN(HostResolver); |
| 240 }; | 248 }; |
| 241 | 249 |
| 242 } // namespace net | 250 } // namespace net |
| 243 | 251 |
| 244 #endif // NET_DNS_HOST_RESOLVER_H_ | 252 #endif // NET_DNS_HOST_RESOLVER_H_ |
| OLD | NEW |