| 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 22 matching lines...) Expand all Loading... |
| 33 #include "net/log/net_log_with_source.h" | 33 #include "net/log/net_log_with_source.h" |
| 34 #include "net/socket/connection_attempts.h" | 34 #include "net/socket/connection_attempts.h" |
| 35 #include "net/websockets/websocket_handshake_stream_base.h" | 35 #include "net/websockets/websocket_handshake_stream_base.h" |
| 36 | 36 |
| 37 namespace net { | 37 namespace net { |
| 38 | 38 |
| 39 class PartialData; | 39 class PartialData; |
| 40 struct HttpRequestInfo; | 40 struct HttpRequestInfo; |
| 41 struct LoadTimingInfo; | 41 struct LoadTimingInfo; |
| 42 class SSLPrivateKey; | 42 class SSLPrivateKey; |
| 43 class DataAccess; |
| 43 | 44 |
| 44 // This is the transaction that is returned by the HttpCache transaction | 45 // This is the transaction that is returned by the HttpCache transaction |
| 45 // factory. | 46 // factory. |
| 46 class HttpCache::Transaction : public HttpTransaction { | 47 class HttpCache::Transaction : public HttpTransaction { |
| 47 public: | 48 public: |
| 48 // The transaction has the following modes, which apply to how it may access | 49 // The transaction has the following modes, which apply to how it may access |
| 49 // its cache entry. | 50 // its cache entry. |
| 50 // | 51 // |
| 51 // o If the mode of the transaction is NONE, then it is in "pass through" | 52 // o If the mode of the transaction is NONE, then it is in "pass through" |
| 52 // mode and all methods just forward to the inner network transaction. | 53 // mode and all methods just forward to the inner network transaction. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 int WriteMetadata(IOBuffer* buf, | 101 int WriteMetadata(IOBuffer* buf, |
| 101 int buf_len, | 102 int buf_len, |
| 102 const CompletionCallback& callback); | 103 const CompletionCallback& callback); |
| 103 | 104 |
| 104 // This transaction is being deleted and we are not done writing to the cache. | 105 // This transaction is being deleted and we are not done writing to the cache. |
| 105 // We need to indicate that the response data was truncated. Returns true on | 106 // We need to indicate that the response data was truncated. Returns true on |
| 106 // success. Keep in mind that this operation may have side effects, such as | 107 // success. Keep in mind that this operation may have side effects, such as |
| 107 // deleting the active entry. | 108 // deleting the active entry. |
| 108 bool AddTruncatedFlag(); | 109 bool AddTruncatedFlag(); |
| 109 | 110 |
| 110 HttpCache::ActiveEntry* entry() { return entry_; } | 111 HttpCache::ActiveEntry* entry() const { return entry_; } |
| 111 | 112 |
| 112 // Returns the LoadState of the writer transaction of a given ActiveEntry. In | 113 // Returns the LoadState of the writer transaction of a given ActiveEntry. In |
| 113 // other words, returns the LoadState of this transaction without asking the | 114 // other words, returns the LoadState of this transaction without asking the |
| 114 // http cache, because this transaction should be the one currently writing | 115 // http cache, because this transaction should be the one currently writing |
| 115 // to the cache entry. | 116 // to the cache entry. |
| 116 LoadState GetWriterLoadState() const; | 117 LoadState GetWriterLoadState() const; |
| 117 | 118 |
| 118 const CompletionCallback& io_callback() { return io_callback_; } | 119 const CompletionCallback& io_callback() { return io_callback_; } |
| 119 | 120 |
| 121 base::WeakPtr<Transaction> GetWeakPtr() { return weak_factory_.GetWeakPtr(); } |
| 122 |
| 120 const NetLogWithSource& net_log() const; | 123 const NetLogWithSource& net_log() const; |
| 121 | 124 |
| 122 // Bypasses the cache lock whenever there is lock contention. | 125 // Bypasses the cache lock whenever there is lock contention. |
| 123 void BypassLockForTest() { | 126 void BypassLockForTest() { |
| 124 bypass_lock_for_test_ = true; | 127 bypass_lock_for_test_ = true; |
| 125 } | 128 } |
| 126 | 129 |
| 127 // Generates a failure when attempting to conditionalize a network request. | 130 // Generates a failure when attempting to conditionalize a network request. |
| 128 void FailConditionalizationForTest() { | 131 void FailConditionalizationForTest() { |
| 129 fail_conditionalization_for_test_ = true; | 132 fail_conditionalization_for_test_ = true; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 157 void SetPriority(RequestPriority priority) override; | 160 void SetPriority(RequestPriority priority) override; |
| 158 void SetWebSocketHandshakeStreamCreateHelper( | 161 void SetWebSocketHandshakeStreamCreateHelper( |
| 159 WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; | 162 WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; |
| 160 void SetBeforeNetworkStartCallback( | 163 void SetBeforeNetworkStartCallback( |
| 161 const BeforeNetworkStartCallback& callback) override; | 164 const BeforeNetworkStartCallback& callback) override; |
| 162 void SetBeforeHeadersSentCallback( | 165 void SetBeforeHeadersSentCallback( |
| 163 const BeforeHeadersSentCallback& callback) override; | 166 const BeforeHeadersSentCallback& callback) override; |
| 164 int ResumeNetworkStart() override; | 167 int ResumeNetworkStart() override; |
| 165 void GetConnectionAttempts(ConnectionAttempts* out) const override; | 168 void GetConnectionAttempts(ConnectionAttempts* out) const override; |
| 166 | 169 |
| 170 // Returns true if the transaction is eligible for reading from the |
| 171 // network and writing to the cache along with other transactions. |
| 172 // It is eligible if the following conditions are true: |
| 173 // - Request’s mode is READ_WRITE. If mode is only READ then this |
| 174 // transaction should wait until the whole response is in the cache. |
| 175 // - Method is GET. |
| 176 // - It is not a range request. |
| 177 // - It is not a no-store data. |
| 178 bool IsEligibleForSharedWriting() const; |
| 179 |
| 180 // Sets shared_ to true. |
| 181 void SetShared(); |
| 182 |
| 183 // Sets shared_ to false. Arguments tell if the transaction will continue to |
| 184 // read from the network with its own data_access_ object and whether the |
| 185 // transaction will continue to read from the cache. |
| 186 void ResetShared(bool continue_network_reading = false, |
| 187 bool continue_cache_reading = false); |
| 188 |
| 189 bool shared() const { return shared_; } |
| 190 |
| 191 // Sets next_state_ such that any subsequent Read or IO callback should fail. |
| 192 void SetSharedWritingFailState(int result); |
| 193 |
| 194 // The transaction should now continue without shared writing and take the |
| 195 // ownership of the data_access_ object. |
| 196 void ContinueWithoutSharedWriting(std::unique_ptr<DataAccess> data_access, |
| 197 bool needs_entry); |
| 198 |
| 167 private: | 199 private: |
| 168 static const size_t kNumValidationHeaders = 2; | 200 static const size_t kNumValidationHeaders = 2; |
| 169 // Helper struct to pair a header name with its value, for | 201 // Helper struct to pair a header name with its value, for |
| 170 // headers used to validate cache entries. | 202 // headers used to validate cache entries. |
| 171 struct ValidationHeaders { | 203 struct ValidationHeaders { |
| 172 ValidationHeaders() : initialized(false) {} | 204 ValidationHeaders() : initialized(false) {} |
| 173 | 205 |
| 174 std::string values[kNumValidationHeaders]; | 206 std::string values[kNumValidationHeaders]; |
| 175 bool initialized; | 207 bool initialized; |
| 176 }; | 208 }; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 STATE_OVERWRITE_CACHED_RESPONSE, | 240 STATE_OVERWRITE_CACHED_RESPONSE, |
| 209 STATE_CACHE_WRITE_RESPONSE, | 241 STATE_CACHE_WRITE_RESPONSE, |
| 210 STATE_CACHE_WRITE_RESPONSE_COMPLETE, | 242 STATE_CACHE_WRITE_RESPONSE_COMPLETE, |
| 211 STATE_TRUNCATE_CACHED_DATA, | 243 STATE_TRUNCATE_CACHED_DATA, |
| 212 STATE_TRUNCATE_CACHED_DATA_COMPLETE, | 244 STATE_TRUNCATE_CACHED_DATA_COMPLETE, |
| 213 STATE_TRUNCATE_CACHED_METADATA, | 245 STATE_TRUNCATE_CACHED_METADATA, |
| 214 STATE_TRUNCATE_CACHED_METADATA_COMPLETE, | 246 STATE_TRUNCATE_CACHED_METADATA_COMPLETE, |
| 215 STATE_PARTIAL_HEADERS_RECEIVED, | 247 STATE_PARTIAL_HEADERS_RECEIVED, |
| 216 STATE_CACHE_READ_METADATA, | 248 STATE_CACHE_READ_METADATA, |
| 217 STATE_CACHE_READ_METADATA_COMPLETE, | 249 STATE_CACHE_READ_METADATA_COMPLETE, |
| 250 // Update the value if another state becomes the last state of the start |
| 251 // state machine. |
| 252 STATE_START_STATE_MACHINE_FINAL = STATE_CACHE_READ_METADATA_COMPLETE, |
| 218 | 253 |
| 254 // Start states should always be before Read states. |
| 219 // These states are entered from Read/AddTruncatedFlag. | 255 // These states are entered from Read/AddTruncatedFlag. |
| 220 STATE_NETWORK_READ, | 256 STATE_NETWORK_READ, |
| 221 STATE_NETWORK_READ_COMPLETE, | 257 STATE_NETWORK_READ_COMPLETE, |
| 222 STATE_CACHE_READ_DATA, | |
| 223 STATE_CACHE_READ_DATA_COMPLETE, | |
| 224 STATE_CACHE_WRITE_DATA, | 258 STATE_CACHE_WRITE_DATA, |
| 225 STATE_CACHE_WRITE_DATA_COMPLETE, | 259 STATE_CACHE_WRITE_DATA_COMPLETE, |
| 226 STATE_CACHE_WRITE_TRUNCATED_RESPONSE, | 260 STATE_CACHE_WRITE_TRUNCATED_RESPONSE, |
| 227 STATE_CACHE_WRITE_TRUNCATED_RESPONSE_COMPLETE | 261 STATE_CACHE_WRITE_TRUNCATED_RESPONSE_COMPLETE, |
| 262 |
| 263 // Shared Writing states. |
| 264 STATE_SHARED_NETWORK_READ, |
| 265 STATE_SHARED_NETWORK_READ_COMPLETE, |
| 266 STATE_SHARED_NETWORK_READ_WAIT_COMPLETE, |
| 267 STATE_SHARED_CACHE_WRITE_DATA, |
| 268 STATE_SHARED_CACHE_WRITE_DATA_COMPLETE, |
| 269 |
| 270 // Cache read states, also used for shared writing transactions when they |
| 271 // are behind the data already written to the cache. |
| 272 STATE_CACHE_READ_DATA, |
| 273 STATE_CACHE_READ_DATA_COMPLETE, |
| 274 |
| 275 // This state is reached for a shared writing transaction when there is a |
| 276 // failure and any subsequent Read or IO callback should fail. |
| 277 STATE_SHARED_READ_WRITE_FAILED |
| 228 }; | 278 }; |
| 229 | 279 |
| 230 // Used for categorizing validation triggers in histograms. | 280 // Used for categorizing validation triggers in histograms. |
| 231 // NOTE: This enumeration is used in histograms, so please do not add entries | 281 // NOTE: This enumeration is used in histograms, so please do not add entries |
| 232 // in the middle. | 282 // in the middle. |
| 233 enum ValidationCause { | 283 enum ValidationCause { |
| 234 VALIDATION_CAUSE_UNDEFINED, | 284 VALIDATION_CAUSE_UNDEFINED, |
| 235 VALIDATION_CAUSE_VARY_MISMATCH, | 285 VALIDATION_CAUSE_VARY_MISMATCH, |
| 236 VALIDATION_CAUSE_VALIDATE_FLAG, | 286 VALIDATION_CAUSE_VALIDATE_FLAG, |
| 237 VALIDATION_CAUSE_STALE, | 287 VALIDATION_CAUSE_STALE, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 int DoCacheReadMetadata(); | 334 int DoCacheReadMetadata(); |
| 285 int DoCacheReadMetadataComplete(int result); | 335 int DoCacheReadMetadataComplete(int result); |
| 286 int DoNetworkRead(); | 336 int DoNetworkRead(); |
| 287 int DoNetworkReadComplete(int result); | 337 int DoNetworkReadComplete(int result); |
| 288 int DoCacheReadData(); | 338 int DoCacheReadData(); |
| 289 int DoCacheReadDataComplete(int result); | 339 int DoCacheReadDataComplete(int result); |
| 290 int DoCacheWriteData(int num_bytes); | 340 int DoCacheWriteData(int num_bytes); |
| 291 int DoCacheWriteDataComplete(int result); | 341 int DoCacheWriteDataComplete(int result); |
| 292 int DoCacheWriteTruncatedResponse(); | 342 int DoCacheWriteTruncatedResponse(); |
| 293 int DoCacheWriteTruncatedResponseComplete(int result); | 343 int DoCacheWriteTruncatedResponseComplete(int result); |
| 344 int DoSharedNetworkRead(); |
| 345 int DoSharedNetworkReadComplete(int result); |
| 346 int DoSharedNetworkReadWaitComplete(int result); |
| 347 int DoSharedCacheWriteData(int num_bytes); |
| 348 int DoSharedCacheWriteDataComplete(int result); |
| 349 int DoSharedReadWriteFailed(); |
| 294 | 350 |
| 295 // Sets request_ and fields derived from it. | 351 // Sets request_ and fields derived from it. |
| 296 void SetRequest(const NetLogWithSource& net_log, | 352 void SetRequest(const NetLogWithSource& net_log, |
| 297 const HttpRequestInfo* request); | 353 const HttpRequestInfo* request); |
| 298 | 354 |
| 299 // Returns true if the request should be handled exclusively by the network | 355 // Returns true if the request should be handled exclusively by the network |
| 300 // layer (skipping the cache entirely). | 356 // layer (skipping the cache entirely). |
| 301 bool ShouldPassThrough(); | 357 bool ShouldPassThrough(); |
| 302 | 358 |
| 303 // Called to begin reading from the cache. Returns network error code. | 359 // Called to begin reading from the cache. Returns network error code. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 | 423 |
| 368 // Helper function, should be called with result of WriteResponseInfoToEntry | 424 // Helper function, should be called with result of WriteResponseInfoToEntry |
| 369 // (or the result of the callback, when WriteResponseInfoToEntry returns | 425 // (or the result of the callback, when WriteResponseInfoToEntry returns |
| 370 // ERR_IO_PENDING). Calls DoneWritingToEntry if |result| is not the right | 426 // ERR_IO_PENDING). Calls DoneWritingToEntry if |result| is not the right |
| 371 // number of bytes. It is expected that the state that calls this will | 427 // number of bytes. It is expected that the state that calls this will |
| 372 // return whatever net error code this function returns, which currently | 428 // return whatever net error code this function returns, which currently |
| 373 // is always "OK". | 429 // is always "OK". |
| 374 int OnWriteResponseInfoToEntryComplete(int result); | 430 int OnWriteResponseInfoToEntryComplete(int result); |
| 375 | 431 |
| 376 // Called when we are done writing to the cache entry. | 432 // Called when we are done writing to the cache entry. |
| 377 void DoneWritingToEntry(bool success); | 433 // perform_entry_cleanup will be false if we just want to set the internal |
| 434 // state of the transaction but do not want to invoke any cleanup operation on |
| 435 // entry_ e.g. when it's already done by a SharedWriter callback function. |
| 436 void DoneWritingToEntry(bool success, bool perform_entry_cleanup = true); |
| 378 | 437 |
| 379 // Returns an error to signal the caller that the current read failed. The | 438 // Returns an error to signal the caller that the current read failed. The |
| 380 // current operation |result| is also logged. If |restart| is true, the | 439 // current operation |result| is also logged. If |restart| is true, the |
| 381 // transaction should be restarted. | 440 // transaction should be restarted. |
| 382 int OnCacheReadError(int result, bool restart); | 441 int OnCacheReadError(int result, bool restart); |
| 383 | 442 |
| 384 // Called when the cache lock timeout fires. | 443 // Called when the cache lock timeout fires. |
| 385 void OnAddToEntryTimeout(base::TimeTicks start_time); | 444 void OnAddToEntryTimeout(base::TimeTicks start_time); |
| 386 | 445 |
| 387 // Deletes the current partial cache entry (sparse), and optionally removes | 446 // Deletes the current partial cache entry (sparse), and optionally removes |
| (...skipping 14 matching lines...) Expand all Loading... |
| 402 int DoRestartPartialRequest(); | 461 int DoRestartPartialRequest(); |
| 403 | 462 |
| 404 // Resets the relavant internal state to remove traces of internal processing | 463 // Resets the relavant internal state to remove traces of internal processing |
| 405 // related to range requests. Deletes |partial_| if |delete_object| is true. | 464 // related to range requests. Deletes |partial_| if |delete_object| is true. |
| 406 void ResetPartialState(bool delete_object); | 465 void ResetPartialState(bool delete_object); |
| 407 | 466 |
| 408 // Resets |network_trans_|, which must be non-NULL. Also updates | 467 // Resets |network_trans_|, which must be non-NULL. Also updates |
| 409 // |old_network_trans_load_timing_|, which must be NULL when this is called. | 468 // |old_network_trans_load_timing_|, which must be NULL when this is called. |
| 410 void ResetNetworkTransaction(); | 469 void ResetNetworkTransaction(); |
| 411 | 470 |
| 412 // Returns true if we should bother attempting to resume this request if it is | 471 // Resets |data_access_|. Also updates |old_network_trans_load_timing_|, which |
| 413 // aborted while in progress. If |has_data| is true, the size of the stored | 472 // must be NULL when this is called. |
| 414 // data is considered for the result. | 473 void ResetDataAccess(); |
| 415 bool CanResume(bool has_data); | 474 |
| 475 void SaveNetworkTransactionInfo(const HttpTransaction* transaction); |
| 476 void SaveSharedNetworkTransactionInfo(); |
| 477 |
| 478 // Returns the currently active network transaction. |
| 479 // At any given point, at most one of the following can be non-null: |
| 480 // - network_trans_(network transaction for headers), |
| 481 // - data_access_->network_transaction_(network transaction for response |
| 482 // body for non-shared transactions) |
| 483 // - entry_->shared_writers->data_access_->network_transaction_ (network |
| 484 // transaction for shared writing of response body). |
| 485 HttpTransaction* GetCurrentNetworkTransaction() const; |
| 416 | 486 |
| 417 // Setter for response_ and auth_response_. It updates its cache entry status, | 487 // Setter for response_ and auth_response_. It updates its cache entry status, |
| 418 // if needed. | 488 // if needed. |
| 419 void SetResponse(const HttpResponseInfo& new_response); | 489 void SetResponse(const HttpResponseInfo& new_response); |
| 420 void SetAuthResponse(const HttpResponseInfo& new_response); | 490 void SetAuthResponse(const HttpResponseInfo& new_response); |
| 421 | 491 |
| 422 void UpdateCacheEntryStatus( | 492 void UpdateCacheEntryStatus( |
| 423 HttpResponseInfo::CacheEntryStatus new_cache_entry_status); | 493 HttpResponseInfo::CacheEntryStatus new_cache_entry_status); |
| 424 | 494 |
| 425 // Sets the response.cache_entry_status to the current cache_entry_status_. | 495 // Sets the response.cache_entry_status to the current cache_entry_status_. |
| 426 void SyncCacheEntryStatusToResponse(); | 496 void SyncCacheEntryStatusToResponse(); |
| 427 void RecordHistograms(); | 497 void RecordHistograms(); |
| 428 | 498 |
| 499 // Checks if the transaction should create a SharedWriters object or not. If |
| 500 // yes, creates one. Also checks if the transaction should continue to be part |
| 501 // of an already created SharedWriters object or not based on its validation |
| 502 // result. |
| 503 void ProcessForSharedWriting(); |
| 504 |
| 505 // Returns true if the transaction is shared and still in the headers phase. |
| 506 bool validating_shared() const; |
| 507 |
| 508 // Destructor helper to remove the transaction from SharedWriters. |
| 509 void RemoveTransactionFromSharedWriters(); |
| 510 |
| 429 // Called to signal completion of asynchronous IO. | 511 // Called to signal completion of asynchronous IO. |
| 430 void OnIOComplete(int result); | 512 void OnIOComplete(int result); |
| 431 | 513 |
| 432 State next_state_; | 514 State next_state_; |
| 433 const HttpRequestInfo* request_; | 515 const HttpRequestInfo* request_; |
| 434 RequestPriority priority_; | 516 RequestPriority priority_; |
| 435 NetLogWithSource net_log_; | 517 NetLogWithSource net_log_; |
| 436 std::unique_ptr<HttpRequestInfo> custom_request_; | 518 std::unique_ptr<HttpRequestInfo> custom_request_; |
| 437 HttpRequestHeaders request_headers_copy_; | 519 HttpRequestHeaders request_headers_copy_; |
| 520 |
| 438 // If extra_headers specified a "if-modified-since" or "if-none-match", | 521 // If extra_headers specified a "if-modified-since" or "if-none-match", |
| 439 // |external_validation_| contains the value of those headers. | 522 // |external_validation_| contains the value of those headers. |
| 440 ValidationHeaders external_validation_; | 523 ValidationHeaders external_validation_; |
| 441 base::WeakPtr<HttpCache> cache_; | 524 base::WeakPtr<HttpCache> cache_; |
| 442 HttpCache::ActiveEntry* entry_; | 525 HttpCache::ActiveEntry* entry_; |
| 443 HttpCache::ActiveEntry* new_entry_; | 526 HttpCache::ActiveEntry* new_entry_; |
| 444 std::unique_ptr<HttpTransaction> network_trans_; | 527 std::unique_ptr<HttpTransaction> network_trans_; |
| 528 std::unique_ptr<DataAccess> data_access_; |
| 445 CompletionCallback callback_; // Consumer's callback. | 529 CompletionCallback callback_; // Consumer's callback. |
| 446 HttpResponseInfo response_; | 530 HttpResponseInfo response_; |
| 447 HttpResponseInfo auth_response_; | 531 HttpResponseInfo auth_response_; |
| 448 const HttpResponseInfo* new_response_; | 532 const HttpResponseInfo* new_response_; |
| 449 std::string cache_key_; | 533 std::string cache_key_; |
| 450 Mode mode_; | 534 Mode mode_; |
| 451 bool reading_; // We are already reading. Never reverts to false once set. | 535 bool reading_; // We are already reading. Never reverts to false once set. |
| 452 bool invalid_range_; // We may bypass the cache for this request. | 536 bool invalid_range_; // We may bypass the cache for this request. |
| 453 bool truncated_; // We don't have all the response data. | 537 bool truncated_; // We don't have all the response data. |
| 454 bool is_sparse_; // The data is stored in sparse byte ranges. | 538 bool is_sparse_; // The data is stored in sparse byte ranges. |
| 455 bool range_requested_; // The user requested a byte range. | 539 bool range_requested_; // The user requested a byte range. |
| 456 bool handling_206_; // We must deal with this 206 response. | 540 bool handling_206_; // We must deal with this 206 response. |
| 457 bool cache_pending_; // We are waiting for the HttpCache. | 541 bool cache_pending_; // We are waiting for the HttpCache. |
| 458 bool done_reading_; // All available data was read. | 542 bool done_reading_; // All available data was read. |
| 459 bool vary_mismatch_; // The request doesn't match the stored vary data. | 543 bool vary_mismatch_; // The request doesn't match the stored vary data. |
| 460 bool couldnt_conditionalize_request_; | 544 bool couldnt_conditionalize_request_; |
| 461 bool bypass_lock_for_test_; // A test is exercising the cache lock. | 545 bool bypass_lock_for_test_; // A test is exercising the cache lock. |
| 462 bool fail_conditionalization_for_test_; // Fail ConditionalizeRequest. | 546 bool fail_conditionalization_for_test_; // Fail ConditionalizeRequest. |
| 547 |
| 548 // Reads from the network and writes to the cache using a SharedWriters |
| 549 // object. |
| 550 bool shared_; |
| 551 |
| 552 // Used for histograms. |
| 553 bool initiate_shared_writing_; |
| 554 |
| 555 // Result to be returned to the consumer on Read invocation when state is |
| 556 // STATE_SHARED_READ_WRITE_FAILED. |
| 557 int shared_read_write_failure_result_; |
| 558 |
| 463 scoped_refptr<IOBuffer> read_buf_; | 559 scoped_refptr<IOBuffer> read_buf_; |
| 464 int io_buf_len_; | 560 int io_buf_len_; |
| 465 int read_offset_; | 561 int read_offset_; |
| 466 int effective_load_flags_; | 562 int effective_load_flags_; |
| 467 int write_len_; | 563 int write_len_; |
| 468 std::unique_ptr<PartialData> partial_; // We are dealing with range requests. | 564 std::unique_ptr<PartialData> partial_; // We are dealing with range requests. |
| 469 CompletionCallback io_callback_; | 565 CompletionCallback io_callback_; |
| 470 | 566 |
| 471 // Members used to track data for histograms. | 567 // Members used to track data for histograms. |
| 472 // This cache_entry_status_ takes precedence over | 568 // This cache_entry_status_ takes precedence over |
| (...skipping 23 matching lines...) Expand all Loading... |
| 496 // The helper object to use to create WebSocketHandshakeStreamBase | 592 // The helper object to use to create WebSocketHandshakeStreamBase |
| 497 // objects. Only relevant when establishing a WebSocket connection. | 593 // objects. Only relevant when establishing a WebSocket connection. |
| 498 // This is passed to the underlying network transaction. It is stored here in | 594 // This is passed to the underlying network transaction. It is stored here in |
| 499 // case the transaction does not exist yet. | 595 // case the transaction does not exist yet. |
| 500 WebSocketHandshakeStreamBase::CreateHelper* | 596 WebSocketHandshakeStreamBase::CreateHelper* |
| 501 websocket_handshake_stream_base_create_helper_; | 597 websocket_handshake_stream_base_create_helper_; |
| 502 | 598 |
| 503 BeforeNetworkStartCallback before_network_start_callback_; | 599 BeforeNetworkStartCallback before_network_start_callback_; |
| 504 BeforeHeadersSentCallback before_headers_sent_callback_; | 600 BeforeHeadersSentCallback before_headers_sent_callback_; |
| 505 | 601 |
| 602 bool have_full_request_headers_; |
| 603 HttpRequestHeaders full_request_headers_; |
| 604 |
| 506 base::WeakPtrFactory<Transaction> weak_factory_; | 605 base::WeakPtrFactory<Transaction> weak_factory_; |
| 507 | 606 |
| 508 DISALLOW_COPY_AND_ASSIGN(Transaction); | 607 DISALLOW_COPY_AND_ASSIGN(Transaction); |
| 509 }; | 608 }; |
| 510 | 609 |
| 511 } // namespace net | 610 } // namespace net |
| 512 | 611 |
| 513 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 612 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
| OLD | NEW |