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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 return OK; | 249 return OK; |
250 } | 250 } |
251 | 251 |
252 QuicStreamFactory::QuicStreamFactory( | 252 QuicStreamFactory::QuicStreamFactory( |
253 HostResolver* host_resolver, | 253 HostResolver* host_resolver, |
254 ClientSocketFactory* client_socket_factory, | 254 ClientSocketFactory* client_socket_factory, |
255 base::WeakPtr<HttpServerProperties> http_server_properties, | 255 base::WeakPtr<HttpServerProperties> http_server_properties, |
256 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, | 256 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, |
257 QuicRandom* random_generator, | 257 QuicRandom* random_generator, |
258 QuicClock* clock, | 258 QuicClock* clock, |
259 size_t max_packet_length) | 259 size_t max_packet_length, |
260 QuicVersionVector supported_versions) | |
jar (doing other things)
2013/12/20 00:53:12
nit: const ref
Ryan Hamilton
2013/12/20 01:55:02
Done.
| |
260 : require_confirmation_(true), | 261 : require_confirmation_(true), |
261 host_resolver_(host_resolver), | 262 host_resolver_(host_resolver), |
262 client_socket_factory_(client_socket_factory), | 263 client_socket_factory_(client_socket_factory), |
263 http_server_properties_(http_server_properties), | 264 http_server_properties_(http_server_properties), |
264 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), | 265 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), |
265 random_generator_(random_generator), | 266 random_generator_(random_generator), |
266 clock_(clock), | 267 clock_(clock), |
267 max_packet_length_(max_packet_length), | 268 max_packet_length_(max_packet_length), |
268 weak_factory_(this), | 269 supported_versions_(supported_versions), |
269 port_seed_(random_generator_->RandUint64()) { | 270 port_seed_(random_generator_->RandUint64()), |
271 weak_factory_(this) { | |
270 config_.SetDefaults(); | 272 config_.SetDefaults(); |
271 config_.set_idle_connection_state_lifetime( | 273 config_.set_idle_connection_state_lifetime( |
272 QuicTime::Delta::FromSeconds(30), | 274 QuicTime::Delta::FromSeconds(30), |
273 QuicTime::Delta::FromSeconds(30)); | 275 QuicTime::Delta::FromSeconds(30)); |
274 | 276 |
275 cannoncial_suffixes_.push_back(string(".c.youtube.com")); | 277 cannoncial_suffixes_.push_back(string(".c.youtube.com")); |
276 cannoncial_suffixes_.push_back(string(".googlevideo.com")); | 278 cannoncial_suffixes_.push_back(string(".googlevideo.com")); |
277 } | 279 } |
278 | 280 |
279 QuicStreamFactory::~QuicStreamFactory() { | 281 QuicStreamFactory::~QuicStreamFactory() { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 new QuicDefaultPacketWriter(socket.get())); | 490 new QuicDefaultPacketWriter(socket.get())); |
489 | 491 |
490 if (!helper_.get()) { | 492 if (!helper_.get()) { |
491 helper_.reset(new QuicConnectionHelper( | 493 helper_.reset(new QuicConnectionHelper( |
492 base::MessageLoop::current()->message_loop_proxy().get(), | 494 base::MessageLoop::current()->message_loop_proxy().get(), |
493 clock_.get(), random_generator_)); | 495 clock_.get(), random_generator_)); |
494 } | 496 } |
495 | 497 |
496 QuicConnection* connection = new QuicConnection(guid, addr, helper_.get(), | 498 QuicConnection* connection = new QuicConnection(guid, addr, helper_.get(), |
497 writer.get(), false, | 499 writer.get(), false, |
498 QuicSupportedVersions()); | 500 supported_versions_); |
499 writer->SetConnection(connection); | 501 writer->SetConnection(connection); |
500 connection->options()->max_packet_length = max_packet_length_; | 502 connection->options()->max_packet_length = max_packet_length_; |
501 | 503 |
502 QuicCryptoClientConfig* crypto_config = | 504 QuicCryptoClientConfig* crypto_config = |
503 GetOrCreateCryptoConfig(host_port_proxy_pair); | 505 GetOrCreateCryptoConfig(host_port_proxy_pair); |
504 DCHECK(crypto_config); | 506 DCHECK(crypto_config); |
505 | 507 |
506 *session = new QuicClientSession( | 508 *session = new QuicClientSession( |
507 connection, socket.Pass(), writer.Pass(), this, | 509 connection, socket.Pass(), writer.Pass(), this, |
508 quic_crypto_client_stream_factory_, host_port_proxy_pair.first.host(), | 510 quic_crypto_client_stream_factory_, host_port_proxy_pair.first.host(), |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
579 // Copy the CachedState for the canonical server from canonical_crypto_config | 581 // Copy the CachedState for the canonical server from canonical_crypto_config |
580 // as the initial CachedState for the server_hostname in crypto_config. | 582 // as the initial CachedState for the server_hostname in crypto_config. |
581 crypto_config->InitializeFrom(server_hostname, | 583 crypto_config->InitializeFrom(server_hostname, |
582 canonical_host_port_proxy_pair.first.host(), | 584 canonical_host_port_proxy_pair.first.host(), |
583 canonical_crypto_config); | 585 canonical_crypto_config); |
584 // Update canonical version to point at the "most recent" crypto_config. | 586 // Update canonical version to point at the "most recent" crypto_config. |
585 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair; | 587 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair; |
586 } | 588 } |
587 | 589 |
588 } // namespace net | 590 } // namespace net |
OLD | NEW |