| 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" |
| 11 #include "net/http/http_stream_factory_impl_job.h" | 11 #include "net/http/http_stream_factory_impl_job.h" |
| 12 #include "net/log/net_log_event_type.h" | 12 #include "net/log/net_log_event_type.h" |
| 13 #include "net/spdy/spdy_http_stream.h" | 13 #include "net/spdy/spdy_http_stream.h" |
| 14 #include "net/spdy/spdy_session.h" | 14 #include "net/spdy/spdy_session.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 HttpStreamFactoryImpl::Request::Request( | 18 HttpStreamFactoryImpl::Request::Request( |
| 19 const GURL& url, | 19 const GURL& url, |
| 20 Helper* helper, | 20 Helper* helper, |
| 21 HttpStreamRequest::Delegate* delegate, | 21 HttpStreamRequest::Delegate* delegate, |
| 22 WebSocketHandshakeStreamBase::CreateHelper* | 22 WebSocketHandshakeStreamBase::CreateHelper* |
| 23 websocket_handshake_stream_create_helper, | 23 websocket_handshake_stream_create_helper, |
| 24 const NetLogWithSource& net_log, | 24 const NetLogWithSource* 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_alpn_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 DCHECK(net_log_); |
| 38 | 39 |
| 39 net_log_.BeginEvent(NetLogEventType::HTTP_STREAM_REQUEST); | 40 net_log_->BeginEvent(NetLogEventType::HTTP_STREAM_REQUEST); |
| 40 } | 41 } |
| 41 | 42 |
| 42 HttpStreamFactoryImpl::Request::~Request() { | 43 HttpStreamFactoryImpl::Request::~Request() { |
| 43 net_log_.EndEvent(NetLogEventType::HTTP_STREAM_REQUEST); | 44 net_log_->EndEvent(NetLogEventType::HTTP_STREAM_REQUEST); |
| 44 helper_->OnRequestComplete(); | 45 helper_->OnRequestComplete(); |
| 45 } | 46 } |
| 46 | 47 |
| 47 void HttpStreamFactoryImpl::Request::SetSpdySessionKey( | 48 void HttpStreamFactoryImpl::Request::SetSpdySessionKey( |
| 48 const SpdySessionKey& spdy_session_key) { | 49 const SpdySessionKey& spdy_session_key) { |
| 49 spdy_session_key_.reset(new SpdySessionKey(spdy_session_key)); | 50 spdy_session_key_.reset(new SpdySessionKey(spdy_session_key)); |
| 50 } | 51 } |
| 51 | 52 |
| 52 void HttpStreamFactoryImpl::Request::Complete(bool was_alpn_negotiated, | 53 void HttpStreamFactoryImpl::Request::Complete(bool was_alpn_negotiated, |
| 53 NextProto negotiated_protocol, | 54 NextProto negotiated_protocol, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 return spdy_session_key_.get() != NULL; | 166 return spdy_session_key_.get() != NULL; |
| 166 } | 167 } |
| 167 | 168 |
| 168 void HttpStreamFactoryImpl::Request::AddConnectionAttempts( | 169 void HttpStreamFactoryImpl::Request::AddConnectionAttempts( |
| 169 const ConnectionAttempts& attempts) { | 170 const ConnectionAttempts& attempts) { |
| 170 for (const auto& attempt : attempts) | 171 for (const auto& attempt : attempts) |
| 171 connection_attempts_.push_back(attempt); | 172 connection_attempts_.push_back(attempt); |
| 172 } | 173 } |
| 173 | 174 |
| 174 } // namespace net | 175 } // namespace net |
| OLD | NEW |