Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/browser/data_reduction_proxy_usage_sta ts.h" | 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta ts.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 #include "net/proxy/proxy_retry_info.h" | 9 #include "net/proxy/proxy_retry_info.h" |
| 10 #include "net/proxy/proxy_server.h" | 10 #include "net/proxy/proxy_server.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 DataReductionProxyUsageStats::LOCAL_BYPASS_RULES, | 132 DataReductionProxyUsageStats::LOCAL_BYPASS_RULES, |
| 133 content_length); | 133 content_length); |
| 134 return; | 134 return; |
| 135 } | 135 } |
| 136 | 136 |
| 137 if (triggering_request_) { | 137 if (triggering_request_) { |
| 138 RecordBypassedBytes(last_bypass_type_, | 138 RecordBypassedBytes(last_bypass_type_, |
| 139 DataReductionProxyUsageStats::TRIGGERING_REQUEST, | 139 DataReductionProxyUsageStats::TRIGGERING_REQUEST, |
| 140 content_length); | 140 content_length); |
| 141 triggering_request_ = false; | 141 triggering_request_ = false; |
| 142 } | |
| 143 | 142 |
| 144 std::string mime_type; | 143 // We only record when audio or video triggers a bypass. We don't care |
| 145 request.GetMimeType(&mime_type); | 144 // about audio and video bypassed as collateral damage. |
| 146 // MIME types are named by <media-type>/<subtype>. We check to see if the | 145 std::string mime_type; |
| 147 // media type is audio or video. | 146 request.GetMimeType(&mime_type); |
| 148 if (mime_type.compare(0, 6, "audio/") == 0 || | 147 // MIME types are named by <media-type>/<subtype>. We check to see if the |
| 149 mime_type.compare(0, 6, "video/") == 0) { | 148 // media type is audio or video. |
| 150 RecordBypassedBytes(last_bypass_type_, | 149 if (mime_type.compare(0, 6, "audio/") == 0 || |
| 151 DataReductionProxyUsageStats::AUDIO_VIDEO, | 150 mime_type.compare(0, 6, "video/") == 0) { |
| 152 content_length); | 151 RecordBypassedBytes(last_bypass_type_, |
| 152 DataReductionProxyUsageStats::AUDIO_VIDEO, | |
| 153 content_length); | |
| 154 } | |
| 153 } | 155 } |
| 154 | 156 |
| 155 if (last_bypass_type_ != ProxyService::BYPASS_EVENT_TYPE_MAX) { | 157 if (last_bypass_type_ != ProxyService::BYPASS_EVENT_TYPE_MAX) { |
| 156 RecordBypassedBytes(last_bypass_type_, | 158 RecordBypassedBytes(last_bypass_type_, |
| 157 DataReductionProxyUsageStats::BYPASSED_BYTES_TYPE_MAX, | 159 DataReductionProxyUsageStats::BYPASSED_BYTES_TYPE_MAX, |
| 158 content_length); | 160 content_length); |
| 159 return; | 161 return; |
| 160 } | 162 } |
| 161 | 163 |
| 162 if (data_reduction_proxy_params_-> | 164 if (data_reduction_proxy_params_-> |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 184 "DataReductionProxy.BypassedBytes.SSL", content_length); | 186 "DataReductionProxy.BypassedBytes.SSL", content_length); |
| 185 break; | 187 break; |
| 186 case DataReductionProxyUsageStats::LOCAL_BYPASS_RULES: | 188 case DataReductionProxyUsageStats::LOCAL_BYPASS_RULES: |
| 187 UMA_HISTOGRAM_COUNTS( | 189 UMA_HISTOGRAM_COUNTS( |
| 188 "DataReductionProxy.BypassedBytes.LocalBypassRules", | 190 "DataReductionProxy.BypassedBytes.LocalBypassRules", |
| 189 content_length); | 191 content_length); |
| 190 break; | 192 break; |
| 191 case DataReductionProxyUsageStats::AUDIO_VIDEO: | 193 case DataReductionProxyUsageStats::AUDIO_VIDEO: |
| 192 if (last_bypass_type_ == ProxyService::SHORT_BYPASS) { | 194 if (last_bypass_type_ == ProxyService::SHORT_BYPASS) { |
| 193 UMA_HISTOGRAM_COUNTS( | 195 UMA_HISTOGRAM_COUNTS( |
| 194 "DataReductionProxy.BypassedBytes.ShortAudioVideo", | 196 "DataReductionProxy.BypassedBytes.ShortTriggeringRequestAudioVideo", |
|
Alexei Svitkine (slow)
2014/08/12 14:32:37
Did you mean to not rename this?
megjablon
2014/08/12 16:53:59
Ah sorry didn't mean to send that message yet. I t
| |
| 195 content_length); | 197 content_length); |
| 196 } | 198 } |
| 197 break; | 199 break; |
| 198 case DataReductionProxyUsageStats::TRIGGERING_REQUEST: | 200 case DataReductionProxyUsageStats::TRIGGERING_REQUEST: |
| 199 switch (bypass_type) { | 201 switch (bypass_type) { |
| 200 case ProxyService::SHORT_BYPASS: | 202 case ProxyService::SHORT_BYPASS: |
| 201 UMA_HISTOGRAM_COUNTS( | 203 UMA_HISTOGRAM_COUNTS( |
| 202 "DataReductionProxy.BypassedBytes.ShortTriggeringRequest", | 204 "DataReductionProxy.BypassedBytes.ShortTriggeringRequest", |
| 203 content_length); | 205 content_length); |
| 204 break; | 206 break; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 default: | 275 default: |
| 274 break; | 276 break; |
| 275 } | 277 } |
| 276 break; | 278 break; |
| 277 } | 279 } |
| 278 } | 280 } |
| 279 | 281 |
| 280 } // namespace data_reduction_proxy | 282 } // namespace data_reduction_proxy |
| 281 | 283 |
| 282 | 284 |
| OLD | NEW |