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 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
| 15 #include "net/base/net_log.h" | 15 #include "net/base/net_log.h" |
| 16 #include "net/base/request_priority.h" | 16 #include "net/base/request_priority.h" |
| 17 #include "net/http/http_cache.h" | 17 #include "net/http/http_cache.h" |
| 18 #include "net/http/http_response_info.h" | 18 #include "net/http/http_response_info.h" |
| 19 #include "net/http/http_request_headers.h" | 19 #include "net/http/http_request_headers.h" |
| 20 #include "net/http/http_transaction.h" | 20 #include "net/http/http_transaction.h" |
| 21 | 21 |
| 22 namespace net { | 22 namespace net { |
| 23 | 23 |
| 24 class PartialData; | 24 class PartialData; |
| 25 struct HttpRequestInfo; | 25 struct HttpRequestInfo; |
| 26 class HttpTransactionDelegate; | 26 class HttpTransactionDelegate; |
| 27 struct LoadTimingInfo; | |
| 27 | 28 |
| 28 // This is the transaction that is returned by the HttpCache transaction | 29 // This is the transaction that is returned by the HttpCache transaction |
| 29 // factory. | 30 // factory. |
| 30 class HttpCache::Transaction : public HttpTransaction { | 31 class HttpCache::Transaction : public HttpTransaction { |
| 31 public: | 32 public: |
| 32 // The transaction has the following modes, which apply to how it may access | 33 // The transaction has the following modes, which apply to how it may access |
| 33 // its cache entry. | 34 // its cache entry. |
| 34 // | 35 // |
| 35 // o If the mode of the transaction is NONE, then it is in "pass through" | 36 // o If the mode of the transaction is NONE, then it is in "pass through" |
| 36 // mode and all methods just forward to the inner network transaction. | 37 // mode and all methods just forward to the inner network transaction. |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 378 | 379 |
| 379 // Resets cache_io_start_ to the current time, if |return_value| is | 380 // Resets cache_io_start_ to the current time, if |return_value| is |
| 380 // ERR_IO_PENDING. | 381 // ERR_IO_PENDING. |
| 381 // Returns |return_value|. | 382 // Returns |return_value|. |
| 382 int ResetCacheIOStart(int return_value); | 383 int ResetCacheIOStart(int return_value); |
| 383 | 384 |
| 384 void ScheduleDelayedLoop(base::TimeDelta delay, int result); | 385 void ScheduleDelayedLoop(base::TimeDelta delay, int result); |
| 385 void RunDelayedLoop(base::TimeTicks delay_start_time, | 386 void RunDelayedLoop(base::TimeTicks delay_start_time, |
| 386 base::TimeDelta intended_delay, int result); | 387 base::TimeDelta intended_delay, int result); |
| 387 | 388 |
| 389 // Resets |network_trans_|, which must be non-NULL. Also updates | |
| 390 // |old_network_trans_load_timing_|, which must NULL. | |
|
eroman
2013/05/15 01:11:50
"which must NULL" --> something is missing
mmenke
2013/05/15 01:52:38
Done.
| |
| 391 void ResetNetworkTransaction(); | |
| 392 | |
| 388 State next_state_; | 393 State next_state_; |
| 389 const HttpRequestInfo* request_; | 394 const HttpRequestInfo* request_; |
| 390 RequestPriority priority_; | 395 RequestPriority priority_; |
| 391 BoundNetLog net_log_; | 396 BoundNetLog net_log_; |
| 392 scoped_ptr<HttpRequestInfo> custom_request_; | 397 scoped_ptr<HttpRequestInfo> custom_request_; |
| 393 HttpRequestHeaders request_headers_copy_; | 398 HttpRequestHeaders request_headers_copy_; |
| 394 // If extra_headers specified a "if-modified-since" or "if-none-match", | 399 // If extra_headers specified a "if-modified-since" or "if-none-match", |
| 395 // |external_validation_| contains the value of those headers. | 400 // |external_validation_| contains the value of those headers. |
| 396 ValidationHeaders external_validation_; | 401 ValidationHeaders external_validation_; |
| 397 base::WeakPtr<HttpCache> cache_; | 402 base::WeakPtr<HttpCache> cache_; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 440 // a delay on return, we must defer that delay until AddToEntry has been | 445 // a delay on return, we must defer that delay until AddToEntry has been |
| 441 // called, to avoid a race condition on the address returned. | 446 // called, to avoid a race condition on the address returned. |
| 442 base::TimeDelta deferred_cache_sensitivity_delay_; | 447 base::TimeDelta deferred_cache_sensitivity_delay_; |
| 443 bool defer_cache_sensitivity_delay_; | 448 bool defer_cache_sensitivity_delay_; |
| 444 | 449 |
| 445 // For sensitivity analysis, the simulated increase in cache service times, | 450 // For sensitivity analysis, the simulated increase in cache service times, |
| 446 // in percent. | 451 // in percent. |
| 447 int sensitivity_analysis_percent_increase_; | 452 int sensitivity_analysis_percent_increase_; |
| 448 | 453 |
| 449 HttpTransactionDelegate* transaction_delegate_; | 454 HttpTransactionDelegate* transaction_delegate_; |
| 455 | |
| 456 // Load timing information for the last network request, if any. Set in the | |
| 457 // 304 and 206 response cases, as the network transaction may be destroyed | |
| 458 // before the caller requests load timing information. | |
| 459 scoped_ptr<LoadTimingInfo> old_network_trans_load_timing_; | |
| 450 }; | 460 }; |
| 451 | 461 |
| 452 } // namespace net | 462 } // namespace net |
| 453 | 463 |
| 454 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 464 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
| OLD | NEW |