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 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 <map> | 8 #include <map> |
9 #include <list> | 9 #include <list> |
10 #include <vector> | 10 #include <vector> |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // out the Start() call to net::URLRequest for unittesting. | 111 // out the Start() call to net::URLRequest for unittesting. |
112 virtual void StartURLRequest(net::URLRequest* request); | 112 virtual void StartURLRequest(net::URLRequest* request); |
113 | 113 |
114 // Marks the request as finished, with the given status. | 114 // Marks the request as finished, with the given status. |
115 void FinishRequest(net::URLRequest* request, Request::PrefetchStatus status); | 115 void FinishRequest(net::URLRequest* request, Request::PrefetchStatus status); |
116 | 116 |
117 // Reads the response data from the response - required for the resource to | 117 // Reads the response data from the response - required for the resource to |
118 // be cached correctly. Stubbed out during testing. | 118 // be cached correctly. Stubbed out during testing. |
119 virtual void ReadFullResponse(net::URLRequest* request); | 119 virtual void ReadFullResponse(net::URLRequest* request); |
120 | 120 |
| 121 // Returns true if the request has more data that needs to be read. If it |
| 122 // returns false, the request should not be referenced again. |
| 123 bool ShouldContinueReadingRequest(net::URLRequest* request, int bytes_read); |
| 124 |
121 // net::URLRequest::Delegate methods. | 125 // net::URLRequest::Delegate methods. |
122 virtual void OnReceivedRedirect(net::URLRequest* request, | 126 virtual void OnReceivedRedirect(net::URLRequest* request, |
123 const GURL& new_url, | 127 const GURL& new_url, |
124 bool* defer_redirect) OVERRIDE; | 128 bool* defer_redirect) OVERRIDE; |
125 virtual void OnAuthRequired(net::URLRequest* request, | 129 virtual void OnAuthRequired(net::URLRequest* request, |
126 net::AuthChallengeInfo* auth_info) OVERRIDE; | 130 net::AuthChallengeInfo* auth_info) OVERRIDE; |
127 virtual void OnCertificateRequested( | 131 virtual void OnCertificateRequested( |
128 net::URLRequest* request, | 132 net::URLRequest* request, |
129 net::SSLCertRequestInfo* cert_request_info) OVERRIDE; | 133 net::SSLCertRequestInfo* cert_request_info) OVERRIDE; |
130 virtual void OnSSLCertificateError(net::URLRequest* request, | 134 virtual void OnSSLCertificateError(net::URLRequest* request, |
(...skipping 20 matching lines...) Expand all Loading... |
151 std::map<net::URLRequest*, Request*> inflight_requests_; | 155 std::map<net::URLRequest*, Request*> inflight_requests_; |
152 std::list<Request*> request_queue_; | 156 std::list<Request*> request_queue_; |
153 std::map<std::string, int> host_inflight_counts_; | 157 std::map<std::string, int> host_inflight_counts_; |
154 | 158 |
155 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetcher); | 159 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetcher); |
156 }; | 160 }; |
157 | 161 |
158 } // namespace predictors | 162 } // namespace predictors |
159 | 163 |
160 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCHER_H_ | 164 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCHER_H_ |
OLD | NEW |