| 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/quic/quic_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 int QuicStreamFactory::Job::DoResolveHostComplete(int rv) { | 145 int QuicStreamFactory::Job::DoResolveHostComplete(int rv) { |
| 146 if (rv != OK) | 146 if (rv != OK) |
| 147 return rv; | 147 return rv; |
| 148 | 148 |
| 149 DCHECK(!factory_->HasActiveSession(host_port_proxy_pair_)); | 149 DCHECK(!factory_->HasActiveSession(host_port_proxy_pair_)); |
| 150 io_state_ = STATE_CONNECT; | 150 io_state_ = STATE_CONNECT; |
| 151 return OK; | 151 return OK; |
| 152 } | 152 } |
| 153 | 153 |
| 154 QuicStreamRequest::QuicStreamRequest(QuicStreamFactory* factory) | 154 QuicStreamRequest::QuicStreamRequest(QuicStreamFactory* factory) |
| 155 : factory_(factory), | 155 : factory_(factory) {} |
| 156 stream_(NULL){ | |
| 157 } | |
| 158 | 156 |
| 159 QuicStreamRequest::~QuicStreamRequest() { | 157 QuicStreamRequest::~QuicStreamRequest() { |
| 160 if (factory_ && !callback_.is_null()) | 158 if (factory_ && !callback_.is_null()) |
| 161 factory_->CancelRequest(this); | 159 factory_->CancelRequest(this); |
| 162 } | 160 } |
| 163 | 161 |
| 164 int QuicStreamRequest::Request( | 162 int QuicStreamRequest::Request( |
| 165 const HostPortProxyPair& host_port_proxy_pair, | 163 const HostPortProxyPair& host_port_proxy_pair, |
| 166 const BoundNetLog& net_log, | 164 const BoundNetLog& net_log, |
| 167 const CompletionCallback& callback) { | 165 const CompletionCallback& callback) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 delete job; | 290 delete job; |
| 293 return; | 291 return; |
| 294 } | 292 } |
| 295 | 293 |
| 296 // Returns a newly created QuicHttpStream owned by the caller, if a | 294 // Returns a newly created QuicHttpStream owned by the caller, if a |
| 297 // matching session already exists. Returns NULL otherwise. | 295 // matching session already exists. Returns NULL otherwise. |
| 298 scoped_ptr<QuicHttpStream> QuicStreamFactory::CreateIfSessionExists( | 296 scoped_ptr<QuicHttpStream> QuicStreamFactory::CreateIfSessionExists( |
| 299 const HostPortProxyPair& host_port_proxy_pair, | 297 const HostPortProxyPair& host_port_proxy_pair, |
| 300 const BoundNetLog& net_log) { | 298 const BoundNetLog& net_log) { |
| 301 if (!HasActiveSession(host_port_proxy_pair)) { | 299 if (!HasActiveSession(host_port_proxy_pair)) { |
| 302 return scoped_ptr<QuicHttpStream>(NULL); | 300 return scoped_ptr<QuicHttpStream>(); |
| 303 } | 301 } |
| 304 | 302 |
| 305 QuicClientSession* session = active_sessions_[host_port_proxy_pair]; | 303 QuicClientSession* session = active_sessions_[host_port_proxy_pair]; |
| 306 DCHECK(session); | 304 DCHECK(session); |
| 307 return scoped_ptr<QuicHttpStream>( | 305 return scoped_ptr<QuicHttpStream>( |
| 308 new QuicHttpStream(session->CreateOutgoingReliableStream())); | 306 new QuicHttpStream(session->CreateOutgoingReliableStream())); |
| 309 } | 307 } |
| 310 | 308 |
| 311 void QuicStreamFactory::OnIdleSession(QuicClientSession* session) { | 309 void QuicStreamFactory::OnIdleSession(QuicClientSession* session) { |
| 312 } | 310 } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 DCHECK(crypto_config); | 416 DCHECK(crypto_config); |
| 419 } else { | 417 } else { |
| 420 crypto_config = new QuicCryptoClientConfig(); | 418 crypto_config = new QuicCryptoClientConfig(); |
| 421 crypto_config->SetDefaults(); | 419 crypto_config->SetDefaults(); |
| 422 all_crypto_configs_[host_port_proxy_pair] = crypto_config; | 420 all_crypto_configs_[host_port_proxy_pair] = crypto_config; |
| 423 } | 421 } |
| 424 return crypto_config; | 422 return crypto_config; |
| 425 } | 423 } |
| 426 | 424 |
| 427 } // namespace net | 425 } // namespace net |
| OLD | NEW |