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

Side by Side Diff: net/http/http_server_properties.cc

Issue 2359803003: Job Controller: clean up metrics logging about the job racing result (Closed)
Patch Set: sync Created 4 years, 2 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
« no previous file with comments | « net/http/http_server_properties.h ('k') | net/http/http_server_properties_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 namespace {
16
17 enum AlternativeProxyUsage {
18 // Alternative Proxy was used without racing a normal connection.
19 ALTERNATIVE_PROXY_USAGE_NO_RACE = 0,
20 // Alternative Proxy was used by winning a race with a normal connection.
21 ALTERNATIVE_PROXY_USAGE_WON_RACE = 1,
22 // Alternative Proxy was not used by losing a race with a normal connection.
23 ALTERNATIVE_PROXY_USAGE_LOST_RACE = 2,
24 // Maximum value for the enum.
25 ALTERNATIVE_PROXY_USAGE_MAX,
26 };
27
28 AlternativeProxyUsage ConvertProtocolUsageToProxyUsage(
29 AlternateProtocolUsage usage) {
30 switch (usage) {
31 case ALTERNATE_PROTOCOL_USAGE_NO_RACE:
32 return ALTERNATIVE_PROXY_USAGE_NO_RACE;
33 case ALTERNATE_PROTOCOL_USAGE_WON_RACE:
34 return ALTERNATIVE_PROXY_USAGE_WON_RACE;
35 case ALTERNATE_PROTOCOL_USAGE_LOST_RACE:
36 return ALTERNATIVE_PROXY_USAGE_LOST_RACE;
37 default:
38 NOTREACHED();
39 return ALTERNATIVE_PROXY_USAGE_MAX;
40 }
41 }
42
43 } // namespace anonymous
44
15 const char kAlternativeServiceHeader[] = "Alt-Svc"; 45 const char kAlternativeServiceHeader[] = "Alt-Svc";
16 46
17 void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage) { 47 void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage,
18 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage", usage, 48 bool proxy_server_used) {
19 ALTERNATE_PROTOCOL_USAGE_MAX); 49 if (proxy_server_used) {
50 DCHECK_LE(usage, ALTERNATE_PROTOCOL_USAGE_LOST_RACE);
51 UMA_HISTOGRAM_ENUMERATION("Net.QuicAlternativeProxy.Usage",
52 ConvertProtocolUsageToProxyUsage(usage),
53 ALTERNATIVE_PROXY_USAGE_MAX);
54 } else {
55 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage", usage,
56 ALTERNATE_PROTOCOL_USAGE_MAX);
57 }
20 } 58 }
21 59
22 void HistogramBrokenAlternateProtocolLocation( 60 void HistogramBrokenAlternateProtocolLocation(
23 BrokenAlternateProtocolLocation location){ 61 BrokenAlternateProtocolLocation location){
24 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolBrokenLocation", location, 62 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolBrokenLocation", location,
25 BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX); 63 BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX);
26 } 64 }
27 65
28 bool IsAlternateProtocolValid(AlternateProtocol protocol) { 66 bool IsAlternateProtocolValid(AlternateProtocol protocol) {
29 switch (protocol) { 67 switch (protocol) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 exploded.day_of_month, exploded.hour, exploded.minute, exploded.second); 135 exploded.day_of_month, exploded.hour, exploded.minute, exploded.second);
98 } 136 }
99 137
100 // static 138 // static
101 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) { 139 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) {
102 ssl_config->alpn_protos.clear(); 140 ssl_config->alpn_protos.clear();
103 ssl_config->alpn_protos.push_back(kProtoHTTP11); 141 ssl_config->alpn_protos.push_back(kProtoHTTP11);
104 } 142 }
105 143
106 } // namespace net 144 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_server_properties.h ('k') | net/http/http_server_properties_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698