Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: net/quic/quic_stream_factory.cc

Issue 425803014: Refactor pooling logic into a helper method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_stream_factory.h ('k') | net/quic/quic_stream_factory_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/cpu.h" 9 #include "base/cpu.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 const std::string& user_agent_id, 462 const std::string& user_agent_id,
463 const QuicVersionVector& supported_versions, 463 const QuicVersionVector& supported_versions,
464 bool enable_port_selection, 464 bool enable_port_selection,
465 bool enable_pacing, 465 bool enable_pacing,
466 bool enable_time_based_loss_detection, 466 bool enable_time_based_loss_detection,
467 const QuicTagVector& connection_options) 467 const QuicTagVector& connection_options)
468 : require_confirmation_(true), 468 : require_confirmation_(true),
469 host_resolver_(host_resolver), 469 host_resolver_(host_resolver),
470 client_socket_factory_(client_socket_factory), 470 client_socket_factory_(client_socket_factory),
471 http_server_properties_(http_server_properties), 471 http_server_properties_(http_server_properties),
472 transport_security_state_(transport_security_state),
472 quic_server_info_factory_(NULL), 473 quic_server_info_factory_(NULL),
473 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), 474 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory),
474 random_generator_(random_generator), 475 random_generator_(random_generator),
475 clock_(clock), 476 clock_(clock),
476 max_packet_length_(max_packet_length), 477 max_packet_length_(max_packet_length),
477 config_(InitializeQuicConfig(enable_pacing, 478 config_(InitializeQuicConfig(enable_pacing,
478 enable_time_based_loss_detection, 479 enable_time_based_loss_detection,
479 connection_options)), 480 connection_options)),
480 supported_versions_(supported_versions), 481 supported_versions_(supported_versions),
481 enable_port_selection_(enable_port_selection), 482 enable_port_selection_(enable_port_selection),
482 port_seed_(random_generator_->RandUint64()), 483 port_seed_(random_generator_->RandUint64()),
483 weak_factory_(this) { 484 weak_factory_(this) {
485 DCHECK(transport_security_state_);
484 crypto_config_.SetDefaults(); 486 crypto_config_.SetDefaults();
485 crypto_config_.set_user_agent_id(user_agent_id); 487 crypto_config_.set_user_agent_id(user_agent_id);
486 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); 488 crypto_config_.AddCanonicalSuffix(".c.youtube.com");
487 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); 489 crypto_config_.AddCanonicalSuffix(".googlevideo.com");
488 crypto_config_.SetProofVerifier( 490 crypto_config_.SetProofVerifier(
489 new ProofVerifierChromium(cert_verifier, transport_security_state)); 491 new ProofVerifierChromium(cert_verifier, transport_security_state));
490 crypto_config_.SetChannelIDSource( 492 crypto_config_.SetChannelIDSource(
491 new ChannelIDSourceChromium(channel_id_service)); 493 new ChannelIDSourceChromium(channel_id_service));
492 base::CPU cpu; 494 base::CPU cpu;
493 if (cpu.has_aesni() && cpu.has_avx()) 495 if (cpu.has_aesni() && cpu.has_avx())
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 const HttpServerProperties::NetworkStats* stats = 856 const HttpServerProperties::NetworkStats* stats =
855 http_server_properties_->GetServerNetworkStats( 857 http_server_properties_->GetServerNetworkStats(
856 server_id.host_port_pair()); 858 server_id.host_port_pair());
857 if (stats != NULL) { 859 if (stats != NULL) {
858 config.SetInitialRoundTripTimeUsToSend(stats->srtt.InMicroseconds()); 860 config.SetInitialRoundTripTimeUsToSend(stats->srtt.InMicroseconds());
859 } 861 }
860 } 862 }
861 863
862 *session = new QuicClientSession( 864 *session = new QuicClientSession(
863 connection, socket.Pass(), writer.Pass(), this, 865 connection, socket.Pass(), writer.Pass(), this,
864 quic_crypto_client_stream_factory_, server_info.Pass(), server_id, 866 quic_crypto_client_stream_factory_, transport_security_state_,
865 config, &crypto_config_, 867 server_info.Pass(), server_id, config, &crypto_config_,
866 base::MessageLoop::current()->message_loop_proxy().get(), 868 base::MessageLoop::current()->message_loop_proxy().get(),
867 net_log.net_log()); 869 net_log.net_log());
868 (*session)->InitializeSession(); 870 (*session)->InitializeSession();
869 all_sessions_[*session] = server_id; // owning pointer 871 all_sessions_[*session] = server_id; // owning pointer
870 return OK; 872 return OK;
871 } 873 }
872 874
873 bool QuicStreamFactory::HasActiveJob(const QuicServerId& key) const { 875 bool QuicStreamFactory::HasActiveJob(const QuicServerId& key) const {
874 return ContainsKey(active_jobs_, key); 876 return ContainsKey(active_jobs_, key);
875 } 877 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 http_server_properties_->ClearAlternateProtocol(server); 962 http_server_properties_->ClearAlternateProtocol(server);
961 http_server_properties_->SetAlternateProtocol( 963 http_server_properties_->SetAlternateProtocol(
962 server, alternate.port, alternate.protocol, 1); 964 server, alternate.port, alternate.protocol, 1);
963 DCHECK_EQ(QUIC, 965 DCHECK_EQ(QUIC,
964 http_server_properties_->GetAlternateProtocol(server).protocol); 966 http_server_properties_->GetAlternateProtocol(server).protocol);
965 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( 967 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken(
966 server)); 968 server));
967 } 969 }
968 970
969 } // namespace net 971 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_stream_factory.h ('k') | net/quic/quic_stream_factory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698