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/http/http_server_properties.h" | 5 #include "net/http/http_server_properties.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 "quic" | 24 "quic" |
25 }; | 25 }; |
26 const char kBrokenAlternateProtocol[] = "Broken"; | 26 const char kBrokenAlternateProtocol[] = "Broken"; |
27 | 27 |
28 COMPILE_ASSERT( | 28 COMPILE_ASSERT( |
29 arraysize(kAlternateProtocolStrings) == NUM_VALID_ALTERNATE_PROTOCOLS, | 29 arraysize(kAlternateProtocolStrings) == NUM_VALID_ALTERNATE_PROTOCOLS, |
30 kAlternateProtocolStringsSize_kNumValidAlternateProtocols_not_equal); | 30 kAlternateProtocolStringsSize_kNumValidAlternateProtocols_not_equal); |
31 | 31 |
32 } // namespace | 32 } // namespace |
33 | 33 |
34 void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage) { | 34 void HistogramAlternateProtocolUsage( |
| 35 AlternateProtocolUsage usage, |
| 36 AlternateProtocolExperiment alternate_protocol_experiment) { |
35 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage", usage, | 37 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage", usage, |
36 ALTERNATE_PROTOCOL_USAGE_MAX); | 38 ALTERNATE_PROTOCOL_USAGE_MAX); |
| 39 if (alternate_protocol_experiment == |
| 40 ALTERNATE_PROTOCOL_TRUNCATED_200_SERVERS) { |
| 41 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage.200Truncated", usage, |
| 42 ALTERNATE_PROTOCOL_USAGE_MAX); |
| 43 } else if (alternate_protocol_experiment == |
| 44 ALTERNATE_PROTOCOL_TRUNCATED_1000_SERVERS) { |
| 45 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage.1000Truncated", usage, |
| 46 ALTERNATE_PROTOCOL_USAGE_MAX); |
| 47 } |
37 } | 48 } |
38 | 49 |
39 void HistogramBrokenAlternateProtocolLocation( | 50 void HistogramBrokenAlternateProtocolLocation( |
40 BrokenAlternateProtocolLocation location){ | 51 BrokenAlternateProtocolLocation location){ |
41 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolBrokenLocation", location, | 52 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolBrokenLocation", location, |
42 BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX); | 53 BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX); |
43 } | 54 } |
44 | 55 |
45 bool IsAlternateProtocolValid(AlternateProtocol protocol) { | 56 bool IsAlternateProtocolValid(AlternateProtocol protocol) { |
46 return protocol >= ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION && | 57 return protocol >= ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION && |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 NOTREACHED() << "Invalid NextProto: " << next_proto; | 110 NOTREACHED() << "Invalid NextProto: " << next_proto; |
100 return UNINITIALIZED_ALTERNATE_PROTOCOL; | 111 return UNINITIALIZED_ALTERNATE_PROTOCOL; |
101 } | 112 } |
102 | 113 |
103 std::string PortAlternateProtocolPair::ToString() const { | 114 std::string PortAlternateProtocolPair::ToString() const { |
104 return base::StringPrintf("%d:%s", port, | 115 return base::StringPrintf("%d:%s", port, |
105 AlternateProtocolToString(protocol)); | 116 AlternateProtocolToString(protocol)); |
106 } | 117 } |
107 | 118 |
108 } // namespace net | 119 } // namespace net |
OLD | NEW |