| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_CRONET_STALE_HOST_RESOLVER_H_ | 5 #ifndef COMPONENTS_CRONET_STALE_HOST_RESOLVER_H_ |
| 6 #define COMPONENTS_CRONET_STALE_HOST_RESOLVER_H_ | 6 #define COMPONENTS_CRONET_STALE_HOST_RESOLVER_H_ |
| 7 | 7 |
| 8 #include <unordered_set> | 8 #include <unordered_set> |
| 9 | 9 |
| 10 #include "net/dns/host_resolver.h" | 10 #include "net/dns/host_resolver.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // usable (according to the options passed to the constructor), and fresh data | 56 // usable (according to the options passed to the constructor), and fresh data |
| 57 // is not returned before the specified delay, returns the stale data instead. | 57 // is not returned before the specified delay, returns the stale data instead. |
| 58 // | 58 // |
| 59 // If stale data is returned, the StaleHostResolver allows the underlying | 59 // If stale data is returned, the StaleHostResolver allows the underlying |
| 60 // request to continue in order to repopulate the cache. | 60 // request to continue in order to repopulate the cache. |
| 61 int Resolve(const RequestInfo& info, | 61 int Resolve(const RequestInfo& info, |
| 62 net::RequestPriority priority, | 62 net::RequestPriority priority, |
| 63 net::AddressList* addresses, | 63 net::AddressList* addresses, |
| 64 const net::CompletionCallback& callback, | 64 const net::CompletionCallback& callback, |
| 65 std::unique_ptr<Request>* out_req, | 65 std::unique_ptr<Request>* out_req, |
| 66 const net::BoundNetLog& net_log) override; | 66 const net::NetLogWithSource& net_log) override; |
| 67 | 67 |
| 68 // The remaining public methods pass through to the inner resolver: | 68 // The remaining public methods pass through to the inner resolver: |
| 69 | 69 |
| 70 int ResolveFromCache(const RequestInfo& info, | 70 int ResolveFromCache(const RequestInfo& info, |
| 71 net::AddressList* addresses, | 71 net::AddressList* addresses, |
| 72 const net::BoundNetLog& net_log) override; | 72 const net::NetLogWithSource& net_log) override; |
| 73 void SetDnsClientEnabled(bool enabled) override; | 73 void SetDnsClientEnabled(bool enabled) override; |
| 74 net::HostCache* GetHostCache() override; | 74 net::HostCache* GetHostCache() override; |
| 75 std::unique_ptr<base::Value> GetDnsConfigAsValue() const override; | 75 std::unique_ptr<base::Value> GetDnsConfigAsValue() const override; |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 class RequestImpl; | 78 class RequestImpl; |
| 79 | 79 |
| 80 // Called from |Request| when a request is complete and can be destroyed. | 80 // Called from |Request| when a request is complete and can be destroyed. |
| 81 void OnRequestComplete(Request* request); | 81 void OnRequestComplete(Request* request); |
| 82 | 82 |
| 83 // The underlying HostResolverImpl that will be used to make cache and network | 83 // The underlying HostResolverImpl that will be used to make cache and network |
| 84 // requests. | 84 // requests. |
| 85 std::unique_ptr<net::HostResolverImpl> inner_resolver_; | 85 std::unique_ptr<net::HostResolverImpl> inner_resolver_; |
| 86 | 86 |
| 87 // Options that govern when a stale response can or can't be returned. | 87 // Options that govern when a stale response can or can't be returned. |
| 88 StaleOptions options_; | 88 StaleOptions options_; |
| 89 | 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(StaleHostResolver); | 90 DISALLOW_COPY_AND_ASSIGN(StaleHostResolver); |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 } // namespace cronet | 93 } // namespace cronet |
| 94 | 94 |
| 95 #endif // COMPONENTS_CRONET_STALE_HOST_RESOLVER_H_ | 95 #endif // COMPONENTS_CRONET_STALE_HOST_RESOLVER_H_ |
| OLD | NEW |