OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // This file declares HttpCache::Transaction, a private class of HttpCache so | 5 // This file declares HttpCache::Transaction, a private class of HttpCache so |
6 // it should only be included by http_cache.cc | 6 // it should only be included by http_cache.cc |
7 | 7 |
8 #ifndef NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 8 #ifndef NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
9 #define NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 9 #define NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // headers used to validate cache entries. | 104 // headers used to validate cache entries. |
105 struct ValidationHeaders { | 105 struct ValidationHeaders { |
106 ValidationHeaders() : initialized(false) {} | 106 ValidationHeaders() : initialized(false) {} |
107 | 107 |
108 std::string values[kNumValidationHeaders]; | 108 std::string values[kNumValidationHeaders]; |
109 bool initialized; | 109 bool initialized; |
110 }; | 110 }; |
111 | 111 |
112 enum State { | 112 enum State { |
113 STATE_NONE, | 113 STATE_NONE, |
| 114 STATE_GET_BACKEND, |
| 115 STATE_GET_BACKEND_COMPLETE, |
114 STATE_SEND_REQUEST, | 116 STATE_SEND_REQUEST, |
115 STATE_SEND_REQUEST_COMPLETE, | 117 STATE_SEND_REQUEST_COMPLETE, |
116 STATE_SUCCESSFUL_SEND_REQUEST, | 118 STATE_SUCCESSFUL_SEND_REQUEST, |
117 STATE_NETWORK_READ, | 119 STATE_NETWORK_READ, |
118 STATE_NETWORK_READ_COMPLETE, | 120 STATE_NETWORK_READ_COMPLETE, |
119 STATE_INIT_ENTRY, | 121 STATE_INIT_ENTRY, |
120 STATE_OPEN_ENTRY, | 122 STATE_OPEN_ENTRY, |
121 STATE_OPEN_ENTRY_COMPLETE, | 123 STATE_OPEN_ENTRY_COMPLETE, |
122 STATE_CREATE_ENTRY, | 124 STATE_CREATE_ENTRY, |
123 STATE_CREATE_ENTRY_COMPLETE, | 125 STATE_CREATE_ENTRY_COMPLETE, |
(...skipping 29 matching lines...) Expand all Loading... |
153 | 155 |
154 // This will trigger the completion callback if appropriate. | 156 // This will trigger the completion callback if appropriate. |
155 int HandleResult(int rv); | 157 int HandleResult(int rv); |
156 | 158 |
157 // Runs the state transition loop. | 159 // Runs the state transition loop. |
158 int DoLoop(int result); | 160 int DoLoop(int result); |
159 | 161 |
160 // Each of these methods corresponds to a State value. If there is an | 162 // Each of these methods corresponds to a State value. If there is an |
161 // argument, the value corresponds to the return of the previous state or | 163 // argument, the value corresponds to the return of the previous state or |
162 // corresponding callback. | 164 // corresponding callback. |
| 165 int DoGetBackend(); |
| 166 int DoGetBackendComplete(int result); |
163 int DoSendRequest(); | 167 int DoSendRequest(); |
164 int DoSendRequestComplete(int result); | 168 int DoSendRequestComplete(int result); |
165 int DoSuccessfulSendRequest(); | 169 int DoSuccessfulSendRequest(); |
166 int DoNetworkRead(); | 170 int DoNetworkRead(); |
167 int DoNetworkReadComplete(int result); | 171 int DoNetworkReadComplete(int result); |
168 int DoInitEntry(); | 172 int DoInitEntry(); |
169 int DoOpenEntry(); | 173 int DoOpenEntry(); |
170 int DoOpenEntryComplete(int result); | 174 int DoOpenEntryComplete(int result); |
171 int DoCreateEntry(); | 175 int DoCreateEntry(); |
172 int DoCreateEntryComplete(int result); | 176 int DoCreateEntryComplete(int result); |
(...skipping 22 matching lines...) Expand all Loading... |
195 int DoCacheWriteData(int num_bytes); | 199 int DoCacheWriteData(int num_bytes); |
196 int DoCacheWriteDataComplete(int result); | 200 int DoCacheWriteDataComplete(int result); |
197 | 201 |
198 // Sets request_ and fields derived from it. | 202 // Sets request_ and fields derived from it. |
199 void SetRequest(const BoundNetLog& net_log, const HttpRequestInfo* request); | 203 void SetRequest(const BoundNetLog& net_log, const HttpRequestInfo* request); |
200 | 204 |
201 // Returns true if the request should be handled exclusively by the network | 205 // Returns true if the request should be handled exclusively by the network |
202 // layer (skipping the cache entirely). | 206 // layer (skipping the cache entirely). |
203 bool ShouldPassThrough(); | 207 bool ShouldPassThrough(); |
204 | 208 |
205 // Associates this transaction with a cache entry. | |
206 int AddToEntry(); | |
207 | |
208 // Called to begin reading from the cache. Returns network error code. | 209 // Called to begin reading from the cache. Returns network error code. |
209 int BeginCacheRead(); | 210 int BeginCacheRead(); |
210 | 211 |
211 // Called to begin validating the cache entry. Returns network error code. | 212 // Called to begin validating the cache entry. Returns network error code. |
212 int BeginCacheValidation(); | 213 int BeginCacheValidation(); |
213 | 214 |
214 // Called to begin validating an entry that stores partial content. Returns | 215 // Called to begin validating an entry that stores partial content. Returns |
215 // a network error code. | 216 // a network error code. |
216 int BeginPartialCacheValidation(); | 217 int BeginPartialCacheValidation(); |
217 | 218 |
218 // Validates the entry headers against the requested range and continues with | 219 // Validates the entry headers against the requested range and continues with |
219 // the validation of the rest of the entry. Returns a network error code. | 220 // the validation of the rest of the entry. Returns a network error code. |
220 int ValidateEntryHeadersAndContinue(bool byte_range_requested); | 221 int ValidateEntryHeadersAndContinue(bool byte_range_requested); |
221 | 222 |
222 // Called to start requests which were given an "if-modified-since" or | 223 // Called to start requests which were given an "if-modified-since" or |
223 // "if-none-match" validation header by the caller (NOT when the request was | 224 // "if-none-match" validation header by the caller (NOT when the request was |
224 // conditionalized internally in response to LOAD_VALIDATE_CACHE). | 225 // conditionalized internally in response to LOAD_VALIDATE_CACHE). |
225 // Returns a network error code. | 226 // Returns a network error code. |
226 int BeginExternallyConditionalizedRequest(); | 227 int BeginExternallyConditionalizedRequest(); |
227 | 228 |
228 // Called to begin a network transaction. Returns network error code. | |
229 int BeginNetworkRequest(); | |
230 | |
231 // Called to restart a network transaction after an error. Returns network | 229 // Called to restart a network transaction after an error. Returns network |
232 // error code. | 230 // error code. |
233 int RestartNetworkRequest(); | 231 int RestartNetworkRequest(); |
234 | 232 |
235 // Called to restart a network transaction with a client certificate. | 233 // Called to restart a network transaction with a client certificate. |
236 // Returns network error code. | 234 // Returns network error code. |
237 int RestartNetworkRequestWithCertificate(X509Certificate* client_cert); | 235 int RestartNetworkRequestWithCertificate(X509Certificate* client_cert); |
238 | 236 |
239 // Called to restart a network transaction with authentication credentials. | 237 // Called to restart a network transaction with authentication credentials. |
240 // Returns network error code. | 238 // Returns network error code. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 bool cache_pending_; // We are waiting for the HttpCache. | 323 bool cache_pending_; // We are waiting for the HttpCache. |
326 scoped_refptr<IOBuffer> read_buf_; | 324 scoped_refptr<IOBuffer> read_buf_; |
327 int io_buf_len_; | 325 int io_buf_len_; |
328 int read_offset_; | 326 int read_offset_; |
329 int effective_load_flags_; | 327 int effective_load_flags_; |
330 scoped_ptr<PartialData> partial_; // We are dealing with range requests. | 328 scoped_ptr<PartialData> partial_; // We are dealing with range requests. |
331 uint64 final_upload_progress_; | 329 uint64 final_upload_progress_; |
332 CompletionCallbackImpl<Transaction> io_callback_; | 330 CompletionCallbackImpl<Transaction> io_callback_; |
333 scoped_refptr<CancelableCompletionCallback<Transaction> > cache_callback_; | 331 scoped_refptr<CancelableCompletionCallback<Transaction> > cache_callback_; |
334 scoped_refptr<CancelableCompletionCallback<Transaction> > | 332 scoped_refptr<CancelableCompletionCallback<Transaction> > |
335 write_headers_callback_; | 333 write_headers_callback_; |
336 }; | 334 }; |
337 | 335 |
338 } // namespace net | 336 } // namespace net |
339 | 337 |
340 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 338 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
OLD | NEW |