| 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/time.h" | 13 #include "base/time/time.h" |
| 14 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
| 15 #include "net/base/request_priority.h" | 15 #include "net/base/request_priority.h" |
| 16 #include "net/http/http_cache.h" | 16 #include "net/http/http_cache.h" |
| 17 #include "net/http/http_request_headers.h" | 17 #include "net/http/http_request_headers.h" |
| 18 #include "net/http/http_response_headers.h" | 18 #include "net/http/http_response_headers.h" |
| 19 #include "net/http/http_response_info.h" | 19 #include "net/http/http_response_info.h" |
| 20 #include "net/http/http_transaction.h" | 20 #include "net/http/http_transaction.h" |
| 21 #include "net/log/net_log.h" | 21 #include "net/log/net_log.h" |
| 22 #include "net/socket/connection_attempts.h" |
| 22 | 23 |
| 23 namespace net { | 24 namespace net { |
| 24 | 25 |
| 25 class PartialData; | 26 class PartialData; |
| 26 struct HttpRequestInfo; | 27 struct HttpRequestInfo; |
| 27 struct LoadTimingInfo; | 28 struct LoadTimingInfo; |
| 28 | 29 |
| 29 // This is the transaction that is returned by the HttpCache transaction | 30 // This is the transaction that is returned by the HttpCache transaction |
| 30 // factory. | 31 // factory. |
| 31 class HttpCache::Transaction : public HttpTransaction { | 32 class HttpCache::Transaction : public HttpTransaction { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 void SetQuicServerInfo(QuicServerInfo* quic_server_info) override; | 138 void SetQuicServerInfo(QuicServerInfo* quic_server_info) override; |
| 138 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; | 139 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; |
| 139 void SetPriority(RequestPriority priority) override; | 140 void SetPriority(RequestPriority priority) override; |
| 140 void SetWebSocketHandshakeStreamCreateHelper( | 141 void SetWebSocketHandshakeStreamCreateHelper( |
| 141 WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; | 142 WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; |
| 142 void SetBeforeNetworkStartCallback( | 143 void SetBeforeNetworkStartCallback( |
| 143 const BeforeNetworkStartCallback& callback) override; | 144 const BeforeNetworkStartCallback& callback) override; |
| 144 void SetBeforeProxyHeadersSentCallback( | 145 void SetBeforeProxyHeadersSentCallback( |
| 145 const BeforeProxyHeadersSentCallback& callback) override; | 146 const BeforeProxyHeadersSentCallback& callback) override; |
| 146 int ResumeNetworkStart() override; | 147 int ResumeNetworkStart() override; |
| 148 void GetConnectionAttempts(ConnectionAttempts* out) const override; |
| 147 | 149 |
| 148 private: | 150 private: |
| 149 static const size_t kNumValidationHeaders = 2; | 151 static const size_t kNumValidationHeaders = 2; |
| 150 // Helper struct to pair a header name with its value, for | 152 // Helper struct to pair a header name with its value, for |
| 151 // headers used to validate cache entries. | 153 // headers used to validate cache entries. |
| 152 struct ValidationHeaders { | 154 struct ValidationHeaders { |
| 153 ValidationHeaders() : initialized(false) {} | 155 ValidationHeaders() : initialized(false) {} |
| 154 | 156 |
| 155 std::string values[kNumValidationHeaders]; | 157 std::string values[kNumValidationHeaders]; |
| 156 bool initialized; | 158 bool initialized; |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 base::TimeTicks first_cache_access_since_; | 465 base::TimeTicks first_cache_access_since_; |
| 464 base::TimeTicks send_request_since_; | 466 base::TimeTicks send_request_since_; |
| 465 | 467 |
| 466 int64 total_received_bytes_; | 468 int64 total_received_bytes_; |
| 467 | 469 |
| 468 // Load timing information for the last network request, if any. Set in the | 470 // Load timing information for the last network request, if any. Set in the |
| 469 // 304 and 206 response cases, as the network transaction may be destroyed | 471 // 304 and 206 response cases, as the network transaction may be destroyed |
| 470 // before the caller requests load timing information. | 472 // before the caller requests load timing information. |
| 471 scoped_ptr<LoadTimingInfo> old_network_trans_load_timing_; | 473 scoped_ptr<LoadTimingInfo> old_network_trans_load_timing_; |
| 472 | 474 |
| 475 ConnectionAttempts old_connection_attempts_; |
| 476 |
| 473 // The helper object to use to create WebSocketHandshakeStreamBase | 477 // The helper object to use to create WebSocketHandshakeStreamBase |
| 474 // objects. Only relevant when establishing a WebSocket connection. | 478 // objects. Only relevant when establishing a WebSocket connection. |
| 475 // This is passed to the underlying network transaction. It is stored here in | 479 // This is passed to the underlying network transaction. It is stored here in |
| 476 // case the transaction does not exist yet. | 480 // case the transaction does not exist yet. |
| 477 WebSocketHandshakeStreamBase::CreateHelper* | 481 WebSocketHandshakeStreamBase::CreateHelper* |
| 478 websocket_handshake_stream_base_create_helper_; | 482 websocket_handshake_stream_base_create_helper_; |
| 479 | 483 |
| 480 BeforeNetworkStartCallback before_network_start_callback_; | 484 BeforeNetworkStartCallback before_network_start_callback_; |
| 481 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; | 485 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; |
| 482 | 486 |
| 483 base::WeakPtrFactory<Transaction> weak_factory_; | 487 base::WeakPtrFactory<Transaction> weak_factory_; |
| 484 | 488 |
| 485 DISALLOW_COPY_AND_ASSIGN(Transaction); | 489 DISALLOW_COPY_AND_ASSIGN(Transaction); |
| 486 }; | 490 }; |
| 487 | 491 |
| 488 } // namespace net | 492 } // namespace net |
| 489 | 493 |
| 490 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 494 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
| OLD | NEW |