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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 STATE_OVERWRITE_CACHED_RESPONSE, | 211 STATE_OVERWRITE_CACHED_RESPONSE, | 
| 212 STATE_CACHE_WRITE_RESPONSE, | 212 STATE_CACHE_WRITE_RESPONSE, | 
| 213 STATE_CACHE_WRITE_RESPONSE_COMPLETE, | 213 STATE_CACHE_WRITE_RESPONSE_COMPLETE, | 
| 214 STATE_TRUNCATE_CACHED_DATA, | 214 STATE_TRUNCATE_CACHED_DATA, | 
| 215 STATE_TRUNCATE_CACHED_DATA_COMPLETE, | 215 STATE_TRUNCATE_CACHED_DATA_COMPLETE, | 
| 216 STATE_TRUNCATE_CACHED_METADATA, | 216 STATE_TRUNCATE_CACHED_METADATA, | 
| 217 STATE_TRUNCATE_CACHED_METADATA_COMPLETE, | 217 STATE_TRUNCATE_CACHED_METADATA_COMPLETE, | 
| 218 STATE_PARTIAL_HEADERS_RECEIVED, | 218 STATE_PARTIAL_HEADERS_RECEIVED, | 
| 219 STATE_CACHE_READ_METADATA, | 219 STATE_CACHE_READ_METADATA, | 
| 220 STATE_CACHE_READ_METADATA_COMPLETE, | 220 STATE_CACHE_READ_METADATA_COMPLETE, | 
| 221 STATE_WAIT_BEFORE_READ, | |
| 222 STATE_WAIT_BEFORE_READ_COMPLETE, | |
| 221 | 223 | 
| 222 // These states are entered from Read/AddTruncatedFlag. | 224 // These states are entered from Read/AddTruncatedFlag. | 
| 223 STATE_NETWORK_READ, | 225 STATE_NETWORK_READ, | 
| 224 STATE_NETWORK_READ_COMPLETE, | 226 STATE_NETWORK_READ_COMPLETE, | 
| 225 STATE_CACHE_READ_DATA, | 227 STATE_CACHE_READ_DATA, | 
| 226 STATE_CACHE_READ_DATA_COMPLETE, | 228 STATE_CACHE_READ_DATA_COMPLETE, | 
| 227 STATE_CACHE_WRITE_DATA, | 229 STATE_CACHE_WRITE_DATA, | 
| 228 STATE_CACHE_WRITE_DATA_COMPLETE, | 230 STATE_CACHE_WRITE_DATA_COMPLETE, | 
| 229 STATE_CACHE_WRITE_TRUNCATED_RESPONSE, | 231 STATE_CACHE_WRITE_TRUNCATED_RESPONSE, | 
| 230 STATE_CACHE_WRITE_TRUNCATED_RESPONSE_COMPLETE | 232 STATE_CACHE_WRITE_TRUNCATED_RESPONSE_COMPLETE | 
| 231 }; | 233 }; | 
| 232 | 234 | 
| 233 // Used for categorizing validation triggers in histograms. | 235 // Used for categorizing validation triggers in histograms. | 
| 234 // NOTE: This enumeration is used in histograms, so please do not add entries | 236 // NOTE: This enumeration is used in histograms, so please do not add entries | 
| 235 // in the middle. | 237 // in the middle. | 
| 236 enum ValidationCause { | 238 enum ValidationCause { | 
| 237 VALIDATION_CAUSE_UNDEFINED, | 239 VALIDATION_CAUSE_UNDEFINED, | 
| 238 VALIDATION_CAUSE_VARY_MISMATCH, | 240 VALIDATION_CAUSE_VARY_MISMATCH, | 
| 239 VALIDATION_CAUSE_VALIDATE_FLAG, | 241 VALIDATION_CAUSE_VALIDATE_FLAG, | 
| 240 VALIDATION_CAUSE_STALE, | 242 VALIDATION_CAUSE_STALE, | 
| 241 VALIDATION_CAUSE_ZERO_FRESHNESS, | 243 VALIDATION_CAUSE_ZERO_FRESHNESS, | 
| 242 VALIDATION_CAUSE_MAX | 244 VALIDATION_CAUSE_MAX | 
| 243 }; | 245 }; | 
| 244 | 246 | 
| 245 // Runs the state transition loop. Resets and calls |callback_| on exit, | 247 // Runs the state transition loop. Resets and calls |callback_| on exit, | 
| 246 // unless the return value is ERR_IO_PENDING. | 248 // unless the return value is ERR_IO_PENDING. | 
| 247 int DoLoop(int result); | 249 int DoLoop(int result); | 
| 250 int DoLoopImpl(int result); | |
| 248 | 251 | 
| 249 // Each of these methods corresponds to a State value. If there is an | 252 // Each of these methods corresponds to a State value. If there is an | 
| 250 // argument, the value corresponds to the return of the previous state or | 253 // argument, the value corresponds to the return of the previous state or | 
| 251 // corresponding callback. | 254 // corresponding callback. | 
| 252 int DoGetBackend(); | 255 int DoGetBackend(); | 
| 253 int DoGetBackendComplete(int result); | 256 int DoGetBackendComplete(int result); | 
| 254 int DoInitEntry(); | 257 int DoInitEntry(); | 
| 255 int DoOpenEntry(); | 258 int DoOpenEntry(); | 
| 256 int DoOpenEntryComplete(int result); | 259 int DoOpenEntryComplete(int result); | 
| 257 int DoDoomEntry(); | 260 int DoDoomEntry(); | 
| (...skipping 19 matching lines...) Expand all Loading... | |
| 277 int DoCacheWriteUpdatedResponseComplete(int result); | 280 int DoCacheWriteUpdatedResponseComplete(int result); | 
| 278 int DoUpdateCachedResponseComplete(int result); | 281 int DoUpdateCachedResponseComplete(int result); | 
| 279 int DoOverwriteCachedResponse(); | 282 int DoOverwriteCachedResponse(); | 
| 280 int DoCacheWriteResponse(); | 283 int DoCacheWriteResponse(); | 
| 281 int DoCacheWriteResponseComplete(int result); | 284 int DoCacheWriteResponseComplete(int result); | 
| 282 int DoTruncateCachedData(); | 285 int DoTruncateCachedData(); | 
| 283 int DoTruncateCachedDataComplete(int result); | 286 int DoTruncateCachedDataComplete(int result); | 
| 284 int DoTruncateCachedMetadata(); | 287 int DoTruncateCachedMetadata(); | 
| 285 int DoTruncateCachedMetadataComplete(int result); | 288 int DoTruncateCachedMetadataComplete(int result); | 
| 286 int DoPartialHeadersReceived(); | 289 int DoPartialHeadersReceived(); | 
| 290 int DoWaitBeforeRead(); | |
| 291 int DoWaitBeforeReadComplete(int result); | |
| 287 int DoCacheReadMetadata(); | 292 int DoCacheReadMetadata(); | 
| 288 int DoCacheReadMetadataComplete(int result); | 293 int DoCacheReadMetadataComplete(int result); | 
| 289 int DoNetworkRead(); | 294 int DoNetworkRead(); | 
| 290 int DoNetworkReadComplete(int result); | 295 int DoNetworkReadComplete(int result); | 
| 291 int DoCacheReadData(); | 296 int DoCacheReadData(); | 
| 292 int DoCacheReadDataComplete(int result); | 297 int DoCacheReadDataComplete(int result); | 
| 293 int DoCacheWriteData(int num_bytes); | 298 int DoCacheWriteData(int num_bytes); | 
| 294 int DoCacheWriteDataComplete(int result); | 299 int DoCacheWriteDataComplete(int result); | 
| 295 int DoCacheWriteTruncatedResponse(); | 300 int DoCacheWriteTruncatedResponse(); | 
| 296 int DoCacheWriteTruncatedResponseComplete(int result); | 301 int DoCacheWriteTruncatedResponseComplete(int result); | 
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 bool truncated_; // We don't have all the response data. | 461 bool truncated_; // We don't have all the response data. | 
| 457 bool is_sparse_; // The data is stored in sparse byte ranges. | 462 bool is_sparse_; // The data is stored in sparse byte ranges. | 
| 458 bool range_requested_; // The user requested a byte range. | 463 bool range_requested_; // The user requested a byte range. | 
| 459 bool handling_206_; // We must deal with this 206 response. | 464 bool handling_206_; // We must deal with this 206 response. | 
| 460 bool cache_pending_; // We are waiting for the HttpCache. | 465 bool cache_pending_; // We are waiting for the HttpCache. | 
| 461 bool done_reading_; // All available data was read. | 466 bool done_reading_; // All available data was read. | 
| 462 bool vary_mismatch_; // The request doesn't match the stored vary data. | 467 bool vary_mismatch_; // The request doesn't match the stored vary data. | 
| 463 bool couldnt_conditionalize_request_; | 468 bool couldnt_conditionalize_request_; | 
| 464 bool bypass_lock_for_test_; // A test is exercising the cache lock. | 469 bool bypass_lock_for_test_; // A test is exercising the cache lock. | 
| 465 bool fail_conditionalization_for_test_; // Fail ConditionalizeRequest. | 470 bool fail_conditionalization_for_test_; // Fail ConditionalizeRequest. | 
| 471 // This transaction is responsible for writing the response | |
| 472 bool write_this_response_; | |
| 
 
