Chromium Code Reviews| 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_job.h" | 5 #include "net/http/http_stream_factory_impl_job.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 if (connection_ && connection_->socket()) { | 311 if (connection_ && connection_->socket()) { |
| 312 connection_->socket()->Disconnect(); | 312 connection_->socket()->Disconnect(); |
| 313 } | 313 } |
| 314 delegate_->OnOrphanedJobComplete(this); | 314 delegate_->OnOrphanedJobComplete(this); |
| 315 } | 315 } |
| 316 // |this| may be deleted after this call. | 316 // |this| may be deleted after this call. |
| 317 } | 317 } |
| 318 | 318 |
| 319 void HttpStreamFactoryImpl::Job::SetPriority(RequestPriority priority) { | 319 void HttpStreamFactoryImpl::Job::SetPriority(RequestPriority priority) { |
| 320 priority_ = priority; | 320 priority_ = priority; |
| 321 // TODO(akalin): Propagate this to |connection_| and maybe the | 321 // Ownership of |connection_| is passed to the newly created stream |
| 322 // preconnect state. | 322 // or H2 session in DoCreateStream(), and the consumer is not |
| 323 // notified immediately, so this call may occur when |connection_| | |
| 324 // is null. | |
|
mmenke
2017/01/18 20:37:26
suggest a blank comment between both comments.
Randy Smith (Not in Mondays)
2017/01/22 21:37:00
Done.
| |
| 325 // Note that streams are created without a priority associated with them, | |
| 326 // and it is up to the consumer to set their priority via | |
| 327 // HttpStream::InitializeStream(). So there is no need for this code | |
| 328 // to propagate priority changes to the newly created stream. | |
| 329 if (connection_ && connection_->is_initialized()) | |
| 330 connection_->SetPriority(priority); | |
| 331 // TODO(akalin): Maybe Propagate this to the preconnect state. | |
| 323 } | 332 } |
| 324 | 333 |
| 325 bool HttpStreamFactoryImpl::Job::was_alpn_negotiated() const { | 334 bool HttpStreamFactoryImpl::Job::was_alpn_negotiated() const { |
| 326 return was_alpn_negotiated_; | 335 return was_alpn_negotiated_; |
| 327 } | 336 } |
| 328 | 337 |
| 329 NextProto HttpStreamFactoryImpl::Job::negotiated_protocol() const { | 338 NextProto HttpStreamFactoryImpl::Job::negotiated_protocol() const { |
| 330 return negotiated_protocol_; | 339 return negotiated_protocol_; |
| 331 } | 340 } |
| 332 | 341 |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1170 bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) && | 1179 bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) && |
| 1171 (request_info_.url.SchemeIs(url::kHttpScheme) || | 1180 (request_info_.url.SchemeIs(url::kHttpScheme) || |
| 1172 request_info_.url.SchemeIs(url::kFtpScheme)); | 1181 request_info_.url.SchemeIs(url::kFtpScheme)); |
| 1173 if (delegate_->for_websockets()) { | 1182 if (delegate_->for_websockets()) { |
| 1174 DCHECK_NE(job_type_, PRECONNECT); | 1183 DCHECK_NE(job_type_, PRECONNECT); |
| 1175 DCHECK(delegate_->websocket_handshake_stream_create_helper()); | 1184 DCHECK(delegate_->websocket_handshake_stream_create_helper()); |
| 1176 websocket_stream_.reset( | 1185 websocket_stream_.reset( |
| 1177 delegate_->websocket_handshake_stream_create_helper() | 1186 delegate_->websocket_handshake_stream_create_helper() |
| 1178 ->CreateBasicStream(std::move(connection_), using_proxy)); | 1187 ->CreateBasicStream(std::move(connection_), using_proxy)); |
| 1179 } else { | 1188 } else { |
| 1189 LOG(ERROR) << __FUNCTION__ << ":" << __LINE__ << ": Stream set"; | |
|
mmenke
2017/01/18 20:37:26
Remove comment? DLOG?
Randy Smith (Not in Mondays)
2017/01/22 21:37:00
Ooops. Done.
| |
| 1180 stream_.reset(new HttpBasicStream( | 1190 stream_.reset(new HttpBasicStream( |
| 1181 std::move(connection_), using_proxy, | 1191 std::move(connection_), using_proxy, |
| 1182 session_->params().http_09_on_non_default_ports_enabled)); | 1192 session_->params().http_09_on_non_default_ports_enabled)); |
| 1183 } | 1193 } |
| 1184 return OK; | 1194 return OK; |
| 1185 } | 1195 } |
| 1186 | 1196 |
| 1187 CHECK(!stream_.get()); | 1197 CHECK(!stream_.get()); |
| 1188 | 1198 |
| 1189 bool direct = !IsHttpsProxyAndHttpUrl(); | 1199 bool direct = !IsHttpsProxyAndHttpUrl(); |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1505 | 1515 |
| 1506 ConnectionAttempts socket_attempts = connection_->connection_attempts(); | 1516 ConnectionAttempts socket_attempts = connection_->connection_attempts(); |
| 1507 if (connection_->socket()) { | 1517 if (connection_->socket()) { |
| 1508 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1518 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
| 1509 } | 1519 } |
| 1510 | 1520 |
| 1511 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); | 1521 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); |
| 1512 } | 1522 } |
| 1513 | 1523 |
| 1514 } // namespace net | 1524 } // namespace net |
| OLD | NEW |