Chromium Code Reviews| 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 <openssl/aead.h> | 7 #include <openssl/aead.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 589 std::unique_ptr<BidirectionalStreamImpl> | 589 std::unique_ptr<BidirectionalStreamImpl> |
| 590 QuicStreamRequest::CreateBidirectionalStreamImpl() { | 590 QuicStreamRequest::CreateBidirectionalStreamImpl() { |
| 591 if (!session_) | 591 if (!session_) |
| 592 return nullptr; | 592 return nullptr; |
| 593 return base::WrapUnique(new BidirectionalStreamQuicImpl(session_)); | 593 return base::WrapUnique(new BidirectionalStreamQuicImpl(session_)); |
| 594 } | 594 } |
| 595 | 595 |
| 596 QuicStreamFactory::QuicStreamFactory( | 596 QuicStreamFactory::QuicStreamFactory( |
| 597 NetLog* net_log, | 597 NetLog* net_log, |
| 598 HostResolver* host_resolver, | 598 HostResolver* host_resolver, |
| 599 SSLConfigService* ssl_config_service, | |
| 599 ClientSocketFactory* client_socket_factory, | 600 ClientSocketFactory* client_socket_factory, |
| 600 HttpServerProperties* http_server_properties, | 601 HttpServerProperties* http_server_properties, |
| 601 CertVerifier* cert_verifier, | 602 CertVerifier* cert_verifier, |
| 602 CTPolicyEnforcer* ct_policy_enforcer, | 603 CTPolicyEnforcer* ct_policy_enforcer, |
| 603 ChannelIDService* channel_id_service, | 604 ChannelIDService* channel_id_service, |
| 604 TransportSecurityState* transport_security_state, | 605 TransportSecurityState* transport_security_state, |
| 605 CTVerifier* cert_transparency_verifier, | 606 CTVerifier* cert_transparency_verifier, |
| 606 SocketPerformanceWatcherFactory* socket_performance_watcher_factory, | 607 SocketPerformanceWatcherFactory* socket_performance_watcher_factory, |
| 607 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, | 608 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, |
| 608 QuicRandom* random_generator, | 609 QuicRandom* random_generator, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 683 migrate_sessions_on_network_change && | 684 migrate_sessions_on_network_change && |
| 684 NetworkChangeNotifier::AreNetworkHandlesSupported()), | 685 NetworkChangeNotifier::AreNetworkHandlesSupported()), |
| 685 migrate_sessions_early_(migrate_sessions_early && | 686 migrate_sessions_early_(migrate_sessions_early && |
| 686 migrate_sessions_on_network_change_), | 687 migrate_sessions_on_network_change_), |
| 687 port_seed_(random_generator_->RandUint64()), | 688 port_seed_(random_generator_->RandUint64()), |
| 688 check_persisted_supports_quic_(true), | 689 check_persisted_supports_quic_(true), |
| 689 has_initialized_data_(false), | 690 has_initialized_data_(false), |
| 690 num_push_streams_created_(0), | 691 num_push_streams_created_(0), |
| 691 status_(OPEN), | 692 status_(OPEN), |
| 692 task_runner_(nullptr), | 693 task_runner_(nullptr), |
| 694 ssl_config_service_(ssl_config_service), | |
| 693 weak_factory_(this) { | 695 weak_factory_(this) { |
| 696 if (ssl_config_service_.get()) | |
| 697 ssl_config_service_->AddObserver(this); | |
| 694 if (disable_quic_on_timeout_with_open_streams) | 698 if (disable_quic_on_timeout_with_open_streams) |
| 695 threshold_timeouts_with_open_streams_ = 1; | 699 threshold_timeouts_with_open_streams_ = 1; |
| 696 DCHECK(transport_security_state_); | 700 DCHECK(transport_security_state_); |
| 697 DCHECK(http_server_properties_); | 701 DCHECK(http_server_properties_); |
| 698 crypto_config_.set_user_agent_id(user_agent_id); | 702 crypto_config_.set_user_agent_id(user_agent_id); |
| 699 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); | 703 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); |
| 700 crypto_config_.AddCanonicalSuffix(".ggpht.com"); | 704 crypto_config_.AddCanonicalSuffix(".ggpht.com"); |
| 701 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); | 705 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); |
| 702 crypto_config_.AddCanonicalSuffix(".googleusercontent.com"); | 706 crypto_config_.AddCanonicalSuffix(".googleusercontent.com"); |
| 703 // TODO(rtenneti): http://crbug.com/487355. Temporary fix for b/20760730 until | 707 // TODO(rtenneti): http://crbug.com/487355. Temporary fix for b/20760730 until |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 741 CloseAllSessions(ERR_ABORTED, QUIC_CONNECTION_CANCELLED); | 745 CloseAllSessions(ERR_ABORTED, QUIC_CONNECTION_CANCELLED); |
| 742 while (!all_sessions_.empty()) { | 746 while (!all_sessions_.empty()) { |
| 743 delete all_sessions_.begin()->first; | 747 delete all_sessions_.begin()->first; |
| 744 all_sessions_.erase(all_sessions_.begin()); | 748 all_sessions_.erase(all_sessions_.begin()); |
| 745 } | 749 } |
| 746 while (!active_jobs_.empty()) { | 750 while (!active_jobs_.empty()) { |
| 747 const QuicServerId server_id = active_jobs_.begin()->first; | 751 const QuicServerId server_id = active_jobs_.begin()->first; |
| 748 STLDeleteElements(&(active_jobs_[server_id])); | 752 STLDeleteElements(&(active_jobs_[server_id])); |
| 749 active_jobs_.erase(server_id); | 753 active_jobs_.erase(server_id); |
| 750 } | 754 } |
| 755 if (ssl_config_service_.get()) | |
| 756 ssl_config_service_->RemoveObserver(this); | |
|
Ryan Hamilton
2016/06/29 23:16:15
It'd sure be cool if we has some sort of ScopedObs
| |
| 751 if (migrate_sessions_on_network_change_) { | 757 if (migrate_sessions_on_network_change_) { |
| 752 NetworkChangeNotifier::RemoveNetworkObserver(this); | 758 NetworkChangeNotifier::RemoveNetworkObserver(this); |
| 753 } else if (close_sessions_on_ip_change_) { | 759 } else if (close_sessions_on_ip_change_) { |
| 754 NetworkChangeNotifier::RemoveIPAddressObserver(this); | 760 NetworkChangeNotifier::RemoveIPAddressObserver(this); |
| 755 } | 761 } |
| 756 } | 762 } |
| 757 | 763 |
| 758 void QuicStreamFactory::set_require_confirmation(bool require_confirmation) { | 764 void QuicStreamFactory::set_require_confirmation(bool require_confirmation) { |
| 759 require_confirmation_ = require_confirmation; | 765 require_confirmation_ = require_confirmation; |
| 760 if (!(local_address_ == IPEndPoint())) { | 766 if (!(local_address_ == IPEndPoint())) { |
| (...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1863 // Since the session was active, there's no longer an | 1869 // Since the session was active, there's no longer an |
| 1864 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1870 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 1865 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1871 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 1866 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1872 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 1867 // still race. | 1873 // still race. |
| 1868 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1874 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 1869 alternative_service); | 1875 alternative_service); |
| 1870 } | 1876 } |
| 1871 | 1877 |
| 1872 } // namespace net | 1878 } // namespace net |
| OLD | NEW |