| 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/spdy/spdy_http_stream.h" | 13 #include "net/spdy/spdy_http_stream.h" |
| 13 #include "net/spdy/spdy_session.h" | 14 #include "net/spdy/spdy_session.h" |
| 14 | 15 |
| 15 namespace net { | 16 namespace net { |
| 16 | 17 |
| 17 HttpStreamFactoryImpl::Request::Request( | 18 HttpStreamFactoryImpl::Request::Request( |
| 18 const GURL& url, | 19 const GURL& url, |
| 19 Helper* helper, | 20 Helper* helper, |
| 20 HttpStreamRequest::Delegate* delegate, | 21 HttpStreamRequest::Delegate* delegate, |
| 21 WebSocketHandshakeStreamBase::CreateHelper* | 22 WebSocketHandshakeStreamBase::CreateHelper* |
| 22 websocket_handshake_stream_create_helper, | 23 websocket_handshake_stream_create_helper, |
| 23 const BoundNetLog& net_log, | 24 const BoundNetLog& net_log, |
| 24 StreamType stream_type) | 25 StreamType stream_type) |
| 25 : url_(url), | 26 : url_(url), |
| 26 helper_(helper), | 27 helper_(helper), |
| 27 websocket_handshake_stream_create_helper_( | 28 websocket_handshake_stream_create_helper_( |
| 28 websocket_handshake_stream_create_helper), | 29 websocket_handshake_stream_create_helper), |
| 29 delegate_(delegate), | 30 delegate_(delegate), |
| 30 net_log_(net_log), | 31 net_log_(net_log), |
| 31 completed_(false), | 32 completed_(false), |
| 32 was_npn_negotiated_(false), | 33 was_npn_negotiated_(false), |
| 33 negotiated_protocol_(kProtoUnknown), | 34 negotiated_protocol_(kProtoUnknown), |
| 34 using_spdy_(false), | 35 using_spdy_(false), |
| 35 stream_type_(stream_type) { | 36 stream_type_(stream_type) { |
| 36 DCHECK(delegate_); | 37 DCHECK(delegate_); |
| 37 | 38 |
| 38 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_REQUEST); | 39 net_log_.BeginEvent(NetLogEventType::HTTP_STREAM_REQUEST); |
| 39 } | 40 } |
| 40 | 41 |
| 41 HttpStreamFactoryImpl::Request::~Request() { | 42 HttpStreamFactoryImpl::Request::~Request() { |
| 42 net_log_.EndEvent(NetLog::TYPE_HTTP_STREAM_REQUEST); | 43 net_log_.EndEvent(NetLogEventType::HTTP_STREAM_REQUEST); |
| 43 helper_->OnRequestComplete(); | 44 helper_->OnRequestComplete(); |
| 44 } | 45 } |
| 45 | 46 |
| 46 void HttpStreamFactoryImpl::Request::SetSpdySessionKey( | 47 void HttpStreamFactoryImpl::Request::SetSpdySessionKey( |
| 47 const SpdySessionKey& spdy_session_key) { | 48 const SpdySessionKey& spdy_session_key) { |
| 48 spdy_session_key_.reset(new SpdySessionKey(spdy_session_key)); | 49 spdy_session_key_.reset(new SpdySessionKey(spdy_session_key)); |
| 49 } | 50 } |
| 50 | 51 |
| 51 void HttpStreamFactoryImpl::Request::Complete(bool was_npn_negotiated, | 52 void HttpStreamFactoryImpl::Request::Complete(bool was_npn_negotiated, |
| 52 NextProto negotiated_protocol, | 53 NextProto negotiated_protocol, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 return spdy_session_key_.get() != NULL; | 165 return spdy_session_key_.get() != NULL; |
| 165 } | 166 } |
| 166 | 167 |
| 167 void HttpStreamFactoryImpl::Request::AddConnectionAttempts( | 168 void HttpStreamFactoryImpl::Request::AddConnectionAttempts( |
| 168 const ConnectionAttempts& attempts) { | 169 const ConnectionAttempts& attempts) { |
| 169 for (const auto& attempt : attempts) | 170 for (const auto& attempt : attempts) |
| 170 connection_attempts_.push_back(attempt); | 171 connection_attempts_.push_back(attempt); |
| 171 } | 172 } |
| 172 | 173 |
| 173 } // namespace net | 174 } // namespace net |
| OLD | NEW |