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