| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef NET_SOCKET_STREAM_SOCKET_STREAM_H_ | 5 #ifndef NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
| 6 #define NET_SOCKET_STREAM_SOCKET_STREAM_H_ | 6 #define NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // |factory|. For testing purposes only. | 149 // |factory|. For testing purposes only. |
| 150 void SetClientSocketFactory(ClientSocketFactory* factory); | 150 void SetClientSocketFactory(ClientSocketFactory* factory); |
| 151 | 151 |
| 152 protected: | 152 protected: |
| 153 friend class base::RefCountedThreadSafe<SocketStream>; | 153 friend class base::RefCountedThreadSafe<SocketStream>; |
| 154 virtual ~SocketStream(); | 154 virtual ~SocketStream(); |
| 155 | 155 |
| 156 Delegate* delegate_; | 156 Delegate* delegate_; |
| 157 | 157 |
| 158 private: | 158 private: |
| 159 friend class WebSocketThrottleTest; |
| 160 |
| 161 typedef std::map<const void*, linked_ptr<UserData> > UserDataMap; |
| 162 typedef std::deque< scoped_refptr<IOBufferWithSize> > PendingDataQueue; |
| 163 |
| 159 class RequestHeaders : public IOBuffer { | 164 class RequestHeaders : public IOBuffer { |
| 160 public: | 165 public: |
| 161 RequestHeaders() : IOBuffer() {} | 166 RequestHeaders() : IOBuffer() {} |
| 162 | 167 |
| 163 void SetDataOffset(size_t offset) { | 168 void SetDataOffset(size_t offset) { |
| 164 data_ = const_cast<char*>(headers_.data()) + offset; | 169 data_ = const_cast<char*>(headers_.data()) + offset; |
| 165 } | 170 } |
| 166 | 171 |
| 167 std::string headers_; | 172 std::string headers_; |
| 168 | 173 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 STATE_AUTH_REQUIRED, | 210 STATE_AUTH_REQUIRED, |
| 206 STATE_CLOSE, | 211 STATE_CLOSE, |
| 207 }; | 212 }; |
| 208 | 213 |
| 209 enum ProxyMode { | 214 enum ProxyMode { |
| 210 kDirectConnection, // If using a direct connection | 215 kDirectConnection, // If using a direct connection |
| 211 kTunnelProxy, // If using a tunnel (CONNECT method as HTTPS) | 216 kTunnelProxy, // If using a tunnel (CONNECT method as HTTPS) |
| 212 kSOCKSProxy, // If using a SOCKS proxy | 217 kSOCKSProxy, // If using a SOCKS proxy |
| 213 }; | 218 }; |
| 214 | 219 |
| 215 typedef std::deque< scoped_refptr<IOBufferWithSize> > PendingDataQueue; | 220 // Use the same number as HttpNetworkTransaction::kMaxHeaderBufSize. |
| 216 | 221 enum { kMaxTunnelResponseHeadersSize = 32768 }; // 32 kilobytes. |
| 217 friend class WebSocketThrottleTest; | |
| 218 | 222 |
| 219 // Copies the given addrinfo list in |addresses_|. | 223 // Copies the given addrinfo list in |addresses_|. |
| 220 // Used for WebSocketThrottleTest. | 224 // Used for WebSocketThrottleTest. |
| 221 void CopyAddrInfo(struct addrinfo* head); | 225 void CopyAddrInfo(struct addrinfo* head); |
| 222 | 226 |
| 223 void DoClose(); | 227 void DoClose(); |
| 224 | 228 |
| 225 // Finishes the job. | 229 // Finishes the job. |
| 226 // Calls OnError and OnClose of delegate, and no more | 230 // Calls OnError and OnClose of delegate, and no more |
| 227 // notifications will be sent to delegate. | 231 // notifications will be sent to delegate. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 | 266 |
| 263 SSLConfigService* ssl_config_service() const; | 267 SSLConfigService* ssl_config_service() const; |
| 264 ProxyService* proxy_service() const; | 268 ProxyService* proxy_service() const; |
| 265 | 269 |
| 266 BoundNetLog net_log_; | 270 BoundNetLog net_log_; |
| 267 | 271 |
| 268 GURL url_; | 272 GURL url_; |
| 269 int max_pending_send_allowed_; | 273 int max_pending_send_allowed_; |
| 270 scoped_refptr<URLRequestContext> context_; | 274 scoped_refptr<URLRequestContext> context_; |
| 271 | 275 |
| 272 typedef std::map<const void*, linked_ptr<UserData> > UserDataMap; | |
| 273 UserDataMap user_data_; | 276 UserDataMap user_data_; |
| 274 | 277 |
| 275 State next_state_; | 278 State next_state_; |
| 276 HostResolver* host_resolver_; | 279 HostResolver* host_resolver_; |
| 277 CertVerifier* cert_verifier_; | 280 CertVerifier* cert_verifier_; |
| 278 HttpAuthHandlerFactory* http_auth_handler_factory_; | 281 HttpAuthHandlerFactory* http_auth_handler_factory_; |
| 279 ClientSocketFactory* factory_; | 282 ClientSocketFactory* factory_; |
| 280 | 283 |
| 281 ProxyMode proxy_mode_; | 284 ProxyMode proxy_mode_; |
| 282 | 285 |
| 283 GURL proxy_url_; | 286 GURL proxy_url_; |
| 284 ProxyService::PacRequest* pac_request_; | 287 ProxyService::PacRequest* pac_request_; |
| 285 ProxyInfo proxy_info_; | 288 ProxyInfo proxy_info_; |
| 286 | 289 |
| 287 HttpAuthCache auth_cache_; | 290 HttpAuthCache auth_cache_; |
| 288 scoped_ptr<HttpAuthHandler> auth_handler_; | 291 scoped_ptr<HttpAuthHandler> auth_handler_; |
| 289 HttpAuth::Identity auth_identity_; | 292 HttpAuth::Identity auth_identity_; |
| 290 scoped_refptr<AuthChallengeInfo> auth_info_; | 293 scoped_refptr<AuthChallengeInfo> auth_info_; |
| 291 | 294 |
| 292 scoped_refptr<RequestHeaders> tunnel_request_headers_; | 295 scoped_refptr<RequestHeaders> tunnel_request_headers_; |
| 293 size_t tunnel_request_headers_bytes_sent_; | 296 size_t tunnel_request_headers_bytes_sent_; |
| 294 scoped_refptr<ResponseHeaders> tunnel_response_headers_; | 297 scoped_refptr<ResponseHeaders> tunnel_response_headers_; |
| 295 int tunnel_response_headers_capacity_; | 298 int tunnel_response_headers_capacity_; |
| 296 int tunnel_response_headers_len_; | 299 int tunnel_response_headers_len_; |
| 297 | 300 |
| 298 // Use the same number as HttpNetworkTransaction::kMaxHeaderBufSize. | |
| 299 enum { kMaxTunnelResponseHeadersSize = 32768 }; // 32 kilobytes. | |
| 300 | |
| 301 scoped_ptr<SingleRequestHostResolver> resolver_; | 301 scoped_ptr<SingleRequestHostResolver> resolver_; |
| 302 AddressList addresses_; | 302 AddressList addresses_; |
| 303 scoped_ptr<ClientSocket> socket_; | 303 scoped_ptr<ClientSocket> socket_; |
| 304 | 304 |
| 305 SSLConfig ssl_config_; | 305 SSLConfig ssl_config_; |
| 306 | 306 |
| 307 CompletionCallbackImpl<SocketStream> io_callback_; | 307 CompletionCallbackImpl<SocketStream> io_callback_; |
| 308 CompletionCallbackImpl<SocketStream> read_callback_; | 308 CompletionCallbackImpl<SocketStream> read_callback_; |
| 309 CompletionCallbackImpl<SocketStream> write_callback_; | 309 CompletionCallbackImpl<SocketStream> write_callback_; |
| 310 | 310 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 327 bool server_closed_; | 327 bool server_closed_; |
| 328 | 328 |
| 329 scoped_ptr<SocketStreamMetrics> metrics_; | 329 scoped_ptr<SocketStreamMetrics> metrics_; |
| 330 | 330 |
| 331 DISALLOW_COPY_AND_ASSIGN(SocketStream); | 331 DISALLOW_COPY_AND_ASSIGN(SocketStream); |
| 332 }; | 332 }; |
| 333 | 333 |
| 334 } // namespace net | 334 } // namespace net |
| 335 | 335 |
| 336 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ | 336 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
| OLD | NEW |