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

Unified Diff: net/quic/quic_connection_logger.cc

Issue 944883003: QUIC - Cache the connection type and connection description. Make the (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move description caching into a distinct class Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: net/quic/quic_connection_logger.cc
diff --git a/net/quic/quic_connection_logger.cc b/net/quic/quic_connection_logger.cc
index 747ddd639d239ce49d1653d51eb777630c58b872..966f33002a51d2d247368c6d753ed7e2cecb51f6 100644
--- a/net/quic/quic_connection_logger.cc
+++ b/net/quic/quic_connection_logger.cc
@@ -267,62 +267,6 @@ void UpdatePublicResetAddressMismatchHistogram(
sample, QUIC_ADDRESS_MISMATCH_MAX);
}
-const char* GetConnectionDescriptionString() {
- // TODO(rtenneti): Remove ScopedTracker below once crbug.com/422516 is fixed.
- tracked_objects::ScopedTracker tracking_profile(
- FROM_HERE_WITH_EXPLICIT_FUNCTION(
- "422516 QuicConnectionLogger GetConnectionDescriptionString"));
-
- NetworkChangeNotifier::ConnectionType type =
- NetworkChangeNotifier::GetConnectionType();
- const char* description = NetworkChangeNotifier::ConnectionTypeToString(type);
- // Most platforms don't distingish Wifi vs Etherenet, and call everything
- // CONNECTION_UNKNOWN :-(. We'll tease out some details when we are on WiFi,
- // and hopefully leave only ethernet (with no WiFi available) in the
- // CONNECTION_UNKNOWN category. This *might* err if there is both ethernet,
- // as well as WiFi, where WiFi was not being used that much.
- // This function only seems usefully defined on Windows currently.
- if (type == NetworkChangeNotifier::CONNECTION_UNKNOWN ||
- type == NetworkChangeNotifier::CONNECTION_WIFI) {
- // TODO(rtenneti): Remove ScopedTracker below once crbug.com/422516 is
- // fixed.
- tracked_objects::ScopedTracker tracking_profile1(
- FROM_HERE_WITH_EXPLICIT_FUNCTION(
- "422516 QuicConnectionLogger GetConnectionDescriptionString1"));
-
- WifiPHYLayerProtocol wifi_type = GetWifiPHYLayerProtocol();
- switch (wifi_type) {
- case WIFI_PHY_LAYER_PROTOCOL_NONE:
- // No wifi support or no associated AP.
- break;
- case WIFI_PHY_LAYER_PROTOCOL_ANCIENT:
- // An obsolete modes introduced by the original 802.11, e.g. IR, FHSS.
- description = "CONNECTION_WIFI_ANCIENT";
- break;
- case WIFI_PHY_LAYER_PROTOCOL_A:
- // 802.11a, OFDM-based rates.
- description = "CONNECTION_WIFI_802.11a";
- break;
- case WIFI_PHY_LAYER_PROTOCOL_B:
- // 802.11b, DSSS or HR DSSS.
- description = "CONNECTION_WIFI_802.11b";
- break;
- case WIFI_PHY_LAYER_PROTOCOL_G:
- // 802.11g, same rates as 802.11a but compatible with 802.11b.
- description = "CONNECTION_WIFI_802.11g";
- break;
- case WIFI_PHY_LAYER_PROTOCOL_N:
- // 802.11n, HT rates.
- description = "CONNECTION_WIFI_802.11n";
- break;
- case WIFI_PHY_LAYER_PROTOCOL_UNKNOWN:
- // Unclassified mode or failure to identify.
- break;
- }
- }
- return description;
-}
-
// If |address| is an IPv4-mapped IPv6 address, returns ADDRESS_FAMILY_IPV4
// instead of ADDRESS_FAMILY_IPV6. Othewise, behaves like GetAddressFamily().
AddressFamily GetRealAddressFamily(const IPAddressNumber& address) {
@@ -332,8 +276,10 @@ AddressFamily GetRealAddressFamily(const IPAddressNumber& address) {
} // namespace
-QuicConnectionLogger::QuicConnectionLogger(QuicSession* session,
- const BoundNetLog& net_log)
+QuicConnectionLogger::QuicConnectionLogger(
+ QuicSession* session,
+ NetworkConnection* network_connection,
+ const BoundNetLog& net_log)
: net_log_(net_log),
session_(session),
last_received_packet_sequence_number_(0),
@@ -353,7 +299,7 @@ QuicConnectionLogger::QuicConnectionLogger(QuicSession* session,
num_duplicate_packets_(0),
num_blocked_frames_received_(0),
num_blocked_frames_sent_(0),
- connection_description_(GetConnectionDescriptionString()) {
+ connection_description_(network_connection->GetDescription()) {
Ryan Hamilton 2015/02/23 18:43:00 nit: if you don't need the actual NetworkConnectio
ramant (doing other things) 2015/02/23 19:50:18 +1 and thanks for the suggestion. Done.
}
QuicConnectionLogger::~QuicConnectionLogger() {

Powered by Google App Engine
This is Rietveld 408576698