| 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 <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 // If |factory_| was not initialized, then |clock_| needs to be destroyed. | 305 // If |factory_| was not initialized, then |clock_| needs to be destroyed. |
| 306 if (!factory_) { | 306 if (!factory_) { |
| 307 delete clock_; | 307 delete clock_; |
| 308 } | 308 } |
| 309 } | 309 } |
| 310 | 310 |
| 311 void Initialize() { | 311 void Initialize() { |
| 312 DCHECK(!factory_); | 312 DCHECK(!factory_); |
| 313 factory_.reset(new QuicStreamFactory( | 313 factory_.reset(new QuicStreamFactory( |
| 314 net_log_.net_log(), &host_resolver_, &socket_factory_, | 314 net_log_.net_log(), &host_resolver_, &socket_factory_, |
| 315 http_server_properties_.GetWeakPtr(), cert_verifier_.get(), nullptr, | 315 &http_server_properties_, cert_verifier_.get(), nullptr, |
| 316 channel_id_service_.get(), &transport_security_state_, | 316 channel_id_service_.get(), &transport_security_state_, |
| 317 cert_transparency_verifier_.get(), | 317 cert_transparency_verifier_.get(), |
| 318 /*SocketPerformanceWatcherFactory*/ nullptr, | 318 /*SocketPerformanceWatcherFactory*/ nullptr, |
| 319 &crypto_client_stream_factory_, &random_generator_, clock_, | 319 &crypto_client_stream_factory_, &random_generator_, clock_, |
| 320 kDefaultMaxPacketSize, string(), SupportedVersions(version_), | 320 kDefaultMaxPacketSize, string(), SupportedVersions(version_), |
| 321 enable_port_selection_, always_require_handshake_confirmation_, | 321 enable_port_selection_, always_require_handshake_confirmation_, |
| 322 disable_connection_pooling_, load_server_info_timeout_srtt_multiplier_, | 322 disable_connection_pooling_, load_server_info_timeout_srtt_multiplier_, |
| 323 enable_connection_racing_, enable_non_blocking_io_, disable_disk_cache_, | 323 enable_connection_racing_, enable_non_blocking_io_, disable_disk_cache_, |
| 324 prefer_aes_, max_number_of_lossy_connections_, packet_loss_threshold_, | 324 prefer_aes_, max_number_of_lossy_connections_, packet_loss_threshold_, |
| 325 max_disabled_reasons_, threshold_timeouts_with_open_streams_, | 325 max_disabled_reasons_, threshold_timeouts_with_open_streams_, |
| (...skipping 3402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3728 AlternativeServiceInfo(alternative_service2, expiration)); | 3728 AlternativeServiceInfo(alternative_service2, expiration)); |
| 3729 http_server_properties_.SetAlternativeServices( | 3729 http_server_properties_.SetAlternativeServices( |
| 3730 server2, alternative_service_info_vector2); | 3730 server2, alternative_service_info_vector2); |
| 3731 | 3731 |
| 3732 http_server_properties_.SetMaxServerConfigsStoredInProperties( | 3732 http_server_properties_.SetMaxServerConfigsStoredInProperties( |
| 3733 kMaxQuicServersToPersist); | 3733 kMaxQuicServersToPersist); |
| 3734 | 3734 |
| 3735 QuicServerId quic_server_id(kDefaultServerHostName, 80, | 3735 QuicServerId quic_server_id(kDefaultServerHostName, 80, |
| 3736 PRIVACY_MODE_DISABLED); | 3736 PRIVACY_MODE_DISABLED); |
| 3737 QuicServerInfoFactory* quic_server_info_factory = | 3737 QuicServerInfoFactory* quic_server_info_factory = |
| 3738 new PropertiesBasedQuicServerInfoFactory( | 3738 new PropertiesBasedQuicServerInfoFactory(&http_server_properties_); |
| 3739 http_server_properties_.GetWeakPtr()); | |
| 3740 factory_->set_quic_server_info_factory(quic_server_info_factory); | 3739 factory_->set_quic_server_info_factory(quic_server_info_factory); |
| 3741 | 3740 |
| 3742 std::unique_ptr<QuicServerInfo> quic_server_info( | 3741 std::unique_ptr<QuicServerInfo> quic_server_info( |
| 3743 quic_server_info_factory->GetForServer(quic_server_id)); | 3742 quic_server_info_factory->GetForServer(quic_server_id)); |
| 3744 | 3743 |
| 3745 // Update quic_server_info's server_config and persist it. | 3744 // Update quic_server_info's server_config and persist it. |
| 3746 QuicServerInfo::State* state = quic_server_info->mutable_state(); | 3745 QuicServerInfo::State* state = quic_server_info->mutable_state(); |
| 3747 // Minimum SCFG that passes config validation checks. | 3746 // Minimum SCFG that passes config validation checks. |
| 3748 const char scfg[] = {// SCFG | 3747 const char scfg[] = {// SCFG |
| 3749 0x53, 0x43, 0x46, 0x47, | 3748 0x53, 0x43, 0x46, 0x47, |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4336 EXPECT_NE(session1, session2); | 4335 EXPECT_NE(session1, session2); |
| 4337 | 4336 |
| 4338 EXPECT_EQ(QuicServerId(origin1_, privacy_mode_), session1->server_id()); | 4337 EXPECT_EQ(QuicServerId(origin1_, privacy_mode_), session1->server_id()); |
| 4339 EXPECT_EQ(QuicServerId(origin2_, privacy_mode_), session2->server_id()); | 4338 EXPECT_EQ(QuicServerId(origin2_, privacy_mode_), session2->server_id()); |
| 4340 | 4339 |
| 4341 EXPECT_TRUE(AllDataConsumed()); | 4340 EXPECT_TRUE(AllDataConsumed()); |
| 4342 } | 4341 } |
| 4343 | 4342 |
| 4344 } // namespace test | 4343 } // namespace test |
| 4345 } // namespace net | 4344 } // namespace net |
| OLD | NEW |