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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 virtual void SetDnsClientEnabled(bool enabled); | 179 virtual void SetDnsClientEnabled(bool enabled); |
180 | 180 |
181 // Returns the HostResolverCache |this| uses, or NULL if there isn't one. | 181 // Returns the HostResolverCache |this| uses, or NULL if there isn't one. |
182 // Used primarily to clear the cache and for getting debug information. | 182 // Used primarily to clear the cache and for getting debug information. |
183 virtual HostCache* GetHostCache(); | 183 virtual HostCache* GetHostCache(); |
184 | 184 |
185 // Returns the current DNS configuration |this| is using, as a Value, or | 185 // Returns the current DNS configuration |this| is using, as a Value, or |
186 // nullptr if it's configured to always use the system host resolver. | 186 // nullptr if it's configured to always use the system host resolver. |
187 virtual std::unique_ptr<base::Value> GetDnsConfigAsValue() const; | 187 virtual std::unique_ptr<base::Value> GetDnsConfigAsValue() const; |
188 | 188 |
| 189 typedef base::Callback<void(std::unique_ptr<const base::Value>)> |
| 190 PersistCallback; |
| 191 // Configures the HostResolver to be able to persist data (e.g. observed |
| 192 // performance) between sessions. |persist_callback| is a callback that will |
| 193 // be called when the HostResolver wants to persist data; |old_data| is the |
| 194 // data last persisted by the resolver on the previous session. |
| 195 virtual void InitializePersistence( |
| 196 const PersistCallback& persist_callback, |
| 197 std::unique_ptr<const base::Value> old_data); |
| 198 |
189 // Creates a HostResolver implementation that queries the underlying system. | 199 // Creates a HostResolver implementation that queries the underlying system. |
190 // (Except if a unit-test has changed the global HostResolverProc using | 200 // (Except if a unit-test has changed the global HostResolverProc using |
191 // ScopedHostResolverProc to intercept requests to the system). | 201 // ScopedHostResolverProc to intercept requests to the system). |
192 static std::unique_ptr<HostResolver> CreateSystemResolver( | 202 static std::unique_ptr<HostResolver> CreateSystemResolver( |
193 const Options& options, | 203 const Options& options, |
194 NetLog* net_log); | 204 NetLog* net_log); |
195 | 205 |
196 // As above, but uses default parameters. | 206 // As above, but uses default parameters. |
197 static std::unique_ptr<HostResolver> CreateDefaultResolver(NetLog* net_log); | 207 static std::unique_ptr<HostResolver> CreateDefaultResolver(NetLog* net_log); |
198 | 208 |
199 protected: | 209 protected: |
200 HostResolver(); | 210 HostResolver(); |
201 | 211 |
202 private: | 212 private: |
203 DISALLOW_COPY_AND_ASSIGN(HostResolver); | 213 DISALLOW_COPY_AND_ASSIGN(HostResolver); |
204 }; | 214 }; |
205 | 215 |
206 } // namespace net | 216 } // namespace net |
207 | 217 |
208 #endif // NET_DNS_HOST_RESOLVER_H_ | 218 #endif // NET_DNS_HOST_RESOLVER_H_ |
OLD | NEW |