| 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 #ifndef NET_HTTP_HTTP_PIPELINED_CONNECTION_IMPL_H_ | 5 #ifndef NET_HTTP_HTTP_PIPELINED_CONNECTION_IMPL_H_ |
| 6 #define NET_HTTP_HTTP_PIPELINED_CONNECTION_IMPL_H_ | 6 #define NET_HTTP_HTTP_PIPELINED_CONNECTION_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 class Factory : public HttpPipelinedConnection::Factory { | 49 class Factory : public HttpPipelinedConnection::Factory { |
| 50 public: | 50 public: |
| 51 virtual HttpPipelinedConnection* CreateNewPipeline( | 51 virtual HttpPipelinedConnection* CreateNewPipeline( |
| 52 ClientSocketHandle* connection, | 52 ClientSocketHandle* connection, |
| 53 HttpPipelinedConnection::Delegate* delegate, | 53 HttpPipelinedConnection::Delegate* delegate, |
| 54 const HostPortPair& origin, | 54 const HostPortPair& origin, |
| 55 const SSLConfig& used_ssl_config, | 55 const SSLConfig& used_ssl_config, |
| 56 const ProxyInfo& used_proxy_info, | 56 const ProxyInfo& used_proxy_info, |
| 57 const BoundNetLog& net_log, | 57 const BoundNetLog& net_log, |
| 58 bool was_npn_negotiated, | 58 bool was_npn_negotiated, |
| 59 SSLClientSocket::NextProto protocol_negotiated) OVERRIDE { | 59 NextProto protocol_negotiated) OVERRIDE { |
| 60 return new HttpPipelinedConnectionImpl(connection, delegate, origin, | 60 return new HttpPipelinedConnectionImpl(connection, delegate, origin, |
| 61 used_ssl_config, used_proxy_info, | 61 used_ssl_config, used_proxy_info, |
| 62 net_log, was_npn_negotiated, | 62 net_log, was_npn_negotiated, |
| 63 protocol_negotiated); | 63 protocol_negotiated); |
| 64 } | 64 } |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 HttpPipelinedConnectionImpl(ClientSocketHandle* connection, | 67 HttpPipelinedConnectionImpl(ClientSocketHandle* connection, |
| 68 Delegate* delegate, | 68 Delegate* delegate, |
| 69 const HostPortPair& origin, | 69 const HostPortPair& origin, |
| 70 const SSLConfig& used_ssl_config, | 70 const SSLConfig& used_ssl_config, |
| 71 const ProxyInfo& used_proxy_info, | 71 const ProxyInfo& used_proxy_info, |
| 72 const BoundNetLog& net_log, | 72 const BoundNetLog& net_log, |
| 73 bool was_npn_negotiated, | 73 bool was_npn_negotiated, |
| 74 SSLClientSocket::NextProto protocol_negotiated); | 74 NextProto protocol_negotiated); |
| 75 virtual ~HttpPipelinedConnectionImpl(); | 75 virtual ~HttpPipelinedConnectionImpl(); |
| 76 | 76 |
| 77 // HttpPipelinedConnection interface. | 77 // HttpPipelinedConnection interface. |
| 78 | 78 |
| 79 // Used by HttpStreamFactoryImpl and friends. | 79 // Used by HttpStreamFactoryImpl and friends. |
| 80 virtual HttpPipelinedStream* CreateNewStream() OVERRIDE; | 80 virtual HttpPipelinedStream* CreateNewStream() OVERRIDE; |
| 81 | 81 |
| 82 // Used by HttpPipelinedHost. | 82 // Used by HttpPipelinedHost. |
| 83 virtual int depth() const OVERRIDE; | 83 virtual int depth() const OVERRIDE; |
| 84 virtual bool usable() const OVERRIDE; | 84 virtual bool usable() const OVERRIDE; |
| 85 virtual bool active() const OVERRIDE; | 85 virtual bool active() const OVERRIDE; |
| 86 | 86 |
| 87 // Used by HttpStreamFactoryImpl. | 87 // Used by HttpStreamFactoryImpl. |
| 88 virtual const SSLConfig& used_ssl_config() const OVERRIDE; | 88 virtual const SSLConfig& used_ssl_config() const OVERRIDE; |
| 89 virtual const ProxyInfo& used_proxy_info() const OVERRIDE; | 89 virtual const ProxyInfo& used_proxy_info() const OVERRIDE; |
| 90 virtual const BoundNetLog& net_log() const OVERRIDE; | 90 virtual const BoundNetLog& net_log() const OVERRIDE; |
| 91 virtual bool was_npn_negotiated() const OVERRIDE; | 91 virtual bool was_npn_negotiated() const OVERRIDE; |
| 92 virtual SSLClientSocket::NextProto protocol_negotiated() const OVERRIDE; | 92 virtual NextProto protocol_negotiated() const OVERRIDE; |
| 93 | 93 |
| 94 // Used by HttpPipelinedStream. | 94 // Used by HttpPipelinedStream. |
| 95 | 95 |
| 96 // Notifies this pipeline that a stream is no longer using it. | 96 // Notifies this pipeline that a stream is no longer using it. |
| 97 void OnStreamDeleted(int pipeline_id); | 97 void OnStreamDeleted(int pipeline_id); |
| 98 | 98 |
| 99 // Effective implementation of HttpStream. Note that we don't directly | 99 // Effective implementation of HttpStream. Note that we don't directly |
| 100 // implement that interface. Instead, these functions will be called by the | 100 // implement that interface. Instead, these functions will be called by the |
| 101 // pass-through methods in HttpPipelinedStream. | 101 // pass-through methods in HttpPipelinedStream. |
| 102 void InitializeParser(int pipeline_id, | 102 void InitializeParser(int pipeline_id, |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 // Invokes the callback queued in QueueUserCallback(). | 300 // Invokes the callback queued in QueueUserCallback(). |
| 301 void FireUserCallback(int pipeline_id, int result); | 301 void FireUserCallback(int pipeline_id, int result); |
| 302 | 302 |
| 303 Delegate* delegate_; | 303 Delegate* delegate_; |
| 304 scoped_ptr<ClientSocketHandle> connection_; | 304 scoped_ptr<ClientSocketHandle> connection_; |
| 305 SSLConfig used_ssl_config_; | 305 SSLConfig used_ssl_config_; |
| 306 ProxyInfo used_proxy_info_; | 306 ProxyInfo used_proxy_info_; |
| 307 BoundNetLog net_log_; | 307 BoundNetLog net_log_; |
| 308 bool was_npn_negotiated_; | 308 bool was_npn_negotiated_; |
| 309 // Protocol negotiated with the server. | 309 // Protocol negotiated with the server. |
| 310 SSLClientSocket::NextProto protocol_negotiated_; | 310 NextProto protocol_negotiated_; |
| 311 scoped_refptr<GrowableIOBuffer> read_buf_; | 311 scoped_refptr<GrowableIOBuffer> read_buf_; |
| 312 int next_pipeline_id_; | 312 int next_pipeline_id_; |
| 313 bool active_; | 313 bool active_; |
| 314 bool usable_; | 314 bool usable_; |
| 315 bool completed_one_request_; | 315 bool completed_one_request_; |
| 316 base::WeakPtrFactory<HttpPipelinedConnectionImpl> weak_factory_; | 316 base::WeakPtrFactory<HttpPipelinedConnectionImpl> weak_factory_; |
| 317 | 317 |
| 318 StreamInfoMap stream_info_map_; | 318 StreamInfoMap stream_info_map_; |
| 319 | 319 |
| 320 std::queue<int> request_order_; | 320 std::queue<int> request_order_; |
| 321 | 321 |
| 322 std::queue<PendingSendRequest*> pending_send_request_queue_; | 322 std::queue<PendingSendRequest*> pending_send_request_queue_; |
| 323 scoped_ptr<PendingSendRequest> active_send_request_; | 323 scoped_ptr<PendingSendRequest> active_send_request_; |
| 324 SendRequestState send_next_state_; | 324 SendRequestState send_next_state_; |
| 325 bool send_still_on_call_stack_; | 325 bool send_still_on_call_stack_; |
| 326 | 326 |
| 327 ReadHeadersState read_next_state_; | 327 ReadHeadersState read_next_state_; |
| 328 int active_read_id_; | 328 int active_read_id_; |
| 329 bool read_still_on_call_stack_; | 329 bool read_still_on_call_stack_; |
| 330 | 330 |
| 331 DISALLOW_COPY_AND_ASSIGN(HttpPipelinedConnectionImpl); | 331 DISALLOW_COPY_AND_ASSIGN(HttpPipelinedConnectionImpl); |
| 332 }; | 332 }; |
| 333 | 333 |
| 334 } // namespace net | 334 } // namespace net |
| 335 | 335 |
| 336 #endif // NET_HTTP_HTTP_PIPELINED_CONNECTION_IMPL_H_ | 336 #endif // NET_HTTP_HTTP_PIPELINED_CONNECTION_IMPL_H_ |
| OLD | NEW |