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