| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 void SetPriority(RequestPriority priority) override; | 157 void SetPriority(RequestPriority priority) override; |
| 158 void SetWebSocketHandshakeStreamCreateHelper( | 158 void SetWebSocketHandshakeStreamCreateHelper( |
| 159 WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; | 159 WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; |
| 160 void SetBeforeNetworkStartCallback( | 160 void SetBeforeNetworkStartCallback( |
| 161 const BeforeNetworkStartCallback& callback) override; | 161 const BeforeNetworkStartCallback& callback) override; |
| 162 void SetBeforeHeadersSentCallback( | 162 void SetBeforeHeadersSentCallback( |
| 163 const BeforeHeadersSentCallback& callback) override; | 163 const BeforeHeadersSentCallback& callback) override; |
| 164 int ResumeNetworkStart() override; | 164 int ResumeNetworkStart() override; |
| 165 void GetConnectionAttempts(ConnectionAttempts* out) const override; | 165 void GetConnectionAttempts(ConnectionAttempts* out) const override; |
| 166 | 166 |
| 167 // Invoked when parallel validation cannot proceed due to response failure |
| 168 // and this transaction needs to be restarted. |
| 169 void SetValidatingCannotProceed(); |
| 170 |
| 167 // Returns the estimate of dynamically allocated memory in bytes. | 171 // Returns the estimate of dynamically allocated memory in bytes. |
| 168 size_t EstimateMemoryUsage() const; | 172 size_t EstimateMemoryUsage() const; |
| 169 | 173 |
| 170 private: | 174 private: |
| 171 static const size_t kNumValidationHeaders = 2; | 175 static const size_t kNumValidationHeaders = 2; |
| 172 // Helper struct to pair a header name with its value, for | 176 // Helper struct to pair a header name with its value, for |
| 173 // headers used to validate cache entries. | 177 // headers used to validate cache entries. |
| 174 struct ValidationHeaders { | 178 struct ValidationHeaders { |
| 175 ValidationHeaders() : initialized(false) {} | 179 ValidationHeaders() : initialized(false) {} |
| 176 | 180 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 STATE_OVERWRITE_CACHED_RESPONSE, | 217 STATE_OVERWRITE_CACHED_RESPONSE, |
| 214 STATE_CACHE_WRITE_RESPONSE, | 218 STATE_CACHE_WRITE_RESPONSE, |
| 215 STATE_CACHE_WRITE_RESPONSE_COMPLETE, | 219 STATE_CACHE_WRITE_RESPONSE_COMPLETE, |
| 216 STATE_TRUNCATE_CACHED_DATA, | 220 STATE_TRUNCATE_CACHED_DATA, |
| 217 STATE_TRUNCATE_CACHED_DATA_COMPLETE, | 221 STATE_TRUNCATE_CACHED_DATA_COMPLETE, |
| 218 STATE_TRUNCATE_CACHED_METADATA, | 222 STATE_TRUNCATE_CACHED_METADATA, |
| 219 STATE_TRUNCATE_CACHED_METADATA_COMPLETE, | 223 STATE_TRUNCATE_CACHED_METADATA_COMPLETE, |
| 220 STATE_PARTIAL_HEADERS_RECEIVED, | 224 STATE_PARTIAL_HEADERS_RECEIVED, |
| 221 STATE_CACHE_READ_METADATA, | 225 STATE_CACHE_READ_METADATA, |
| 222 STATE_CACHE_READ_METADATA_COMPLETE, | 226 STATE_CACHE_READ_METADATA_COMPLETE, |
| 227 STATE_HEADERS_PHASE_CANNOT_PROCEED, |
| 228 STATE_FINISH_HEADERS, |
| 229 STATE_FINISH_HEADERS_COMPLETE, |
| 223 | 230 |
| 224 // These states are entered from Read/AddTruncatedFlag. | 231 // These states are entered from Read/AddTruncatedFlag. |
| 225 STATE_NETWORK_READ, | 232 STATE_NETWORK_READ, |
| 226 STATE_NETWORK_READ_COMPLETE, | 233 STATE_NETWORK_READ_COMPLETE, |
| 227 STATE_CACHE_READ_DATA, | 234 STATE_CACHE_READ_DATA, |
| 228 STATE_CACHE_READ_DATA_COMPLETE, | 235 STATE_CACHE_READ_DATA_COMPLETE, |
| 229 STATE_CACHE_WRITE_DATA, | 236 STATE_CACHE_WRITE_DATA, |
| 230 STATE_CACHE_WRITE_DATA_COMPLETE, | 237 STATE_CACHE_WRITE_DATA_COMPLETE, |
| 231 STATE_CACHE_WRITE_TRUNCATED_RESPONSE, | 238 STATE_CACHE_WRITE_TRUNCATED_RESPONSE, |
| 232 STATE_CACHE_WRITE_TRUNCATED_RESPONSE_COMPLETE | 239 STATE_CACHE_WRITE_TRUNCATED_RESPONSE_COMPLETE |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 int DoCacheWriteUpdatedResponseComplete(int result); | 286 int DoCacheWriteUpdatedResponseComplete(int result); |
| 280 int DoUpdateCachedResponseComplete(int result); | 287 int DoUpdateCachedResponseComplete(int result); |
| 281 int DoOverwriteCachedResponse(); | 288 int DoOverwriteCachedResponse(); |
| 282 int DoCacheWriteResponse(); | 289 int DoCacheWriteResponse(); |
| 283 int DoCacheWriteResponseComplete(int result); | 290 int DoCacheWriteResponseComplete(int result); |
| 284 int DoTruncateCachedData(); | 291 int DoTruncateCachedData(); |
| 285 int DoTruncateCachedDataComplete(int result); | 292 int DoTruncateCachedDataComplete(int result); |
| 286 int DoTruncateCachedMetadata(); | 293 int DoTruncateCachedMetadata(); |
| 287 int DoTruncateCachedMetadataComplete(int result); | 294 int DoTruncateCachedMetadataComplete(int result); |
| 288 int DoPartialHeadersReceived(); | 295 int DoPartialHeadersReceived(); |
| 296 int DoHeadersPhaseCannotProceed(); |
| 297 int DoFinishHeaders(int result); |
| 298 int DoFinishHeadersComplete(int result); |
| 289 int DoCacheReadMetadata(); | 299 int DoCacheReadMetadata(); |
| 290 int DoCacheReadMetadataComplete(int result); | 300 int DoCacheReadMetadataComplete(int result); |
| 291 int DoNetworkRead(); | 301 int DoNetworkRead(); |
| 292 int DoNetworkReadComplete(int result); | 302 int DoNetworkReadComplete(int result); |
| 293 int DoCacheReadData(); | 303 int DoCacheReadData(); |
| 294 int DoCacheReadDataComplete(int result); | 304 int DoCacheReadDataComplete(int result); |
| 295 int DoCacheWriteData(int num_bytes); | 305 int DoCacheWriteData(int num_bytes); |
| 296 int DoCacheWriteDataComplete(int result); | 306 int DoCacheWriteDataComplete(int result); |
| 297 int DoCacheWriteTruncatedResponse(); | 307 int DoCacheWriteTruncatedResponse(); |
| 298 int DoCacheWriteTruncatedResponseComplete(int result); | 308 int DoCacheWriteTruncatedResponseComplete(int result); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 base::WeakPtr<HttpCache> cache_; | 460 base::WeakPtr<HttpCache> cache_; |
| 451 HttpCache::ActiveEntry* entry_; | 461 HttpCache::ActiveEntry* entry_; |
| 452 HttpCache::ActiveEntry* new_entry_; | 462 HttpCache::ActiveEntry* new_entry_; |
| 453 std::unique_ptr<HttpTransaction> network_trans_; | 463 std::unique_ptr<HttpTransaction> network_trans_; |
| 454 CompletionCallback callback_; // Consumer's callback. | 464 CompletionCallback callback_; // Consumer's callback. |
| 455 HttpResponseInfo response_; | 465 HttpResponseInfo response_; |
| 456 HttpResponseInfo auth_response_; | 466 HttpResponseInfo auth_response_; |
| 457 const HttpResponseInfo* new_response_; | 467 const HttpResponseInfo* new_response_; |
| 458 std::string cache_key_; | 468 std::string cache_key_; |
| 459 Mode mode_; | 469 Mode mode_; |
| 470 Mode original_mode_; // Used when restarting the transaction. |
| 460 bool reading_; // We are already reading. Never reverts to false once set. | 471 bool reading_; // We are already reading. Never reverts to false once set. |
| 461 bool invalid_range_; // We may bypass the cache for this request. | 472 bool invalid_range_; // We may bypass the cache for this request. |
| 462 bool truncated_; // We don't have all the response data. | 473 bool truncated_; // We don't have all the response data. |
| 463 bool is_sparse_; // The data is stored in sparse byte ranges. | 474 bool is_sparse_; // The data is stored in sparse byte ranges. |
| 464 bool range_requested_; // The user requested a byte range. | 475 bool range_requested_; // The user requested a byte range. |
| 465 bool handling_206_; // We must deal with this 206 response. | 476 bool handling_206_; // We must deal with this 206 response. |
| 466 bool cache_pending_; // We are waiting for the HttpCache. | 477 bool cache_pending_; // We are waiting for the HttpCache. |
| 467 bool done_reading_; // All available data was read. | 478 bool done_reading_; // All available data was read. |
| 468 bool vary_mismatch_; // The request doesn't match the stored vary data. | 479 bool vary_mismatch_; // The request doesn't match the stored vary data. |
| 469 bool couldnt_conditionalize_request_; | 480 bool couldnt_conditionalize_request_; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 bool in_do_loop_; | 527 bool in_do_loop_; |
| 517 | 528 |
| 518 base::WeakPtrFactory<Transaction> weak_factory_; | 529 base::WeakPtrFactory<Transaction> weak_factory_; |
| 519 | 530 |
| 520 DISALLOW_COPY_AND_ASSIGN(Transaction); | 531 DISALLOW_COPY_AND_ASSIGN(Transaction); |
| 521 }; | 532 }; |
| 522 | 533 |
| 523 } // namespace net | 534 } // namespace net |
| 524 | 535 |
| 525 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 536 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
| OLD | NEW |