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 #include "net/http/http_stream_factory_impl.h" | 5 #include "net/http/http_stream_factory_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 DCHECK(request_map_.empty()); | 96 DCHECK(request_map_.empty()); |
97 DCHECK(spdy_session_request_map_.empty()); | 97 DCHECK(spdy_session_request_map_.empty()); |
98 } | 98 } |
99 | 99 |
100 HttpStreamRequest* HttpStreamFactoryImpl::RequestStream( | 100 HttpStreamRequest* HttpStreamFactoryImpl::RequestStream( |
101 const HttpRequestInfo& request_info, | 101 const HttpRequestInfo& request_info, |
102 RequestPriority priority, | 102 RequestPriority priority, |
103 const SSLConfig& server_ssl_config, | 103 const SSLConfig& server_ssl_config, |
104 const SSLConfig& proxy_ssl_config, | 104 const SSLConfig& proxy_ssl_config, |
105 HttpStreamRequest::Delegate* delegate, | 105 HttpStreamRequest::Delegate* delegate, |
106 const BoundNetLog& net_log) { | 106 const NetLogWithSource& net_log) { |
107 DCHECK(!for_websockets_); | 107 DCHECK(!for_websockets_); |
108 return RequestStreamInternal(request_info, priority, server_ssl_config, | 108 return RequestStreamInternal(request_info, priority, server_ssl_config, |
109 proxy_ssl_config, delegate, nullptr, | 109 proxy_ssl_config, delegate, nullptr, |
110 HttpStreamRequest::HTTP_STREAM, net_log); | 110 HttpStreamRequest::HTTP_STREAM, net_log); |
111 } | 111 } |
112 | 112 |
113 HttpStreamRequest* HttpStreamFactoryImpl::RequestWebSocketHandshakeStream( | 113 HttpStreamRequest* HttpStreamFactoryImpl::RequestWebSocketHandshakeStream( |
114 const HttpRequestInfo& request_info, | 114 const HttpRequestInfo& request_info, |
115 RequestPriority priority, | 115 RequestPriority priority, |
116 const SSLConfig& server_ssl_config, | 116 const SSLConfig& server_ssl_config, |
117 const SSLConfig& proxy_ssl_config, | 117 const SSLConfig& proxy_ssl_config, |
118 HttpStreamRequest::Delegate* delegate, | 118 HttpStreamRequest::Delegate* delegate, |
119 WebSocketHandshakeStreamBase::CreateHelper* create_helper, | 119 WebSocketHandshakeStreamBase::CreateHelper* create_helper, |
120 const BoundNetLog& net_log) { | 120 const NetLogWithSource& net_log) { |
121 DCHECK(for_websockets_); | 121 DCHECK(for_websockets_); |
122 DCHECK(create_helper); | 122 DCHECK(create_helper); |
123 return RequestStreamInternal(request_info, priority, server_ssl_config, | 123 return RequestStreamInternal(request_info, priority, server_ssl_config, |
124 proxy_ssl_config, delegate, create_helper, | 124 proxy_ssl_config, delegate, create_helper, |
125 HttpStreamRequest::HTTP_STREAM, net_log); | 125 HttpStreamRequest::HTTP_STREAM, net_log); |
126 } | 126 } |
127 | 127 |
128 HttpStreamRequest* HttpStreamFactoryImpl::RequestBidirectionalStreamImpl( | 128 HttpStreamRequest* HttpStreamFactoryImpl::RequestBidirectionalStreamImpl( |
129 const HttpRequestInfo& request_info, | 129 const HttpRequestInfo& request_info, |
130 RequestPriority priority, | 130 RequestPriority priority, |
131 const SSLConfig& server_ssl_config, | 131 const SSLConfig& server_ssl_config, |
132 const SSLConfig& proxy_ssl_config, | 132 const SSLConfig& proxy_ssl_config, |
133 HttpStreamRequest::Delegate* delegate, | 133 HttpStreamRequest::Delegate* delegate, |
134 const BoundNetLog& net_log) { | 134 const NetLogWithSource& net_log) { |
135 DCHECK(!for_websockets_); | 135 DCHECK(!for_websockets_); |
136 DCHECK(request_info.url.SchemeIs(url::kHttpsScheme)); | 136 DCHECK(request_info.url.SchemeIs(url::kHttpsScheme)); |
137 | 137 |
138 return RequestStreamInternal( | 138 return RequestStreamInternal( |
139 request_info, priority, server_ssl_config, proxy_ssl_config, delegate, | 139 request_info, priority, server_ssl_config, proxy_ssl_config, delegate, |
140 nullptr, HttpStreamRequest::BIDIRECTIONAL_STREAM, net_log); | 140 nullptr, HttpStreamRequest::BIDIRECTIONAL_STREAM, net_log); |
141 } | 141 } |
142 | 142 |
143 HttpStreamRequest* HttpStreamFactoryImpl::RequestStreamInternal( | 143 HttpStreamRequest* HttpStreamFactoryImpl::RequestStreamInternal( |
144 const HttpRequestInfo& request_info, | 144 const HttpRequestInfo& request_info, |
145 RequestPriority priority, | 145 RequestPriority priority, |
146 const SSLConfig& server_ssl_config, | 146 const SSLConfig& server_ssl_config, |
147 const SSLConfig& proxy_ssl_config, | 147 const SSLConfig& proxy_ssl_config, |
148 HttpStreamRequest::Delegate* delegate, | 148 HttpStreamRequest::Delegate* delegate, |
149 WebSocketHandshakeStreamBase::CreateHelper* | 149 WebSocketHandshakeStreamBase::CreateHelper* |
150 websocket_handshake_stream_create_helper, | 150 websocket_handshake_stream_create_helper, |
151 HttpStreamRequest::StreamType stream_type, | 151 HttpStreamRequest::StreamType stream_type, |
152 const BoundNetLog& net_log) { | 152 const NetLogWithSource& net_log) { |
153 JobController* job_controller = | 153 JobController* job_controller = |
154 new JobController(this, delegate, session_, job_factory_.get()); | 154 new JobController(this, delegate, session_, job_factory_.get()); |
155 job_controller_set_.insert(base::WrapUnique(job_controller)); | 155 job_controller_set_.insert(base::WrapUnique(job_controller)); |
156 | 156 |
157 Request* request = job_controller->Start( | 157 Request* request = job_controller->Start( |
158 request_info, delegate, websocket_handshake_stream_create_helper, net_log, | 158 request_info, delegate, websocket_handshake_stream_create_helper, net_log, |
159 stream_type, priority, server_ssl_config, proxy_ssl_config); | 159 stream_type, priority, server_ssl_config, proxy_ssl_config); |
160 | 160 |
161 return request; | 161 return request; |
162 } | 162 } |
(...skipping 22 matching lines...) Expand all Loading... |
185 } | 185 } |
186 | 186 |
187 void HttpStreamFactoryImpl::OnNewSpdySessionReady( | 187 void HttpStreamFactoryImpl::OnNewSpdySessionReady( |
188 const base::WeakPtr<SpdySession>& spdy_session, | 188 const base::WeakPtr<SpdySession>& spdy_session, |
189 bool direct, | 189 bool direct, |
190 const SSLConfig& used_ssl_config, | 190 const SSLConfig& used_ssl_config, |
191 const ProxyInfo& used_proxy_info, | 191 const ProxyInfo& used_proxy_info, |
192 bool was_alpn_negotiated, | 192 bool was_alpn_negotiated, |
193 NextProto negotiated_protocol, | 193 NextProto negotiated_protocol, |
194 bool using_spdy, | 194 bool using_spdy, |
195 const BoundNetLog& net_log) { | 195 const NetLogWithSource& net_log) { |
196 while (true) { | 196 while (true) { |
197 if (!spdy_session) | 197 if (!spdy_session) |
198 break; | 198 break; |
199 const SpdySessionKey& spdy_session_key = spdy_session->spdy_session_key(); | 199 const SpdySessionKey& spdy_session_key = spdy_session->spdy_session_key(); |
200 // Each iteration may empty out the RequestSet for |spdy_session_key| in | 200 // Each iteration may empty out the RequestSet for |spdy_session_key| in |
201 // |spdy_session_request_map_|. So each time, check for RequestSet and use | 201 // |spdy_session_request_map_|. So each time, check for RequestSet and use |
202 // the first one. | 202 // the first one. |
203 // | 203 // |
204 // TODO(willchan): If it's important, switch RequestSet out for a FIFO | 204 // TODO(willchan): If it's important, switch RequestSet out for a FIFO |
205 // queue (Order by priority first, then FIFO within same priority). Unclear | 205 // queue (Order by priority first, then FIFO within same priority). Unclear |
(...skipping 26 matching lines...) Expand all Loading... |
232 ++it) { | 232 ++it) { |
233 if (it->get() == controller) { | 233 if (it->get() == controller) { |
234 job_controller_set_.erase(it); | 234 job_controller_set_.erase(it); |
235 return; | 235 return; |
236 } | 236 } |
237 } | 237 } |
238 NOTREACHED(); | 238 NOTREACHED(); |
239 } | 239 } |
240 | 240 |
241 } // namespace net | 241 } // namespace net |
OLD | NEW |