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 // 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 // partial entry. | 303 // partial entry. |
304 bool ValidatePartialResponse(); | 304 bool ValidatePartialResponse(); |
305 | 305 |
306 // Handles a response validation error by bypassing the cache. | 306 // Handles a response validation error by bypassing the cache. |
307 void IgnoreRangeRequest(); | 307 void IgnoreRangeRequest(); |
308 | 308 |
309 // Changes the response code of a range request to be 416 (Requested range not | 309 // Changes the response code of a range request to be 416 (Requested range not |
310 // satisfiable). | 310 // satisfiable). |
311 void FailRangeRequest(); | 311 void FailRangeRequest(); |
312 | 312 |
| 313 // Setups the transaction for reading from the cache entry. |
| 314 int SetupEntryForRead(); |
| 315 |
313 // Reads data from the network. | 316 // Reads data from the network. |
314 int ReadFromNetwork(IOBuffer* data, int data_len); | 317 int ReadFromNetwork(IOBuffer* data, int data_len); |
315 | 318 |
316 // Reads data from the cache entry. | 319 // Reads data from the cache entry. |
317 int ReadFromEntry(IOBuffer* data, int data_len); | 320 int ReadFromEntry(IOBuffer* data, int data_len); |
318 | 321 |
319 // Called to write data to the cache entry. If the write fails, then the | 322 // Called to write data to the cache entry. If the write fails, then the |
320 // cache entry is destroyed. Future calls to this function will just do | 323 // cache entry is destroyed. Future calls to this function will just do |
321 // nothing without side-effect. Returns a network error code. | 324 // nothing without side-effect. Returns a network error code. |
322 int WriteToEntry(int index, int offset, IOBuffer* data, int data_len, | 325 int WriteToEntry(int index, int offset, IOBuffer* data, int data_len, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 State target_state_; | 409 State target_state_; |
407 bool reading_; // We are already reading. | 410 bool reading_; // We are already reading. |
408 bool invalid_range_; // We may bypass the cache for this request. | 411 bool invalid_range_; // We may bypass the cache for this request. |
409 bool truncated_; // We don't have all the response data. | 412 bool truncated_; // We don't have all the response data. |
410 bool is_sparse_; // The data is stored in sparse byte ranges. | 413 bool is_sparse_; // The data is stored in sparse byte ranges. |
411 bool range_requested_; // The user requested a byte range. | 414 bool range_requested_; // The user requested a byte range. |
412 bool handling_206_; // We must deal with this 206 response. | 415 bool handling_206_; // We must deal with this 206 response. |
413 bool cache_pending_; // We are waiting for the HttpCache. | 416 bool cache_pending_; // We are waiting for the HttpCache. |
414 bool done_reading_; | 417 bool done_reading_; |
415 bool vary_mismatch_; // The request doesn't match the stored vary data. | 418 bool vary_mismatch_; // The request doesn't match the stored vary data. |
| 419 bool couldnt_conditionalize_request_; |
416 scoped_refptr<IOBuffer> read_buf_; | 420 scoped_refptr<IOBuffer> read_buf_; |
417 int io_buf_len_; | 421 int io_buf_len_; |
418 int read_offset_; | 422 int read_offset_; |
419 int effective_load_flags_; | 423 int effective_load_flags_; |
420 int write_len_; | 424 int write_len_; |
421 scoped_ptr<PartialData> partial_; // We are dealing with range requests. | 425 scoped_ptr<PartialData> partial_; // We are dealing with range requests. |
422 UploadProgress final_upload_progress_; | 426 UploadProgress final_upload_progress_; |
423 base::WeakPtrFactory<Transaction> weak_factory_; | 427 base::WeakPtrFactory<Transaction> weak_factory_; |
424 CompletionCallback io_callback_; | 428 CompletionCallback io_callback_; |
425 | 429 |
(...skipping 22 matching lines...) Expand all Loading... |
448 | 452 |
449 #if !defined(NDEBUG) | 453 #if !defined(NDEBUG) |
450 // Record of all states this transaction has moved through. | 454 // Record of all states this transaction has moved through. |
451 std::vector<int> state_path_; | 455 std::vector<int> state_path_; |
452 #endif | 456 #endif |
453 }; | 457 }; |
454 | 458 |
455 } // namespace net | 459 } // namespace net |
456 | 460 |
457 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 461 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
OLD | NEW |