| 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_request.h" | 5 #include "net/http/http_stream_factory_impl_request.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "net/http/bidirectional_stream_impl.h" | 10 #include "net/http/bidirectional_stream_impl.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 websocket_handshake_stream_create_helper, | 23 websocket_handshake_stream_create_helper, |
| 24 const BoundNetLog& net_log, | 24 const BoundNetLog& net_log, |
| 25 StreamType stream_type) | 25 StreamType stream_type) |
| 26 : url_(url), | 26 : url_(url), |
| 27 helper_(helper), | 27 helper_(helper), |
| 28 websocket_handshake_stream_create_helper_( | 28 websocket_handshake_stream_create_helper_( |
| 29 websocket_handshake_stream_create_helper), | 29 websocket_handshake_stream_create_helper), |
| 30 delegate_(delegate), | 30 delegate_(delegate), |
| 31 net_log_(net_log), | 31 net_log_(net_log), |
| 32 completed_(false), | 32 completed_(false), |
| 33 was_npn_negotiated_(false), | 33 was_alpn_negotiated_(false), |
| 34 negotiated_protocol_(kProtoUnknown), | 34 negotiated_protocol_(kProtoUnknown), |
| 35 using_spdy_(false), | 35 using_spdy_(false), |
| 36 stream_type_(stream_type) { | 36 stream_type_(stream_type) { |
| 37 DCHECK(delegate_); | 37 DCHECK(delegate_); |
| 38 | 38 |
| 39 net_log_.BeginEvent(NetLogEventType::HTTP_STREAM_REQUEST); | 39 net_log_.BeginEvent(NetLogEventType::HTTP_STREAM_REQUEST); |
| 40 } | 40 } |
| 41 | 41 |
| 42 HttpStreamFactoryImpl::Request::~Request() { | 42 HttpStreamFactoryImpl::Request::~Request() { |
| 43 net_log_.EndEvent(NetLogEventType::HTTP_STREAM_REQUEST); | 43 net_log_.EndEvent(NetLogEventType::HTTP_STREAM_REQUEST); |
| 44 helper_->OnRequestComplete(); | 44 helper_->OnRequestComplete(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void HttpStreamFactoryImpl::Request::SetSpdySessionKey( | 47 void HttpStreamFactoryImpl::Request::SetSpdySessionKey( |
| 48 const SpdySessionKey& spdy_session_key) { | 48 const SpdySessionKey& spdy_session_key) { |
| 49 spdy_session_key_.reset(new SpdySessionKey(spdy_session_key)); | 49 spdy_session_key_.reset(new SpdySessionKey(spdy_session_key)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void HttpStreamFactoryImpl::Request::Complete(bool was_npn_negotiated, | 52 void HttpStreamFactoryImpl::Request::Complete(bool was_alpn_negotiated, |
| 53 NextProto negotiated_protocol, | 53 NextProto negotiated_protocol, |
| 54 bool using_spdy) { | 54 bool using_spdy) { |
| 55 DCHECK(!completed_); | 55 DCHECK(!completed_); |
| 56 completed_ = true; | 56 completed_ = true; |
| 57 was_npn_negotiated_ = was_npn_negotiated; | 57 was_alpn_negotiated_ = was_alpn_negotiated; |
| 58 negotiated_protocol_ = negotiated_protocol; | 58 negotiated_protocol_ = negotiated_protocol; |
| 59 using_spdy_ = using_spdy; | 59 using_spdy_ = using_spdy; |
| 60 } | 60 } |
| 61 | 61 |
| 62 void HttpStreamFactoryImpl::Request::OnStreamReady( | 62 void HttpStreamFactoryImpl::Request::OnStreamReady( |
| 63 const SSLConfig& used_ssl_config, | 63 const SSLConfig& used_ssl_config, |
| 64 const ProxyInfo& used_proxy_info, | 64 const ProxyInfo& used_proxy_info, |
| 65 HttpStream* stream) { | 65 HttpStream* stream) { |
| 66 DCHECK(completed_); | 66 DCHECK(completed_); |
| 67 delegate_->OnStreamReady(used_ssl_config, used_proxy_info, stream); | 67 delegate_->OnStreamReady(used_ssl_config, used_proxy_info, stream); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 128 } |
| 129 | 129 |
| 130 void HttpStreamFactoryImpl::Request::SetPriority(RequestPriority priority) { | 130 void HttpStreamFactoryImpl::Request::SetPriority(RequestPriority priority) { |
| 131 helper_->SetPriority(priority); | 131 helper_->SetPriority(priority); |
| 132 } | 132 } |
| 133 | 133 |
| 134 LoadState HttpStreamFactoryImpl::Request::GetLoadState() const { | 134 LoadState HttpStreamFactoryImpl::Request::GetLoadState() const { |
| 135 return helper_->GetLoadState(); | 135 return helper_->GetLoadState(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 bool HttpStreamFactoryImpl::Request::was_npn_negotiated() const { | 138 bool HttpStreamFactoryImpl::Request::was_alpn_negotiated() const { |
| 139 DCHECK(completed_); | 139 DCHECK(completed_); |
| 140 return was_npn_negotiated_; | 140 return was_alpn_negotiated_; |
| 141 } | 141 } |
| 142 | 142 |
| 143 NextProto HttpStreamFactoryImpl::Request::negotiated_protocol() const { | 143 NextProto HttpStreamFactoryImpl::Request::negotiated_protocol() const { |
| 144 DCHECK(completed_); | 144 DCHECK(completed_); |
| 145 return negotiated_protocol_; | 145 return negotiated_protocol_; |
| 146 } | 146 } |
| 147 | 147 |
| 148 bool HttpStreamFactoryImpl::Request::using_spdy() const { | 148 bool HttpStreamFactoryImpl::Request::using_spdy() const { |
| 149 DCHECK(completed_); | 149 DCHECK(completed_); |
| 150 return using_spdy_; | 150 return using_spdy_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 165 return spdy_session_key_.get() != NULL; | 165 return spdy_session_key_.get() != NULL; |
| 166 } | 166 } |
| 167 | 167 |
| 168 void HttpStreamFactoryImpl::Request::AddConnectionAttempts( | 168 void HttpStreamFactoryImpl::Request::AddConnectionAttempts( |
| 169 const ConnectionAttempts& attempts) { | 169 const ConnectionAttempts& attempts) { |
| 170 for (const auto& attempt : attempts) | 170 for (const auto& attempt : attempts) |
| 171 connection_attempts_.push_back(attempt); | 171 connection_attempts_.push_back(attempt); |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace net | 174 } // namespace net |
| OLD | NEW |