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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 const CompletionCallback& io_callback() { return io_callback_; } | 103 const CompletionCallback& io_callback() { return io_callback_; } |
104 | 104 |
105 const BoundNetLog& net_log() const; | 105 const BoundNetLog& net_log() const; |
106 | 106 |
107 // Bypasses the cache lock whenever there is lock contention. | 107 // Bypasses the cache lock whenever there is lock contention. |
108 void BypassLockForTest() { | 108 void BypassLockForTest() { |
109 bypass_lock_for_test_ = true; | 109 bypass_lock_for_test_ = true; |
110 } | 110 } |
111 | 111 |
| 112 // Generates a failure when attempting to conditionalize a network request. |
| 113 void FailConditionalizationForTest() { |
| 114 fail_conditionalization_for_test_ = true; |
| 115 } |
| 116 |
112 // HttpTransaction methods: | 117 // HttpTransaction methods: |
113 int Start(const HttpRequestInfo* request_info, | 118 int Start(const HttpRequestInfo* request_info, |
114 const CompletionCallback& callback, | 119 const CompletionCallback& callback, |
115 const BoundNetLog& net_log) override; | 120 const BoundNetLog& net_log) override; |
116 int RestartIgnoringLastError(const CompletionCallback& callback) override; | 121 int RestartIgnoringLastError(const CompletionCallback& callback) override; |
117 int RestartWithCertificate(X509Certificate* client_cert, | 122 int RestartWithCertificate(X509Certificate* client_cert, |
118 const CompletionCallback& callback) override; | 123 const CompletionCallback& callback) override; |
119 int RestartWithAuth(const AuthCredentials& credentials, | 124 int RestartWithAuth(const AuthCredentials& credentials, |
120 const CompletionCallback& callback) override; | 125 const CompletionCallback& callback) override; |
121 bool IsReadyToRestartForAuth() override; | 126 bool IsReadyToRestartForAuth() override; |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 384 |
380 // Performs the needed work after receiving data from the cache, when | 385 // Performs the needed work after receiving data from the cache, when |
381 // working with range requests. | 386 // working with range requests. |
382 int DoPartialCacheReadCompleted(int result); | 387 int DoPartialCacheReadCompleted(int result); |
383 | 388 |
384 // Restarts this transaction after deleting the cached data. It is meant to | 389 // Restarts this transaction after deleting the cached data. It is meant to |
385 // be used when the current request cannot be fulfilled due to conflicts | 390 // be used when the current request cannot be fulfilled due to conflicts |
386 // between the byte range request and the cached entry. | 391 // between the byte range request and the cached entry. |
387 int DoRestartPartialRequest(); | 392 int DoRestartPartialRequest(); |
388 | 393 |
| 394 // Resets the relavant internal state to remove traces of internal processing |
| 395 // related to range requests. Deletes |partial_| if |delete_object| is true. |
| 396 void ResetPartialState(bool delete_object); |
| 397 |
389 // Resets |network_trans_|, which must be non-NULL. Also updates | 398 // Resets |network_trans_|, which must be non-NULL. Also updates |
390 // |old_network_trans_load_timing_|, which must be NULL when this is called. | 399 // |old_network_trans_load_timing_|, which must be NULL when this is called. |
391 void ResetNetworkTransaction(); | 400 void ResetNetworkTransaction(); |
392 | 401 |
393 // Returns true if we should bother attempting to resume this request if it | 402 // Returns true if we should bother attempting to resume this request if it |
394 // is aborted while in progress. If |has_data| is true, the size of the stored | 403 // is aborted while in progress. If |has_data| is true, the size of the stored |
395 // data is considered for the result. | 404 // data is considered for the result. |
396 bool CanResume(bool has_data); | 405 bool CanResume(bool has_data); |
397 | 406 |
398 void UpdateTransactionPattern(TransactionPattern new_transaction_pattern); | 407 void UpdateTransactionPattern(TransactionPattern new_transaction_pattern); |
(...skipping 26 matching lines...) Expand all Loading... |
425 bool invalid_range_; // We may bypass the cache for this request. | 434 bool invalid_range_; // We may bypass the cache for this request. |
426 bool truncated_; // We don't have all the response data. | 435 bool truncated_; // We don't have all the response data. |
427 bool is_sparse_; // The data is stored in sparse byte ranges. | 436 bool is_sparse_; // The data is stored in sparse byte ranges. |
428 bool range_requested_; // The user requested a byte range. | 437 bool range_requested_; // The user requested a byte range. |
429 bool handling_206_; // We must deal with this 206 response. | 438 bool handling_206_; // We must deal with this 206 response. |
430 bool cache_pending_; // We are waiting for the HttpCache. | 439 bool cache_pending_; // We are waiting for the HttpCache. |
431 bool done_reading_; // All available data was read. | 440 bool done_reading_; // All available data was read. |
432 bool vary_mismatch_; // The request doesn't match the stored vary data. | 441 bool vary_mismatch_; // The request doesn't match the stored vary data. |
433 bool couldnt_conditionalize_request_; | 442 bool couldnt_conditionalize_request_; |
434 bool bypass_lock_for_test_; // A test is exercising the cache lock. | 443 bool bypass_lock_for_test_; // A test is exercising the cache lock. |
| 444 bool fail_conditionalization_for_test_; // Fail ConditionalizeRequest. |
435 scoped_refptr<IOBuffer> read_buf_; | 445 scoped_refptr<IOBuffer> read_buf_; |
436 int io_buf_len_; | 446 int io_buf_len_; |
437 int read_offset_; | 447 int read_offset_; |
438 int effective_load_flags_; | 448 int effective_load_flags_; |
439 int write_len_; | 449 int write_len_; |
440 scoped_ptr<PartialData> partial_; // We are dealing with range requests. | 450 scoped_ptr<PartialData> partial_; // We are dealing with range requests. |
441 UploadProgress final_upload_progress_; | 451 UploadProgress final_upload_progress_; |
442 CompletionCallback io_callback_; | 452 CompletionCallback io_callback_; |
443 | 453 |
444 // Members used to track data for histograms. | 454 // Members used to track data for histograms. |
(...skipping 20 matching lines...) Expand all Loading... |
465 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; | 475 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; |
466 | 476 |
467 base::WeakPtrFactory<Transaction> weak_factory_; | 477 base::WeakPtrFactory<Transaction> weak_factory_; |
468 | 478 |
469 DISALLOW_COPY_AND_ASSIGN(Transaction); | 479 DISALLOW_COPY_AND_ASSIGN(Transaction); |
470 }; | 480 }; |
471 | 481 |
472 } // namespace net | 482 } // namespace net |
473 | 483 |
474 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 484 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
OLD | NEW |