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

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

Issue 12086021: Allow automatic use of stale cache entries if site is unreachable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed redirect behavior. Created 7 years, 10 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
11 #include <string> 11 #include <string>
12 #include <vector>
12 13
13 #include "base/time.h" 14 #include "base/time.h"
14 #include "net/base/completion_callback.h" 15 #include "net/base/completion_callback.h"
15 #include "net/base/net_log.h" 16 #include "net/base/net_log.h"
16 #include "net/http/http_cache.h" 17 #include "net/http/http_cache.h"
17 #include "net/http/http_response_info.h" 18 #include "net/http/http_response_info.h"
18 #include "net/http/http_request_headers.h" 19 #include "net/http/http_request_headers.h"
19 #include "net/http/http_transaction.h" 20 #include "net/http/http_transaction.h"
20 21
21 namespace net { 22 namespace net {
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 373
373 // Resets cache_io_start_ to the current time, if |return_value| is 374 // Resets cache_io_start_ to the current time, if |return_value| is
374 // ERR_IO_PENDING. 375 // ERR_IO_PENDING.
375 // Returns |return_value|. 376 // Returns |return_value|.
376 int ResetCacheIOStart(int return_value); 377 int ResetCacheIOStart(int return_value);
377 378
378 void ScheduleDelayedLoop(base::TimeDelta delay, int result); 379 void ScheduleDelayedLoop(base::TimeDelta delay, int result);
379 void RunDelayedLoop(base::TimeTicks delay_start_time, 380 void RunDelayedLoop(base::TimeTicks delay_start_time,
380 base::TimeDelta intended_delay, int result); 381 base::TimeDelta intended_delay, int result);
381 382
383 #if !defined(NDEBUG)
384 void DumpStatePath();
385 #endif
386
382 State next_state_; 387 State next_state_;
383 const HttpRequestInfo* request_; 388 const HttpRequestInfo* request_;
384 BoundNetLog net_log_; 389 BoundNetLog net_log_;
385 scoped_ptr<HttpRequestInfo> custom_request_; 390 scoped_ptr<HttpRequestInfo> custom_request_;
386 HttpRequestHeaders request_headers_copy_; 391 HttpRequestHeaders request_headers_copy_;
387 // If extra_headers specified a "if-modified-since" or "if-none-match", 392 // If extra_headers specified a "if-modified-since" or "if-none-match",
388 // |external_validation_| contains the value of those headers. 393 // |external_validation_| contains the value of those headers.
389 ValidationHeaders external_validation_; 394 ValidationHeaders external_validation_;
390 base::WeakPtr<HttpCache> cache_; 395 base::WeakPtr<HttpCache> cache_;
391 HttpCache::ActiveEntry* entry_; 396 HttpCache::ActiveEntry* entry_;
392 HttpCache::ActiveEntry* new_entry_; 397 HttpCache::ActiveEntry* new_entry_;
393 scoped_ptr<HttpTransaction> network_trans_; 398 scoped_ptr<HttpTransaction> network_trans_;
394 scoped_ptr<InfiniteCacheTransaction> infinite_cache_transaction_; 399 scoped_ptr<InfiniteCacheTransaction> infinite_cache_transaction_;
395 CompletionCallback callback_; // Consumer's callback. 400 CompletionCallback callback_; // Consumer's callback.
396 HttpResponseInfo response_; 401 HttpResponseInfo response_;
397 HttpResponseInfo auth_response_; 402 HttpResponseInfo auth_response_;
398 const HttpResponseInfo* new_response_; 403 const HttpResponseInfo* new_response_;
399 std::string cache_key_; 404 std::string cache_key_;
400 Mode mode_; 405 Mode mode_;
401 State target_state_; 406 State target_state_;
402 bool reading_; // We are already reading. 407 bool reading_; // We are already reading.
403 bool invalid_range_; // We may bypass the cache for this request. 408 bool invalid_range_; // We may bypass the cache for this request.
404 bool truncated_; // We don't have all the response data. 409 bool truncated_; // We don't have all the response data.
405 bool is_sparse_; // The data is stored in sparse byte ranges. 410 bool is_sparse_; // The data is stored in sparse byte ranges.
406 bool range_requested_; // The user requested a byte range. 411 bool range_requested_; // The user requested a byte range.
407 bool handling_206_; // We must deal with this 206 response. 412 bool handling_206_; // We must deal with this 206 response.
408 bool cache_pending_; // We are waiting for the HttpCache. 413 bool cache_pending_; // We are waiting for the HttpCache.
409 bool done_reading_; 414 bool done_reading_;
410 bool vary_mismatch_; // The request doesn't match the stored vary data. 415 bool vary_mismatch_; // The request doesn't match the stored vary data.
416 bool couldnt_conditionalize_request_;
411 scoped_refptr<IOBuffer> read_buf_; 417 scoped_refptr<IOBuffer> read_buf_;
412 int io_buf_len_; 418 int io_buf_len_;
413 int read_offset_; 419 int read_offset_;
414 int effective_load_flags_; 420 int effective_load_flags_;
415 int write_len_; 421 int write_len_;
416 scoped_ptr<PartialData> partial_; // We are dealing with range requests. 422 scoped_ptr<PartialData> partial_; // We are dealing with range requests.
417 UploadProgress final_upload_progress_; 423 UploadProgress final_upload_progress_;
418 base::WeakPtrFactory<Transaction> weak_factory_; 424 base::WeakPtrFactory<Transaction> weak_factory_;
419 CompletionCallback io_callback_; 425 CompletionCallback io_callback_;
420 426
(...skipping 14 matching lines...) Expand all
435 // a delay on return, we must defer that delay until AddToEntry has been 441 // a delay on return, we must defer that delay until AddToEntry has been
436 // called, to avoid a race condition on the address returned. 442 // called, to avoid a race condition on the address returned.
437 base::TimeDelta deferred_cache_sensitivity_delay_; 443 base::TimeDelta deferred_cache_sensitivity_delay_;
438 bool defer_cache_sensitivity_delay_; 444 bool defer_cache_sensitivity_delay_;
439 445
440 // For sensitivity analysis, the simulated increase in cache service times, 446 // For sensitivity analysis, the simulated increase in cache service times,
441 // in percent. 447 // in percent.
442 int sensitivity_analysis_percent_increase_; 448 int sensitivity_analysis_percent_increase_;
443 449
444 HttpTransactionDelegate* transaction_delegate_; 450 HttpTransactionDelegate* transaction_delegate_;
451
452 #if !defined(NDEBUG)
453 // Record of all states this transaction has moved through.
454 std::vector<int> state_path_;
455 #endif
445 }; 456 };
446 457
447 } // namespace net 458 } // namespace net
448 459
449 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ 460 #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