| 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_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 ClientSocketFactory* client_socket_factory, | 219 ClientSocketFactory* client_socket_factory, |
| 220 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, | 220 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, |
| 221 QuicRandom* random_generator, | 221 QuicRandom* random_generator, |
| 222 QuicClock* clock) | 222 QuicClock* clock) |
| 223 : host_resolver_(host_resolver), | 223 : host_resolver_(host_resolver), |
| 224 client_socket_factory_(client_socket_factory), | 224 client_socket_factory_(client_socket_factory), |
| 225 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), | 225 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), |
| 226 random_generator_(random_generator), | 226 random_generator_(random_generator), |
| 227 clock_(clock), | 227 clock_(clock), |
| 228 weak_factory_(this) { | 228 weak_factory_(this) { |
| 229 config_.SetDefaults(); |
| 230 config_.set_idle_connection_state_lifetime( |
| 231 QuicTime::Delta::FromSeconds(30), |
| 232 QuicTime::Delta::FromSeconds(30)); |
| 229 } | 233 } |
| 230 | 234 |
| 231 QuicStreamFactory::~QuicStreamFactory() { | 235 QuicStreamFactory::~QuicStreamFactory() { |
| 232 STLDeleteElements(&all_sessions_); | 236 STLDeleteElements(&all_sessions_); |
| 233 STLDeleteValues(&active_jobs_); | 237 STLDeleteValues(&active_jobs_); |
| 234 STLDeleteValues(&all_crypto_configs_); | 238 STLDeleteValues(&all_crypto_configs_); |
| 235 } | 239 } |
| 236 | 240 |
| 237 int QuicStreamFactory::Create(const HostPortProxyPair& host_port_proxy_pair, | 241 int QuicStreamFactory::Create(const HostPortProxyPair& host_port_proxy_pair, |
| 238 const BoundNetLog& net_log, | 242 const BoundNetLog& net_log, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 383 |
| 380 QuicConnection* connection = new QuicConnection(guid, addr, helper, false); | 384 QuicConnection* connection = new QuicConnection(guid, addr, helper, false); |
| 381 | 385 |
| 382 QuicCryptoClientConfig* crypto_config = | 386 QuicCryptoClientConfig* crypto_config = |
| 383 GetOrCreateCryptoConfig(host_port_proxy_pair); | 387 GetOrCreateCryptoConfig(host_port_proxy_pair); |
| 384 DCHECK(crypto_config); | 388 DCHECK(crypto_config); |
| 385 | 389 |
| 386 QuicClientSession* session = | 390 QuicClientSession* session = |
| 387 new QuicClientSession(connection, socket, this, | 391 new QuicClientSession(connection, socket, this, |
| 388 quic_crypto_client_stream_factory_, | 392 quic_crypto_client_stream_factory_, |
| 389 host_port_proxy_pair.first.host(), QuicConfig(), | 393 host_port_proxy_pair.first.host(), config_, |
| 390 crypto_config, net_log.net_log()); | 394 crypto_config, net_log.net_log()); |
| 391 session->config()->SetDefaults(); | |
| 392 session->config()->set_idle_connection_state_lifetime( | |
| 393 QuicTime::Delta::FromSeconds(30), | |
| 394 QuicTime::Delta::FromSeconds(30)); | |
| 395 all_sessions_.insert(session); // owning pointer | 395 all_sessions_.insert(session); // owning pointer |
| 396 return session; | 396 return session; |
| 397 } | 397 } |
| 398 | 398 |
| 399 bool QuicStreamFactory::HasActiveJob( | 399 bool QuicStreamFactory::HasActiveJob( |
| 400 const HostPortProxyPair& host_port_proxy_pair) { | 400 const HostPortProxyPair& host_port_proxy_pair) { |
| 401 return ContainsKey(active_jobs_, host_port_proxy_pair); | 401 return ContainsKey(active_jobs_, host_port_proxy_pair); |
| 402 } | 402 } |
| 403 | 403 |
| 404 void QuicStreamFactory::ActivateSession( | 404 void QuicStreamFactory::ActivateSession( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 417 DCHECK(crypto_config); | 417 DCHECK(crypto_config); |
| 418 } else { | 418 } else { |
| 419 crypto_config = new QuicCryptoClientConfig(); | 419 crypto_config = new QuicCryptoClientConfig(); |
| 420 crypto_config->SetDefaults(); | 420 crypto_config->SetDefaults(); |
| 421 all_crypto_configs_[host_port_proxy_pair] = crypto_config; | 421 all_crypto_configs_[host_port_proxy_pair] = crypto_config; |
| 422 } | 422 } |
| 423 return crypto_config; | 423 return crypto_config; |
| 424 } | 424 } |
| 425 | 425 |
| 426 } // namespace net | 426 } // namespace net |
| OLD | NEW |