| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCHER_H_ | 5 #ifndef CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCHER_H_ |
| 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCHER_H_ | 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCHER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 const net::RedirectInfo& redirect_info, | 130 const net::RedirectInfo& redirect_info, |
| 131 bool* defer_redirect) override; | 131 bool* defer_redirect) override; |
| 132 void OnAuthRequired(net::URLRequest* request, | 132 void OnAuthRequired(net::URLRequest* request, |
| 133 net::AuthChallengeInfo* auth_info) override; | 133 net::AuthChallengeInfo* auth_info) override; |
| 134 void OnCertificateRequested( | 134 void OnCertificateRequested( |
| 135 net::URLRequest* request, | 135 net::URLRequest* request, |
| 136 net::SSLCertRequestInfo* cert_request_info) override; | 136 net::SSLCertRequestInfo* cert_request_info) override; |
| 137 void OnSSLCertificateError(net::URLRequest* request, | 137 void OnSSLCertificateError(net::URLRequest* request, |
| 138 const net::SSLInfo& ssl_info, | 138 const net::SSLInfo& ssl_info, |
| 139 bool fatal) override; | 139 bool fatal) override; |
| 140 void OnResponseStarted(net::URLRequest* request) override; | 140 void OnResponseStarted(net::URLRequest* request, int net_error) override; |
| 141 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; | 141 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; |
| 142 | 142 |
| 143 enum PrefetcherState { | 143 enum PrefetcherState { |
| 144 INITIALIZED = 0, // Prefetching hasn't started. | 144 INITIALIZED = 0, // Prefetching hasn't started. |
| 145 RUNNING = 1, // Prefetching started, allowed to add more requests. | 145 RUNNING = 1, // Prefetching started, allowed to add more requests. |
| 146 STOPPED = 2, // Prefetching started, not allowed to add more requests. | 146 STOPPED = 2, // Prefetching started, not allowed to add more requests. |
| 147 FINISHED = 3 // No more inflight request, new requests not possible. | 147 FINISHED = 3 // No more inflight request, new requests not possible. |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 base::ThreadChecker thread_checker_; | 150 base::ThreadChecker thread_checker_; |
| 151 PrefetcherState state_; | 151 PrefetcherState state_; |
| 152 Delegate* const delegate_; | 152 Delegate* const delegate_; |
| 153 ResourcePrefetchPredictorConfig const config_; | 153 ResourcePrefetchPredictorConfig const config_; |
| 154 NavigationID navigation_id_; | 154 NavigationID navigation_id_; |
| 155 PrefetchKeyType key_type_; | 155 PrefetchKeyType key_type_; |
| 156 std::unique_ptr<RequestVector> request_vector_; | 156 std::unique_ptr<RequestVector> request_vector_; |
| 157 | 157 |
| 158 std::map<net::URLRequest*, | 158 std::map<net::URLRequest*, |
| 159 std::pair<std::unique_ptr<net::URLRequest>, Request*>> | 159 std::pair<std::unique_ptr<net::URLRequest>, Request*>> |
| 160 inflight_requests_; | 160 inflight_requests_; |
| 161 std::list<Request*> request_queue_; | 161 std::list<Request*> request_queue_; |
| 162 std::map<std::string, size_t> host_inflight_counts_; | 162 std::map<std::string, size_t> host_inflight_counts_; |
| 163 | 163 |
| 164 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetcher); | 164 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetcher); |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 } // namespace predictors | 167 } // namespace predictors |
| 168 | 168 |
| 169 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCHER_H_ | 169 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCHER_H_ |
| OLD | NEW |