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

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

Issue 2373663002: Unify enum NextProto and enum AlternateProtocol. (Closed)
Patch Set: Fix compile errors. Created 4 years, 1 month 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
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/chromium/quic_stream_factory.h" 5 #include "net/quic/chromium/quic_stream_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <tuple> 8 #include <tuple>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "net/quic/core/crypto/proof_verifier.h" 43 #include "net/quic/core/crypto/proof_verifier.h"
44 #include "net/quic/core/crypto/properties_based_quic_server_info.h" 44 #include "net/quic/core/crypto/properties_based_quic_server_info.h"
45 #include "net/quic/core/crypto/quic_random.h" 45 #include "net/quic/core/crypto/quic_random.h"
46 #include "net/quic/core/crypto/quic_server_info.h" 46 #include "net/quic/core/crypto/quic_server_info.h"
47 #include "net/quic/core/quic_client_promised_info.h" 47 #include "net/quic/core/quic_client_promised_info.h"
48 #include "net/quic/core/quic_clock.h" 48 #include "net/quic/core/quic_clock.h"
49 #include "net/quic/core/quic_connection.h" 49 #include "net/quic/core/quic_connection.h"
50 #include "net/quic/core/quic_crypto_client_stream_factory.h" 50 #include "net/quic/core/quic_crypto_client_stream_factory.h"
51 #include "net/quic/core/quic_flags.h" 51 #include "net/quic/core/quic_flags.h"
52 #include "net/socket/client_socket_factory.h" 52 #include "net/socket/client_socket_factory.h"
53 #include "net/socket/next_proto.h"
53 #include "net/socket/socket_performance_watcher.h" 54 #include "net/socket/socket_performance_watcher.h"
54 #include "net/socket/socket_performance_watcher_factory.h" 55 #include "net/socket/socket_performance_watcher_factory.h"
55 #include "net/ssl/token_binding.h" 56 #include "net/ssl/token_binding.h"
56 #include "net/udp/udp_client_socket.h" 57 #include "net/udp/udp_client_socket.h"
57 #include "third_party/boringssl/src/include/openssl/aead.h" 58 #include "third_party/boringssl/src/include/openssl/aead.h"
58 #include "url/gurl.h" 59 #include "url/gurl.h"
59 #include "url/url_constants.h" 60 #include "url/url_constants.h"
60 61
61 using std::min; 62 using std::min;
62 using NetworkHandle = net::NetworkChangeNotifier::NetworkHandle; 63 using NetworkHandle = net::NetworkChangeNotifier::NetworkHandle;
(...skipping 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 server_id.host_port_pair().port()); 1734 server_id.host_port_pair().port());
1734 const ServerNetworkStats* stats = 1735 const ServerNetworkStats* stats =
1735 http_server_properties_->GetServerNetworkStats(server); 1736 http_server_properties_->GetServerNetworkStats(server);
1736 if (stats == nullptr) 1737 if (stats == nullptr)
1737 return 0; 1738 return 0;
1738 return stats->srtt.InMicroseconds(); 1739 return stats->srtt.InMicroseconds();
1739 } 1740 }
1740 1741
1741 bool QuicStreamFactory::WasQuicRecentlyBroken( 1742 bool QuicStreamFactory::WasQuicRecentlyBroken(
1742 const QuicServerId& server_id) const { 1743 const QuicServerId& server_id) const {
1743 const AlternativeService alternative_service(QUIC, 1744 const AlternativeService alternative_service(kProtoQUIC,
1744 server_id.host_port_pair()); 1745 server_id.host_port_pair());
1745 return http_server_properties_->WasAlternativeServiceRecentlyBroken( 1746 return http_server_properties_->WasAlternativeServiceRecentlyBroken(
1746 alternative_service); 1747 alternative_service);
1747 } 1748 }
1748 1749
1749 bool QuicStreamFactory::CryptoConfigCacheIsEmpty( 1750 bool QuicStreamFactory::CryptoConfigCacheIsEmpty(
1750 const QuicServerId& server_id) { 1751 const QuicServerId& server_id) {
1751 QuicCryptoClientConfig::CachedState* cached = 1752 QuicCryptoClientConfig::CachedState* cached =
1752 crypto_config_.LookupOrCreate(server_id); 1753 crypto_config_.LookupOrCreate(server_id);
1753 return cached->IsEmpty(); 1754 return cached->IsEmpty();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 if (default_alternative_proxy_server.is_quic()) { 1828 if (default_alternative_proxy_server.is_quic()) {
1828 quic_supported_servers_at_startup_.insert( 1829 quic_supported_servers_at_startup_.insert(
1829 default_alternative_proxy_server.host_port_pair()); 1830 default_alternative_proxy_server.host_port_pair());
1830 } 1831 }
1831 1832
1832 for (const std::pair<const url::SchemeHostPort, AlternativeServiceInfoVector>& 1833 for (const std::pair<const url::SchemeHostPort, AlternativeServiceInfoVector>&
1833 key_value : http_server_properties_->alternative_service_map()) { 1834 key_value : http_server_properties_->alternative_service_map()) {
1834 HostPortPair host_port_pair(key_value.first.host(), key_value.first.port()); 1835 HostPortPair host_port_pair(key_value.first.host(), key_value.first.port());
1835 for (const AlternativeServiceInfo& alternative_service_info : 1836 for (const AlternativeServiceInfo& alternative_service_info :
1836 key_value.second) { 1837 key_value.second) {
1837 if (alternative_service_info.alternative_service.protocol == QUIC) { 1838 if (alternative_service_info.alternative_service.protocol == kProtoQUIC) {
1838 quic_supported_servers_at_startup_.insert(host_port_pair); 1839 quic_supported_servers_at_startup_.insert(host_port_pair);
1839 break; 1840 break;
1840 } 1841 }
1841 } 1842 }
1842 } 1843 }
1843 1844
1844 if (http_server_properties_->max_server_configs_stored_in_properties() == 0) 1845 if (http_server_properties_->max_server_configs_stored_in_properties() == 0)
1845 return; 1846 return;
1846 // Create a temporary QuicServerInfo object to deserialize and to populate the 1847 // Create a temporary QuicServerInfo object to deserialize and to populate the
1847 // in-memory crypto server config cache in the MRU order. 1848 // in-memory crypto server config cache in the MRU order.
(...skipping 17 matching lines...) Expand all
1865 } 1866 }
1866 1867
1867 void QuicStreamFactory::ProcessGoingAwaySession( 1868 void QuicStreamFactory::ProcessGoingAwaySession(
1868 QuicChromiumClientSession* session, 1869 QuicChromiumClientSession* session,
1869 const QuicServerId& server_id, 1870 const QuicServerId& server_id,
1870 bool session_was_active) { 1871 bool session_was_active) {
1871 if (!http_server_properties_) 1872 if (!http_server_properties_)
1872 return; 1873 return;
1873 1874
1874 const QuicConnectionStats& stats = session->connection()->GetStats(); 1875 const QuicConnectionStats& stats = session->connection()->GetStats();
1875 const AlternativeService alternative_service(QUIC, 1876 const AlternativeService alternative_service(kProtoQUIC,
1876 server_id.host_port_pair()); 1877 server_id.host_port_pair());
1877 if (session->IsCryptoHandshakeConfirmed()) { 1878 if (session->IsCryptoHandshakeConfirmed()) {
1878 http_server_properties_->ConfirmAlternativeService(alternative_service); 1879 http_server_properties_->ConfirmAlternativeService(alternative_service);
1879 ServerNetworkStats network_stats; 1880 ServerNetworkStats network_stats;
1880 network_stats.srtt = base::TimeDelta::FromMicroseconds(stats.srtt_us); 1881 network_stats.srtt = base::TimeDelta::FromMicroseconds(stats.srtt_us);
1881 network_stats.bandwidth_estimate = stats.estimated_bandwidth; 1882 network_stats.bandwidth_estimate = stats.estimated_bandwidth;
1882 url::SchemeHostPort server("https", server_id.host_port_pair().host(), 1883 url::SchemeHostPort server("https", server_id.host_port_pair().host(),
1883 server_id.host_port_pair().port()); 1884 server_id.host_port_pair().port());
1884 http_server_properties_->SetServerNetworkStats(server, network_stats); 1885 http_server_properties_->SetServerNetworkStats(server, network_stats);
1885 return; 1886 return;
(...skipping 24 matching lines...) Expand all
1910 void QuicStreamFactory::OpenFactory() { 1911 void QuicStreamFactory::OpenFactory() {
1911 status_ = OPEN; 1912 status_ = OPEN;
1912 } 1913 }
1913 1914
1914 void QuicStreamFactory::MaybeClearConsecutiveDisabledCount() { 1915 void QuicStreamFactory::MaybeClearConsecutiveDisabledCount() {
1915 if (status_ == OPEN) 1916 if (status_ == OPEN)
1916 consecutive_disabled_count_ = 0; 1917 consecutive_disabled_count_ = 0;
1917 } 1918 }
1918 1919
1919 } // namespace net 1920 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/chromium/quic_network_transaction_unittest.cc ('k') | net/quic/chromium/quic_stream_factory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698