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

Side by Side Diff: components/data_reduction_proxy/common/data_reduction_proxy_headers.cc

Issue 390533003: Bypassed Bytes UMAs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed bengr comments Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" 5 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 const int kMediumBypassMaxSeconds = 300; 107 const int kMediumBypassMaxSeconds = 300;
108 net::ProxyService::DataReductionProxyBypassType 108 net::ProxyService::DataReductionProxyBypassType
109 GetDataReductionProxyBypassType( 109 GetDataReductionProxyBypassType(
110 const net::HttpResponseHeaders* headers, 110 const net::HttpResponseHeaders* headers,
111 DataReductionProxyInfo* data_reduction_proxy_info) { 111 DataReductionProxyInfo* data_reduction_proxy_info) {
112 DCHECK(data_reduction_proxy_info); 112 DCHECK(data_reduction_proxy_info);
113 if (GetDataReductionProxyInfo(headers, data_reduction_proxy_info)) { 113 if (GetDataReductionProxyInfo(headers, data_reduction_proxy_info)) {
114 // A chrome-proxy response header is only present in a 502. For proper 114 // A chrome-proxy response header is only present in a 502. For proper
115 // reporting, this check must come before the 5xx checks below. 115 // reporting, this check must come before the 5xx checks below.
116 const TimeDelta& duration = data_reduction_proxy_info->bypass_duration; 116 const TimeDelta& duration = data_reduction_proxy_info->bypass_duration;
117 //bypass=0 means bypass for a random duration between 1 to 5 minutes
bengr 2014/07/16 23:28:15 add space after //
118 if(duration == TimeDelta())
bengr 2014/07/16 23:28:15 if (duration...
119 return ProxyService::MEDIUM_BYPASS;
117 if (duration <= TimeDelta::FromSeconds(kShortBypassMaxSeconds)) 120 if (duration <= TimeDelta::FromSeconds(kShortBypassMaxSeconds))
118 return ProxyService::SHORT_BYPASS; 121 return ProxyService::SHORT_BYPASS;
119 if (duration <= TimeDelta::FromSeconds(kMediumBypassMaxSeconds)) 122 if (duration <= TimeDelta::FromSeconds(kMediumBypassMaxSeconds))
120 return ProxyService::MEDIUM_BYPASS; 123 return ProxyService::MEDIUM_BYPASS;
121 return ProxyService::LONG_BYPASS; 124 return ProxyService::LONG_BYPASS;
122 } 125 }
123 // Fall back if a 500, 502 or 503 is returned. 126 // Fall back if a 500, 502 or 503 is returned.
124 if (headers->response_code() == net::HTTP_INTERNAL_SERVER_ERROR) 127 if (headers->response_code() == net::HTTP_INTERNAL_SERVER_ERROR)
125 return ProxyService::STATUS_500_HTTP_INTERNAL_SERVER_ERROR; 128 return ProxyService::STATUS_500_HTTP_INTERNAL_SERVER_ERROR;
126 if (headers->response_code() == net::HTTP_BAD_GATEWAY) 129 if (headers->response_code() == net::HTTP_BAD_GATEWAY)
(...skipping 19 matching lines...) Expand all
146 headers->response_code() < net::HTTP_INTERNAL_SERVER_ERROR) { 149 headers->response_code() < net::HTTP_INTERNAL_SERVER_ERROR) {
147 return ProxyService::MISSING_VIA_HEADER_4XX; 150 return ProxyService::MISSING_VIA_HEADER_4XX;
148 } 151 }
149 return ProxyService::MISSING_VIA_HEADER_OTHER; 152 return ProxyService::MISSING_VIA_HEADER_OTHER;
150 } 153 }
151 // There is no bypass event. 154 // There is no bypass event.
152 return ProxyService::BYPASS_EVENT_TYPE_MAX; 155 return ProxyService::BYPASS_EVENT_TYPE_MAX;
153 } 156 }
154 157
155 } // namespace data_reduction_proxy 158 } // namespace data_reduction_proxy
OLDNEW
« no previous file with comments | « components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698