| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 STATE_NETWORK_READ, | 222 STATE_NETWORK_READ, |
| 223 STATE_NETWORK_READ_COMPLETE, | 223 STATE_NETWORK_READ_COMPLETE, |
| 224 STATE_CACHE_READ_DATA, | 224 STATE_CACHE_READ_DATA, |
| 225 STATE_CACHE_READ_DATA_COMPLETE, | 225 STATE_CACHE_READ_DATA_COMPLETE, |
| 226 STATE_CACHE_WRITE_DATA, | 226 STATE_CACHE_WRITE_DATA, |
| 227 STATE_CACHE_WRITE_DATA_COMPLETE, | 227 STATE_CACHE_WRITE_DATA_COMPLETE, |
| 228 STATE_CACHE_WRITE_TRUNCATED_RESPONSE, | 228 STATE_CACHE_WRITE_TRUNCATED_RESPONSE, |
| 229 STATE_CACHE_WRITE_TRUNCATED_RESPONSE_COMPLETE | 229 STATE_CACHE_WRITE_TRUNCATED_RESPONSE_COMPLETE |
| 230 }; | 230 }; |
| 231 | 231 |
| 232 // Used for categorizing transactions for reporting in histograms. Patterns | |
| 233 // cover relatively common use cases being measured and considered for | |
| 234 // optimization. Many use cases that are more complex or uncommon are binned | |
| 235 // as PATTERN_NOT_COVERED, and details are not reported. | |
| 236 // NOTE: This enumeration is used in histograms, so please do not add entries | |
| 237 // in the middle. | |
| 238 enum TransactionPattern { | |
| 239 PATTERN_UNDEFINED, | |
| 240 PATTERN_NOT_COVERED, | |
| 241 PATTERN_ENTRY_NOT_CACHED, | |
| 242 PATTERN_ENTRY_USED, | |
| 243 PATTERN_ENTRY_VALIDATED, | |
| 244 PATTERN_ENTRY_UPDATED, | |
| 245 PATTERN_ENTRY_CANT_CONDITIONALIZE, | |
| 246 PATTERN_MAX, | |
| 247 }; | |
| 248 | |
| 249 // Used for categorizing validation triggers in histograms. | 232 // Used for categorizing validation triggers in histograms. |
| 250 // NOTE: This enumeration is used in histograms, so please do not add entries | 233 // NOTE: This enumeration is used in histograms, so please do not add entries |
| 251 // in the middle. | 234 // in the middle. |
| 252 enum ValidationCause { | 235 enum ValidationCause { |
| 253 VALIDATION_CAUSE_UNDEFINED, | 236 VALIDATION_CAUSE_UNDEFINED, |
| 254 VALIDATION_CAUSE_VARY_MISMATCH, | 237 VALIDATION_CAUSE_VARY_MISMATCH, |
| 255 VALIDATION_CAUSE_VALIDATE_FLAG, | 238 VALIDATION_CAUSE_VALIDATE_FLAG, |
| 256 VALIDATION_CAUSE_STALE, | 239 VALIDATION_CAUSE_STALE, |
| 257 VALIDATION_CAUSE_ZERO_FRESHNESS, | 240 VALIDATION_CAUSE_ZERO_FRESHNESS, |
| 258 VALIDATION_CAUSE_MAX | 241 VALIDATION_CAUSE_MAX |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 int DoRestartPartialRequest(); | 403 int DoRestartPartialRequest(); |
| 421 | 404 |
| 422 // Resets the relavant internal state to remove traces of internal processing | 405 // Resets the relavant internal state to remove traces of internal processing |
| 423 // related to range requests. Deletes |partial_| if |delete_object| is true. | 406 // related to range requests. Deletes |partial_| if |delete_object| is true. |
| 424 void ResetPartialState(bool delete_object); | 407 void ResetPartialState(bool delete_object); |
| 425 | 408 |
| 426 // Resets |network_trans_|, which must be non-NULL. Also updates | 409 // Resets |network_trans_|, which must be non-NULL. Also updates |
| 427 // |old_network_trans_load_timing_|, which must be NULL when this is called. | 410 // |old_network_trans_load_timing_|, which must be NULL when this is called. |
| 428 void ResetNetworkTransaction(); | 411 void ResetNetworkTransaction(); |
| 429 | 412 |
| 430 // Returns true if we should bother attempting to resume this request if it | 413 // Returns true if we should bother attempting to resume this request if it is |
| 431 // is aborted while in progress. If |has_data| is true, the size of the stored | 414 // aborted while in progress. If |has_data| is true, the size of the stored |
| 432 // data is considered for the result. | 415 // data is considered for the result. |
| 433 bool CanResume(bool has_data); | 416 bool CanResume(bool has_data); |
| 434 | 417 |
| 435 void UpdateTransactionPattern(TransactionPattern new_transaction_pattern); | 418 // Setter for response_ and auth_response_. It updates its cache entry status, |
| 419 // if needed. |
| 420 void SetResponse(const HttpResponseInfo& new_response); |
| 421 void SetAuthResponse(const HttpResponseInfo& new_response); |
| 422 |
| 423 void UpdateCacheEntryStatus( |
| 424 HttpResponseInfo::CacheEntryStatus new_cache_entry_status); |
| 425 |
| 426 // Sets the response.cache_entry_status to the current cache_entry_status_. |
| 427 void SyncCacheEntryStatusToResponse(); |
| 436 void RecordHistograms(); | 428 void RecordHistograms(); |
| 437 | 429 |
| 438 // Called to signal completion of asynchronous IO. | 430 // Called to signal completion of asynchronous IO. |
| 439 void OnIOComplete(int result); | 431 void OnIOComplete(int result); |
| 440 | 432 |
| 441 State next_state_; | 433 State next_state_; |
| 442 const HttpRequestInfo* request_; | 434 const HttpRequestInfo* request_; |
| 443 RequestPriority priority_; | 435 RequestPriority priority_; |
| 444 BoundNetLog net_log_; | 436 BoundNetLog net_log_; |
| 445 std::unique_ptr<HttpRequestInfo> custom_request_; | 437 std::unique_ptr<HttpRequestInfo> custom_request_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 472 scoped_refptr<IOBuffer> read_buf_; | 464 scoped_refptr<IOBuffer> read_buf_; |
| 473 int io_buf_len_; | 465 int io_buf_len_; |
| 474 int read_offset_; | 466 int read_offset_; |
| 475 int effective_load_flags_; | 467 int effective_load_flags_; |
| 476 int write_len_; | 468 int write_len_; |
| 477 std::unique_ptr<PartialData> partial_; // We are dealing with range requests. | 469 std::unique_ptr<PartialData> partial_; // We are dealing with range requests. |
| 478 UploadProgress final_upload_progress_; | 470 UploadProgress final_upload_progress_; |
| 479 CompletionCallback io_callback_; | 471 CompletionCallback io_callback_; |
| 480 | 472 |
| 481 // Members used to track data for histograms. | 473 // Members used to track data for histograms. |
| 482 TransactionPattern transaction_pattern_; | 474 // This cache_entry_status_ takes precedence over |
| 475 // response_.cache_entry_status. In fact, response_.cache_entry_status must be |
| 476 // kept in sync with cache_entry_status_ (via SetResponse and |
| 477 // UpdateCacheEntryStatus). |
| 478 HttpResponseInfo::CacheEntryStatus cache_entry_status_; |
| 483 ValidationCause validation_cause_; | 479 ValidationCause validation_cause_; |
| 484 base::TimeTicks entry_lock_waiting_since_; | 480 base::TimeTicks entry_lock_waiting_since_; |
| 485 base::TimeTicks first_cache_access_since_; | 481 base::TimeTicks first_cache_access_since_; |
| 486 base::TimeTicks send_request_since_; | 482 base::TimeTicks send_request_since_; |
| 487 base::Time open_entry_last_used_; | 483 base::Time open_entry_last_used_; |
| 488 base::TimeDelta stale_entry_freshness_; | 484 base::TimeDelta stale_entry_freshness_; |
| 489 base::TimeDelta stale_entry_age_; | 485 base::TimeDelta stale_entry_age_; |
| 490 | 486 |
| 491 int64_t total_received_bytes_; | 487 int64_t total_received_bytes_; |
| 492 int64_t total_sent_bytes_; | 488 int64_t total_sent_bytes_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 510 BeforeHeadersSentCallback before_headers_sent_callback_; | 506 BeforeHeadersSentCallback before_headers_sent_callback_; |
| 511 | 507 |
| 512 base::WeakPtrFactory<Transaction> weak_factory_; | 508 base::WeakPtrFactory<Transaction> weak_factory_; |
| 513 | 509 |
| 514 DISALLOW_COPY_AND_ASSIGN(Transaction); | 510 DISALLOW_COPY_AND_ASSIGN(Transaction); |
| 515 }; | 511 }; |
| 516 | 512 |
| 517 } // namespace net | 513 } // namespace net |
| 518 | 514 |
| 519 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 515 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
| OLD | NEW |