Chromium Code Reviews| 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 368 int WriteResponseInfoToEntry(bool truncated); | 368 int WriteResponseInfoToEntry(bool truncated); |
| 369 | 369 |
| 370 // Helper function, should be called with result of WriteResponseInfoToEntry | 370 // Helper function, should be called with result of WriteResponseInfoToEntry |
| 371 // (or the result of the callback, when WriteResponseInfoToEntry returns | 371 // (or the result of the callback, when WriteResponseInfoToEntry returns |
| 372 // ERR_IO_PENDING). Calls DoneWritingToEntry if |result| is not the right | 372 // ERR_IO_PENDING). Calls DoneWritingToEntry if |result| is not the right |
| 373 // number of bytes. It is expected that the state that calls this will | 373 // number of bytes. It is expected that the state that calls this will |
| 374 // return whatever net error code this function returns, which currently | 374 // return whatever net error code this function returns, which currently |
| 375 // is always "OK". | 375 // is always "OK". |
| 376 int OnWriteResponseInfoToEntryComplete(int result); | 376 int OnWriteResponseInfoToEntryComplete(int result); |
| 377 | 377 |
| 378 // Called when the entire request has successfully finished reading. May start | |
|
hubbe
2015/07/16 15:56:12
Please specify if you mean that the client has fin
asanka
2015/07/16 17:57:00
Done.
| |
| 379 // the state machine again. Hence should only be called when there are no more | |
| 380 // pending operations. | |
| 381 int DoneWithRequest(); | |
| 382 | |
| 378 // Called when we are done writing to the cache entry. | 383 // Called when we are done writing to the cache entry. |
| 379 void DoneWritingToEntry(bool success); | 384 void DoneWritingToEntry(bool success); |
| 380 | 385 |
| 386 // Called when we are done with the cache entry. | |
| 387 void DoneWithEntry(bool cancel); | |
| 388 | |
| 381 // Returns an error to signal the caller that the current read failed. The | 389 // Returns an error to signal the caller that the current read failed. The |
| 382 // current operation |result| is also logged. If |restart| is true, the | 390 // current operation |result| is also logged. If |restart| is true, the |
| 383 // transaction should be restarted. | 391 // transaction should be restarted. |
| 384 int OnCacheReadError(int result, bool restart); | 392 int OnCacheReadError(int result, bool restart); |
| 385 | 393 |
| 386 // Called when the cache lock timeout fires. | 394 // Called when the cache lock timeout fires. |
| 387 void OnAddToEntryTimeout(base::TimeTicks start_time); | 395 void OnAddToEntryTimeout(base::TimeTicks start_time); |
| 388 | 396 |
| 389 // Deletes the current partial cache entry (sparse), and optionally removes | 397 // Deletes the current partial cache entry (sparse), and optionally removes |
| 390 // the control object (partial_). | 398 // the control object (partial_). |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 HttpCache::ActiveEntry* entry_; | 443 HttpCache::ActiveEntry* entry_; |
| 436 HttpCache::ActiveEntry* new_entry_; | 444 HttpCache::ActiveEntry* new_entry_; |
| 437 scoped_ptr<HttpTransaction> network_trans_; | 445 scoped_ptr<HttpTransaction> network_trans_; |
| 438 CompletionCallback callback_; // Consumer's callback. | 446 CompletionCallback callback_; // Consumer's callback. |
| 439 HttpResponseInfo response_; | 447 HttpResponseInfo response_; |
| 440 HttpResponseInfo auth_response_; | 448 HttpResponseInfo auth_response_; |
| 441 const HttpResponseInfo* new_response_; | 449 const HttpResponseInfo* new_response_; |
| 442 std::string cache_key_; | 450 std::string cache_key_; |
| 443 Mode mode_; | 451 Mode mode_; |
| 444 bool reading_; // We are already reading. Never reverts to false once set. | 452 bool reading_; // We are already reading. Never reverts to false once set. |
| 445 bool invalid_range_; // We may bypass the cache for this request. | 453 bool invalid_range_; // We may bypass the cache for this request. |
| 446 bool truncated_; // We don't have all the response data. | 454 bool truncated_; // We don't have all the response data. |
| 447 bool is_sparse_; // The data is stored in sparse byte ranges. | 455 bool is_sparse_; // The data is stored in sparse byte ranges. |
| 448 bool range_requested_; // The user requested a byte range. | 456 bool range_requested_; // The user requested a byte range. |
| 449 bool handling_206_; // We must deal with this 206 response. | 457 bool handling_206_; // We must deal with this 206 response. |
| 450 bool cache_pending_; // We are waiting for the HttpCache. | 458 bool cache_pending_; // We are waiting for the HttpCache. |
| 451 bool done_reading_; // All available data was read. | 459 bool done_writing_; // All available data was written to the cache entry. |
| 452 bool vary_mismatch_; // The request doesn't match the stored vary data. | 460 bool vary_mismatch_; // The request doesn't match the stored vary data. |
| 453 bool couldnt_conditionalize_request_; | 461 bool couldnt_conditionalize_request_; |
| 462 bool stopped_caching_; // Avoid further writes to the cache. | |
| 454 bool bypass_lock_for_test_; // A test is exercising the cache lock. | 463 bool bypass_lock_for_test_; // A test is exercising the cache lock. |
| 455 bool fail_conditionalization_for_test_; // Fail ConditionalizeRequest. | 464 bool fail_conditionalization_for_test_; // Fail ConditionalizeRequest. |
| 456 scoped_refptr<IOBuffer> read_buf_; | 465 scoped_refptr<IOBuffer> read_buf_; |
| 457 int io_buf_len_; | 466 int io_buf_len_; |
| 458 int read_offset_; | 467 int read_offset_; |
| 459 int effective_load_flags_; | 468 int effective_load_flags_; |
| 460 int write_len_; | 469 int write_len_; |
| 461 scoped_ptr<PartialData> partial_; // We are dealing with range requests. | 470 scoped_ptr<PartialData> partial_; // We are dealing with range requests. |
| 462 UploadProgress final_upload_progress_; | 471 UploadProgress final_upload_progress_; |
| 463 CompletionCallback io_callback_; | 472 CompletionCallback io_callback_; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 488 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; | 497 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; |
| 489 | 498 |
| 490 base::WeakPtrFactory<Transaction> weak_factory_; | 499 base::WeakPtrFactory<Transaction> weak_factory_; |
| 491 | 500 |
| 492 DISALLOW_COPY_AND_ASSIGN(Transaction); | 501 DISALLOW_COPY_AND_ASSIGN(Transaction); |
| 493 }; | 502 }; |
| 494 | 503 |
| 495 } // namespace net | 504 } // namespace net |
| 496 | 505 |
| 497 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 506 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
| OLD | NEW |