Chromium Code Reviews| 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. This is used only to disable | |
| 220 // IPv6 in Cronet, and can be removed when support for the option is no longer | |
| 221 // needed. See http://crbug.com/696569. | |
| 222 virtual void SetDefaultAddressFamily(AddressFamily address_family) {} | |
|
xunjieli
2017/02/27 15:41:38
Please add a NOTREACHED() here.
Mentioning Cronet
mgersh
2017/02/28 16:49:06
Done.
| |
| 223 virtual AddressFamily GetDefaultAddressFamily() const; | |
| 224 | |
| 216 // Creates a HostResolver implementation that queries the underlying system. | 225 // Creates a HostResolver implementation that queries the underlying system. |
| 217 // (Except if a unit-test has changed the global HostResolverProc using | 226 // (Except if a unit-test has changed the global HostResolverProc using |
| 218 // ScopedHostResolverProc to intercept requests to the system). | 227 // ScopedHostResolverProc to intercept requests to the system). |
| 219 static std::unique_ptr<HostResolver> CreateSystemResolver( | 228 static std::unique_ptr<HostResolver> CreateSystemResolver( |
| 220 const Options& options, | 229 const Options& options, |
| 221 NetLog* net_log); | 230 NetLog* net_log); |
| 222 // Same, but explicitly returns the HostResolverImpl. Only used by | 231 // Same, but explicitly returns the HostResolverImpl. Only used by |
| 223 // StaleHostResolver in cronet. | 232 // StaleHostResolver in cronet. |
| 224 static std::unique_ptr<HostResolverImpl> CreateSystemResolverImpl( | 233 static std::unique_ptr<HostResolverImpl> CreateSystemResolverImpl( |
| 225 const Options& options, | 234 const Options& options, |
| 226 NetLog* net_log); | 235 NetLog* net_log); |
| 227 | 236 |
| 228 // As above, but uses default parameters. | 237 // As above, but uses default parameters. |
| 229 static std::unique_ptr<HostResolver> CreateDefaultResolver(NetLog* net_log); | 238 static std::unique_ptr<HostResolver> CreateDefaultResolver(NetLog* net_log); |
| 230 // Same, but explicitly returns the HostResolverImpl. Only used by | 239 // Same, but explicitly returns the HostResolverImpl. Only used by |
| 231 // StaleHostResolver in cronet. | 240 // StaleHostResolver in cronet. |
| 232 static std::unique_ptr<HostResolverImpl> CreateDefaultResolverImpl( | 241 static std::unique_ptr<HostResolverImpl> CreateDefaultResolverImpl( |
| 233 NetLog* net_log); | 242 NetLog* net_log); |
| 234 | 243 |
| 235 protected: | 244 protected: |
| 236 HostResolver(); | 245 HostResolver(); |
| 237 | 246 |
| 238 private: | 247 private: |
| 239 DISALLOW_COPY_AND_ASSIGN(HostResolver); | 248 DISALLOW_COPY_AND_ASSIGN(HostResolver); |
| 240 }; | 249 }; |
| 241 | 250 |
| 242 } // namespace net | 251 } // namespace net |
| 243 | 252 |
| 244 #endif // NET_DNS_HOST_RESOLVER_H_ | 253 #endif // NET_DNS_HOST_RESOLVER_H_ |
| OLD | NEW |