jkarlin
2017/03/07 16:45:42
This variable seems unnecessary, it's only read in
 
 | |
| 466 scoped_refptr<IOBuffer> read_buf_; | 473 scoped_refptr<IOBuffer> read_buf_; | 
| 467 int io_buf_len_; | 474 int io_buf_len_; | 
| 468 int read_offset_; | 475 int read_offset_; | 
| 469 int effective_load_flags_; | 476 int effective_load_flags_; | 
| 470 int write_len_; | 477 int write_len_; | 
| 471 std::unique_ptr<PartialData> partial_; // We are dealing with range requests. | 478 std::unique_ptr<PartialData> partial_; // We are dealing with range requests. | 
| 472 CompletionCallback io_callback_; | 479 CompletionCallback io_callback_; | 
| 473 | 480 | 
| 474 // Members used to track data for histograms. | 481 // Members used to track data for histograms. | 
| 475 // This cache_entry_status_ takes precedence over | 482 // This cache_entry_status_ takes precedence over | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 507 BeforeHeadersSentCallback before_headers_sent_callback_; | 514 BeforeHeadersSentCallback before_headers_sent_callback_; | 
| 508 | 515 | 
| 509 base::WeakPtrFactory<Transaction> weak_factory_; | 516 base::WeakPtrFactory<Transaction> weak_factory_; | 
| 510 | 517 | 
| 511 DISALLOW_COPY_AND_ASSIGN(Transaction); | 518 DISALLOW_COPY_AND_ASSIGN(Transaction); | 
| 512 }; | 519 }; | 
| 513 | 520 | 
| 514 } // namespace net | 521 } // namespace net | 
| 515 | 522 | 
| 516 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 523 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 
| OLD | NEW |