Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: net/http/http_cache_transaction.h

Issue 12310075: Cache failover to LOAD_PREFERRING_CACHE if network response suggests offline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated comments. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/load_flags_list.h ('k') | net/http/http_cache_transaction.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 // partial entry. 306 // partial entry.
307 bool ValidatePartialResponse(); 307 bool ValidatePartialResponse();
308 308
309 // Handles a response validation error by bypassing the cache. 309 // Handles a response validation error by bypassing the cache.
310 void IgnoreRangeRequest(); 310 void IgnoreRangeRequest();
311 311
312 // Changes the response code of a range request to be 416 (Requested range not 312 // Changes the response code of a range request to be 416 (Requested range not
313 // satisfiable). 313 // satisfiable).
314 void FailRangeRequest(); 314 void FailRangeRequest();
315 315
316 // Setups the transaction for reading from the cache entry.
317 int SetupEntryForRead();
318
316 // Reads data from the network. 319 // Reads data from the network.
317 int ReadFromNetwork(IOBuffer* data, int data_len); 320 int ReadFromNetwork(IOBuffer* data, int data_len);
318 321
319 // Reads data from the cache entry. 322 // Reads data from the cache entry.
320 int ReadFromEntry(IOBuffer* data, int data_len); 323 int ReadFromEntry(IOBuffer* data, int data_len);
321 324
322 // Called to write data to the cache entry. If the write fails, then the 325 // Called to write data to the cache entry. If the write fails, then the
323 // cache entry is destroyed. Future calls to this function will just do 326 // cache entry is destroyed. Future calls to this function will just do
324 // nothing without side-effect. Returns a network error code. 327 // nothing without side-effect. Returns a network error code.
325 int WriteToEntry(int index, int offset, IOBuffer* data, int data_len, 328 int WriteToEntry(int index, int offset, IOBuffer* data, int data_len,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 State target_state_; 413 State target_state_;
411 bool reading_; // We are already reading. 414 bool reading_; // We are already reading.
412 bool invalid_range_; // We may bypass the cache for this request. 415 bool invalid_range_; // We may bypass the cache for this request.
413 bool truncated_; // We don't have all the response data. 416 bool truncated_; // We don't have all the response data.
414 bool is_sparse_; // The data is stored in sparse byte ranges. 417 bool is_sparse_; // The data is stored in sparse byte ranges.
415 bool range_requested_; // The user requested a byte range. 418 bool range_requested_; // The user requested a byte range.
416 bool handling_206_; // We must deal with this 206 response. 419 bool handling_206_; // We must deal with this 206 response.
417 bool cache_pending_; // We are waiting for the HttpCache. 420 bool cache_pending_; // We are waiting for the HttpCache.
418 bool done_reading_; 421 bool done_reading_;
419 bool vary_mismatch_; // The request doesn't match the stored vary data. 422 bool vary_mismatch_; // The request doesn't match the stored vary data.
423 bool couldnt_conditionalize_request_;
420 scoped_refptr<IOBuffer> read_buf_; 424 scoped_refptr<IOBuffer> read_buf_;
421 int io_buf_len_; 425 int io_buf_len_;
422 int read_offset_; 426 int read_offset_;
423 int effective_load_flags_; 427 int effective_load_flags_;
424 int write_len_; 428 int write_len_;
425 scoped_ptr<PartialData> partial_; // We are dealing with range requests. 429 scoped_ptr<PartialData> partial_; // We are dealing with range requests.
426 UploadProgress final_upload_progress_; 430 UploadProgress final_upload_progress_;
427 base::WeakPtrFactory<Transaction> weak_factory_; 431 base::WeakPtrFactory<Transaction> weak_factory_;
428 CompletionCallback io_callback_; 432 CompletionCallback io_callback_;
429 433
(...skipping 22 matching lines...) Expand all
452 456
453 #if !defined(NDEBUG) 457 #if !defined(NDEBUG)
454 // Record of all states this transaction has moved through. 458 // Record of all states this transaction has moved through.
455 std::vector<int> state_path_; 459 std::vector<int> state_path_;
456 #endif 460 #endif
457 }; 461 };
458 462
459 } // namespace net 463 } // namespace net
460 464
461 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ 465 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_
OLDNEW
« no previous file with comments | « net/base/load_flags_list.h ('k') | net/http/http_cache_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698