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

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

Issue 1878273004: SHP 3: Change ServerNetworkStatsMap to use SchemeHostPort as the key. No change to Pref data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git sync Created 4 years, 8 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
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 <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 UMA_HISTOGRAM_COUNTS("Net.QuicActiveSessions", active_sessions_.size()); 1629 UMA_HISTOGRAM_COUNTS("Net.QuicActiveSessions", active_sessions_.size());
1630 active_sessions_[server_id] = session; 1630 active_sessions_[server_id] = session;
1631 session_aliases_[session].insert(server_id); 1631 session_aliases_[session].insert(server_id);
1632 const IPEndPoint peer_address = session->connection()->peer_address(); 1632 const IPEndPoint peer_address = session->connection()->peer_address();
1633 DCHECK(!ContainsKey(ip_aliases_[peer_address], session)); 1633 DCHECK(!ContainsKey(ip_aliases_[peer_address], session));
1634 ip_aliases_[peer_address].insert(session); 1634 ip_aliases_[peer_address].insert(session);
1635 } 1635 }
1636 1636
1637 int64_t QuicStreamFactory::GetServerNetworkStatsSmoothedRttInMicroseconds( 1637 int64_t QuicStreamFactory::GetServerNetworkStatsSmoothedRttInMicroseconds(
1638 const QuicServerId& server_id) const { 1638 const QuicServerId& server_id) const {
1639 url::SchemeHostPort server("https", server_id.host_port_pair().host(),
1640 server_id.host_port_pair().port());
1639 const ServerNetworkStats* stats = 1641 const ServerNetworkStats* stats =
1640 http_server_properties_->GetServerNetworkStats( 1642 http_server_properties_->GetServerNetworkStats(server);
1641 server_id.host_port_pair());
1642 if (stats == nullptr) 1643 if (stats == nullptr)
1643 return 0; 1644 return 0;
1644 return stats->srtt.InMicroseconds(); 1645 return stats->srtt.InMicroseconds();
1645 } 1646 }
1646 1647
1647 bool QuicStreamFactory::WasQuicRecentlyBroken( 1648 bool QuicStreamFactory::WasQuicRecentlyBroken(
1648 const QuicServerId& server_id) const { 1649 const QuicServerId& server_id) const {
1649 const AlternativeService alternative_service(QUIC, 1650 const AlternativeService alternative_service(QUIC,
1650 server_id.host_port_pair()); 1651 server_id.host_port_pair());
1651 return http_server_properties_->WasAlternativeServiceRecentlyBroken( 1652 return http_server_properties_->WasAlternativeServiceRecentlyBroken(
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 return; 1744 return;
1744 1745
1745 const QuicConnectionStats& stats = session->connection()->GetStats(); 1746 const QuicConnectionStats& stats = session->connection()->GetStats();
1746 const AlternativeService alternative_service(QUIC, 1747 const AlternativeService alternative_service(QUIC,
1747 server_id.host_port_pair()); 1748 server_id.host_port_pair());
1748 if (session->IsCryptoHandshakeConfirmed()) { 1749 if (session->IsCryptoHandshakeConfirmed()) {
1749 http_server_properties_->ConfirmAlternativeService(alternative_service); 1750 http_server_properties_->ConfirmAlternativeService(alternative_service);
1750 ServerNetworkStats network_stats; 1751 ServerNetworkStats network_stats;
1751 network_stats.srtt = base::TimeDelta::FromMicroseconds(stats.srtt_us); 1752 network_stats.srtt = base::TimeDelta::FromMicroseconds(stats.srtt_us);
1752 network_stats.bandwidth_estimate = stats.estimated_bandwidth; 1753 network_stats.bandwidth_estimate = stats.estimated_bandwidth;
1753 http_server_properties_->SetServerNetworkStats(server_id.host_port_pair(), 1754 url::SchemeHostPort server("https", server_id.host_port_pair().host(),
1754 network_stats); 1755 server_id.host_port_pair().port());
1756 http_server_properties_->SetServerNetworkStats(server, network_stats);
1755 return; 1757 return;
1756 } 1758 }
1757 1759
1758 UMA_HISTOGRAM_COUNTS("Net.QuicHandshakeNotConfirmedNumPacketsReceived", 1760 UMA_HISTOGRAM_COUNTS("Net.QuicHandshakeNotConfirmedNumPacketsReceived",
1759 stats.packets_received); 1761 stats.packets_received);
1760 1762
1761 if (!session_was_active) 1763 if (!session_was_active)
1762 return; 1764 return;
1763 1765
1764 // TODO(rch): In the special case where the session has received no 1766 // TODO(rch): In the special case where the session has received no
1765 // packets from the peer, we should consider blacklisting this 1767 // packets from the peer, we should consider blacklisting this
1766 // differently so that we still race TCP but we don't consider the 1768 // differently so that we still race TCP but we don't consider the
1767 // session connected until the handshake has been confirmed. 1769 // session connected until the handshake has been confirmed.
1768 HistogramBrokenAlternateProtocolLocation( 1770 HistogramBrokenAlternateProtocolLocation(
1769 BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY); 1771 BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY);
1770 1772
1771 // Since the session was active, there's no longer an 1773 // Since the session was active, there's no longer an
1772 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP 1774 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP
1773 // job also fails. So to avoid not using QUIC when we otherwise could, we mark 1775 // job also fails. So to avoid not using QUIC when we otherwise could, we mark
1774 // it as recently broken, which means that 0-RTT will be disabled but we'll 1776 // it as recently broken, which means that 0-RTT will be disabled but we'll
1775 // still race. 1777 // still race.
1776 http_server_properties_->MarkAlternativeServiceRecentlyBroken( 1778 http_server_properties_->MarkAlternativeServiceRecentlyBroken(
1777 alternative_service); 1779 alternative_service);
1778 } 1780 }
1779 1781
1780 } // namespace net 1782 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_server_properties_manager_unittest.cc ('k') | net/quic/quic_stream_factory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698