| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 const BeforeNetworkStartCallback& callback) override; | 169 const BeforeNetworkStartCallback& callback) override; |
| 170 void SetBeforeHeadersSentCallback( | 170 void SetBeforeHeadersSentCallback( |
| 171 const BeforeHeadersSentCallback& callback) override; | 171 const BeforeHeadersSentCallback& callback) override; |
| 172 int ResumeNetworkStart() override; | 172 int ResumeNetworkStart() override; |
| 173 void GetConnectionAttempts(ConnectionAttempts* out) const override; | 173 void GetConnectionAttempts(ConnectionAttempts* out) const override; |
| 174 | 174 |
| 175 // Invoked when parallel validation cannot proceed due to response failure | 175 // Invoked when parallel validation cannot proceed due to response failure |
| 176 // and this transaction needs to be restarted. | 176 // and this transaction needs to be restarted. |
| 177 void SetValidatingCannotProceed(); | 177 void SetValidatingCannotProceed(); |
| 178 | 178 |
| 179 // Invoked to remove the association between a transaction waiting to be |
| 180 // added to an entry and the entry. |
| 181 void ResetCachePendingState() { cache_pending_ = false; } |
| 182 |
| 179 // Returns the estimate of dynamically allocated memory in bytes. | 183 // Returns the estimate of dynamically allocated memory in bytes. |
| 180 size_t EstimateMemoryUsage() const; | 184 size_t EstimateMemoryUsage() const; |
| 181 | 185 |
| 186 // Sets fail state such that a future Read fails with |error_code|. |
| 187 void SetSharedWritingFailState(int error_code); |
| 188 |
| 189 RequestPriority priority() const { return priority_; } |
| 190 PartialData* partial() { return partial_.get(); } |
| 191 |
| 182 private: | 192 private: |
| 183 static const size_t kNumValidationHeaders = 2; | 193 static const size_t kNumValidationHeaders = 2; |
| 184 // Helper struct to pair a header name with its value, for | 194 // Helper struct to pair a header name with its value, for |
| 185 // headers used to validate cache entries. | 195 // headers used to validate cache entries. |
| 186 struct ValidationHeaders { | 196 struct ValidationHeaders { |
| 187 ValidationHeaders() : initialized(false) {} | 197 ValidationHeaders() : initialized(false) {} |
| 188 | 198 |
| 189 std::string values[kNumValidationHeaders]; | 199 std::string values[kNumValidationHeaders]; |
| 190 void Reset() { | 200 void Reset() { |
| 191 initialized = false; | 201 initialized = false; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 204 STATE_GET_BACKEND_COMPLETE, | 214 STATE_GET_BACKEND_COMPLETE, |
| 205 STATE_INIT_ENTRY, | 215 STATE_INIT_ENTRY, |
| 206 STATE_OPEN_ENTRY, | 216 STATE_OPEN_ENTRY, |
| 207 STATE_OPEN_ENTRY_COMPLETE, | 217 STATE_OPEN_ENTRY_COMPLETE, |
| 208 STATE_DOOM_ENTRY, | 218 STATE_DOOM_ENTRY, |
| 209 STATE_DOOM_ENTRY_COMPLETE, | 219 STATE_DOOM_ENTRY_COMPLETE, |
| 210 STATE_CREATE_ENTRY, | 220 STATE_CREATE_ENTRY, |
| 211 STATE_CREATE_ENTRY_COMPLETE, | 221 STATE_CREATE_ENTRY_COMPLETE, |
| 212 STATE_ADD_TO_ENTRY, | 222 STATE_ADD_TO_ENTRY, |
| 213 STATE_ADD_TO_ENTRY_COMPLETE, | 223 STATE_ADD_TO_ENTRY_COMPLETE, |
| 224 STATE_DONE_HEADERS_ADD_TO_ENTRY_COMPLETE, |
| 214 STATE_CACHE_READ_RESPONSE, | 225 STATE_CACHE_READ_RESPONSE, |
| 215 STATE_CACHE_READ_RESPONSE_COMPLETE, | 226 STATE_CACHE_READ_RESPONSE_COMPLETE, |
| 216 STATE_TOGGLE_UNUSED_SINCE_PREFETCH, | 227 STATE_TOGGLE_UNUSED_SINCE_PREFETCH, |
| 217 STATE_TOGGLE_UNUSED_SINCE_PREFETCH_COMPLETE, | 228 STATE_TOGGLE_UNUSED_SINCE_PREFETCH_COMPLETE, |
| 218 STATE_CACHE_DISPATCH_VALIDATION, | 229 STATE_CACHE_DISPATCH_VALIDATION, |
| 219 STATE_CACHE_QUERY_DATA, | 230 STATE_CACHE_QUERY_DATA, |
| 220 STATE_CACHE_QUERY_DATA_COMPLETE, | 231 STATE_CACHE_QUERY_DATA_COMPLETE, |
| 221 STATE_START_PARTIAL_CACHE_VALIDATION, | 232 STATE_START_PARTIAL_CACHE_VALIDATION, |
| 222 STATE_COMPLETE_PARTIAL_CACHE_VALIDATION, | 233 STATE_COMPLETE_PARTIAL_CACHE_VALIDATION, |
| 223 STATE_SEND_REQUEST, | 234 STATE_SEND_REQUEST, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 int DoGetBackendComplete(int result); | 286 int DoGetBackendComplete(int result); |
| 276 int DoInitEntry(); | 287 int DoInitEntry(); |
| 277 int DoOpenEntry(); | 288 int DoOpenEntry(); |
| 278 int DoOpenEntryComplete(int result); | 289 int DoOpenEntryComplete(int result); |
| 279 int DoDoomEntry(); | 290 int DoDoomEntry(); |
| 280 int DoDoomEntryComplete(int result); | 291 int DoDoomEntryComplete(int result); |
| 281 int DoCreateEntry(); | 292 int DoCreateEntry(); |
| 282 int DoCreateEntryComplete(int result); | 293 int DoCreateEntryComplete(int result); |
| 283 int DoAddToEntry(); | 294 int DoAddToEntry(); |
| 284 int DoAddToEntryComplete(int result); | 295 int DoAddToEntryComplete(int result); |
| 296 int DoDoneHeadersAddToEntryComplete(int result); |
| 285 int DoCacheReadResponse(); | 297 int DoCacheReadResponse(); |
| 286 int DoCacheReadResponseComplete(int result); | 298 int DoCacheReadResponseComplete(int result); |
| 287 int DoCacheToggleUnusedSincePrefetch(); | 299 int DoCacheToggleUnusedSincePrefetch(); |
| 288 int DoCacheToggleUnusedSincePrefetchComplete(int result); | 300 int DoCacheToggleUnusedSincePrefetchComplete(int result); |
| 289 int DoCacheDispatchValidation(); | 301 int DoCacheDispatchValidation(); |
| 290 int DoCacheQueryData(); | 302 int DoCacheQueryData(); |
| 291 int DoCacheQueryDataComplete(int result); | 303 int DoCacheQueryDataComplete(int result); |
| 292 int DoStartPartialCacheValidation(); | 304 int DoStartPartialCacheValidation(); |
| 293 int DoCompletePartialCacheValidation(int result); | 305 int DoCompletePartialCacheValidation(int result); |
| 294 int DoSendRequest(); | 306 int DoSendRequest(); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 std::string cache_key_; | 507 std::string cache_key_; |
| 496 Mode mode_; | 508 Mode mode_; |
| 497 bool reading_; // We are already reading. Never reverts to false once set. | 509 bool reading_; // We are already reading. Never reverts to false once set. |
| 498 bool invalid_range_; // We may bypass the cache for this request. | 510 bool invalid_range_; // We may bypass the cache for this request. |
| 499 bool truncated_; // We don't have all the response data. | 511 bool truncated_; // We don't have all the response data. |
| 500 bool is_sparse_; // The data is stored in sparse byte ranges. | 512 bool is_sparse_; // The data is stored in sparse byte ranges. |
| 501 bool range_requested_; // The user requested a byte range. | 513 bool range_requested_; // The user requested a byte range. |
| 502 bool handling_206_; // We must deal with this 206 response. | 514 bool handling_206_; // We must deal with this 206 response. |
| 503 bool cache_pending_; // We are waiting for the HttpCache. | 515 bool cache_pending_; // We are waiting for the HttpCache. |
| 504 bool done_reading_; // All available data was read. | 516 bool done_reading_; // All available data was read. |
| 517 |
| 518 // Headers have been received from the network and it's not a match with the |
| 519 // existing entry. |
| 520 bool done_headers_create_new_entry_; |
| 521 |
| 505 bool vary_mismatch_; // The request doesn't match the stored vary data. | 522 bool vary_mismatch_; // The request doesn't match the stored vary data. |
| 506 bool couldnt_conditionalize_request_; | 523 bool couldnt_conditionalize_request_; |
| 507 bool bypass_lock_for_test_; // A test is exercising the cache lock. | 524 bool bypass_lock_for_test_; // A test is exercising the cache lock. |
| 508 bool bypass_lock_after_headers_for_test_; // A test is exercising the cache | 525 bool bypass_lock_after_headers_for_test_; // A test is exercising the cache |
| 509 // lock. | 526 // lock. |
| 510 bool fail_conditionalization_for_test_; // Fail ConditionalizeRequest. | 527 bool fail_conditionalization_for_test_; // Fail ConditionalizeRequest. |
| 511 scoped_refptr<IOBuffer> read_buf_; | 528 scoped_refptr<IOBuffer> read_buf_; |
| 512 int io_buf_len_; | 529 int io_buf_len_; |
| 513 int read_offset_; | 530 int read_offset_; |
| 514 int effective_load_flags_; | 531 int effective_load_flags_; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 bool in_do_loop_; | 572 bool in_do_loop_; |
| 556 | 573 |
| 557 base::WeakPtrFactory<Transaction> weak_factory_; | 574 base::WeakPtrFactory<Transaction> weak_factory_; |
| 558 | 575 |
| 559 DISALLOW_COPY_AND_ASSIGN(Transaction); | 576 DISALLOW_COPY_AND_ASSIGN(Transaction); |
| 560 }; | 577 }; |
| 561 | 578 |
| 562 } // namespace net | 579 } // namespace net |
| 563 | 580 |
| 564 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 581 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
| OLD | NEW |