OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 HttpResponseInfo* response; | 153 HttpResponseInfo* response; |
154 OldCompletionCallback* callback; | 154 OldCompletionCallback* callback; |
155 }; | 155 }; |
156 | 156 |
157 struct StreamInfo { | 157 struct StreamInfo { |
158 StreamInfo(); | 158 StreamInfo(); |
159 ~StreamInfo(); | 159 ~StreamInfo(); |
160 | 160 |
161 linked_ptr<HttpStreamParser> parser; | 161 linked_ptr<HttpStreamParser> parser; |
162 OldCompletionCallback* read_headers_callback; | 162 OldCompletionCallback* read_headers_callback; |
| 163 OldCompletionCallback* pending_user_callback; |
163 StreamState state; | 164 StreamState state; |
164 }; | 165 }; |
165 | 166 |
166 typedef std::map<int, StreamInfo> StreamInfoMap; | 167 typedef std::map<int, StreamInfo> StreamInfoMap; |
167 | 168 |
168 // Called after the first request is sent or in a task sometime after the | 169 // Called after the first request is sent or in a task sometime after the |
169 // first stream is added to this pipeline. This gives the first request | 170 // first stream is added to this pipeline. This gives the first request |
170 // priority to send, but doesn't hold up other requests if it doesn't. | 171 // priority to send, but doesn't hold up other requests if it doesn't. |
171 // When called the first time, notifies the |delegate_| that we can accept new | 172 // When called the first time, notifies the |delegate_| that we can accept new |
172 // requests. | 173 // requests. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // happen if there is an error with the pipeline or one of our | 229 // happen if there is an error with the pipeline or one of our |
229 // HttpPipelinedSockets indicates the connection was suddenly closed. | 230 // HttpPipelinedSockets indicates the connection was suddenly closed. |
230 int DoEvictPendingReadHeaders(int result); | 231 int DoEvictPendingReadHeaders(int result); |
231 | 232 |
232 // Invokes the user's callback in response to SendRequest() or | 233 // Invokes the user's callback in response to SendRequest() or |
233 // ReadResponseHeaders() completing on an underlying parser. This might be | 234 // ReadResponseHeaders() completing on an underlying parser. This might be |
234 // invoked in response to our own IO callbacks, or it may be invoked if the | 235 // invoked in response to our own IO callbacks, or it may be invoked if the |
235 // underlying parser completes SendRequest() or ReadResponseHeaders() | 236 // underlying parser completes SendRequest() or ReadResponseHeaders() |
236 // synchronously, but we've already returned ERR_IO_PENDING to the user's | 237 // synchronously, but we've already returned ERR_IO_PENDING to the user's |
237 // SendRequest() or ReadResponseHeaders() call into us. | 238 // SendRequest() or ReadResponseHeaders() call into us. |
238 void FireUserCallback(OldCompletionCallback* callback, int result); | 239 void FireUserCallback(int pipeline_id, int result); |
239 | 240 |
240 Delegate* delegate_; | 241 Delegate* delegate_; |
241 scoped_ptr<ClientSocketHandle> connection_; | 242 scoped_ptr<ClientSocketHandle> connection_; |
242 SSLConfig used_ssl_config_; | 243 SSLConfig used_ssl_config_; |
243 ProxyInfo used_proxy_info_; | 244 ProxyInfo used_proxy_info_; |
244 BoundNetLog net_log_; | 245 BoundNetLog net_log_; |
245 bool was_npn_negotiated_; | 246 bool was_npn_negotiated_; |
246 scoped_refptr<GrowableIOBuffer> read_buf_; | 247 scoped_refptr<GrowableIOBuffer> read_buf_; |
247 int next_pipeline_id_; | 248 int next_pipeline_id_; |
248 bool active_; | 249 bool active_; |
(...skipping 13 matching lines...) Expand all Loading... |
262 ReadHeadersState read_next_state_; | 263 ReadHeadersState read_next_state_; |
263 OldCompletionCallbackImpl<HttpPipelinedConnectionImpl> read_io_callback_; | 264 OldCompletionCallbackImpl<HttpPipelinedConnectionImpl> read_io_callback_; |
264 OldCompletionCallback* read_user_callback_; | 265 OldCompletionCallback* read_user_callback_; |
265 | 266 |
266 DISALLOW_COPY_AND_ASSIGN(HttpPipelinedConnectionImpl); | 267 DISALLOW_COPY_AND_ASSIGN(HttpPipelinedConnectionImpl); |
267 }; | 268 }; |
268 | 269 |
269 } // namespace net | 270 } // namespace net |
270 | 271 |
271 #endif // NET_HTTP_HTTP_PIPELINED_CONNECTION_IMPL_H_ | 272 #endif // NET_HTTP_HTTP_PIPELINED_CONNECTION_IMPL_H_ |
OLD | NEW |