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/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_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "net/socket/ssl_client_socket.h" | 10 #include "net/socket/ssl_client_socket.h" |
| 11 #include "net/ssl/ssl_config.h" | 11 #include "net/ssl/ssl_config.h" |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 | 14 |
| 15 const char kAlternativeServiceHeader[] = "Alt-Svc"; | 15 const char kAlternativeServiceHeader[] = "Alt-Svc"; |
| 16 | 16 |
| 17 void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage) { | 17 AlternativeProxyUsage ConvertProtocolUsageToProxyUsage( |
| 18 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage", usage, | 18 AlternateProtocolUsage usage) { |
| 19 ALTERNATE_PROTOCOL_USAGE_MAX); | 19 switch (usage) { |
| 20 case ALTERNATE_PROTOCOL_USAGE_NO_RACE: | |
| 21 return ALTERNATIVE_PROXY_USAGE_NO_RACE; | |
| 22 case ALTERNATE_PROTOCOL_USAGE_WON_RACE: | |
| 23 return ALTERNATIVE_PROXY_USAGE_WON_RACE; | |
| 24 case ALTERNATE_PROTOCOL_USAGE_LOST_RACE: | |
| 25 return ALTERNATIVE_PROXY_USAGE_LOST_RACE; | |
| 26 default: | |
|
tbansal1
2016/09/22 17:53:02
Add NOTREACHED() in default: so an error is trigge
Zhongyi Shi
2016/09/22 23:56:53
Done.
| |
| 27 return ALTERNATIVE_PROXY_USAGE_MAX; | |
| 28 } | |
| 29 } | |
| 30 | |
| 31 void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage, | |
| 32 bool proxy_server_used) { | |
| 33 if (proxy_server_used) { | |
| 34 DCHECK_LE(usage, ALTERNATE_PROTOCOL_USAGE_LOST_RACE); | |
| 35 UMA_HISTOGRAM_ENUMERATION("Net.QuicAlternativeProxy.Usage", | |
| 36 ConvertProtocolUsageToProxyUsage(usage), | |
| 37 ALTERNATIVE_PROXY_USAGE_MAX); | |
| 38 } else { | |
| 39 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage", usage, | |
| 40 ALTERNATE_PROTOCOL_USAGE_MAX); | |
| 41 } | |
| 20 } | 42 } |
| 21 | 43 |
| 22 void HistogramBrokenAlternateProtocolLocation( | 44 void HistogramBrokenAlternateProtocolLocation( |
| 23 BrokenAlternateProtocolLocation location){ | 45 BrokenAlternateProtocolLocation location){ |
| 24 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolBrokenLocation", location, | 46 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolBrokenLocation", location, |
| 25 BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX); | 47 BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX); |
| 26 } | 48 } |
| 27 | 49 |
| 28 bool IsAlternateProtocolValid(AlternateProtocol protocol) { | 50 bool IsAlternateProtocolValid(AlternateProtocol protocol) { |
| 29 return protocol >= ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION && | 51 return protocol >= ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION && |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 exploded.day_of_month, exploded.hour, exploded.minute, exploded.second); | 112 exploded.day_of_month, exploded.hour, exploded.minute, exploded.second); |
| 91 } | 113 } |
| 92 | 114 |
| 93 // static | 115 // static |
| 94 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) { | 116 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) { |
| 95 ssl_config->alpn_protos.clear(); | 117 ssl_config->alpn_protos.clear(); |
| 96 ssl_config->alpn_protos.push_back(kProtoHTTP11); | 118 ssl_config->alpn_protos.push_back(kProtoHTTP11); |
| 97 } | 119 } |
| 98 | 120 |
| 99 } // namespace net | 121 } // namespace net |
| OLD | NEW |