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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 DataReductionProxyUsageStats::LOCAL_BYPASS_RULES, | 184 DataReductionProxyUsageStats::LOCAL_BYPASS_RULES, |
185 content_length); | 185 content_length); |
186 return; | 186 return; |
187 } | 187 } |
188 | 188 |
189 if (triggering_request_) { | 189 if (triggering_request_) { |
190 RecordBypassedBytes(last_bypass_type_, | 190 RecordBypassedBytes(last_bypass_type_, |
191 DataReductionProxyUsageStats::TRIGGERING_REQUEST, | 191 DataReductionProxyUsageStats::TRIGGERING_REQUEST, |
192 content_length); | 192 content_length); |
193 triggering_request_ = false; | 193 triggering_request_ = false; |
194 } | |
195 | 194 |
196 std::string mime_type; | 195 // We only record when audio or video triggers a bypass. We don't care |
197 request.GetMimeType(&mime_type); | 196 // about audio and video bypassed as collateral damage. |
198 // MIME types are named by <media-type>/<subtype>. We check to see if the | 197 std::string mime_type; |
199 // media type is audio or video. | 198 request.GetMimeType(&mime_type); |
200 if (mime_type.compare(0, 6, "audio/") == 0 || | 199 // MIME types are named by <media-type>/<subtype>. We check to see if the |
201 mime_type.compare(0, 6, "video/") == 0) { | 200 // media type is audio or video. |
202 RecordBypassedBytes(last_bypass_type_, | 201 if (mime_type.compare(0, 6, "audio/") == 0 || |
203 DataReductionProxyUsageStats::AUDIO_VIDEO, | 202 mime_type.compare(0, 6, "video/") == 0) { |
204 content_length); | 203 RecordBypassedBytes(last_bypass_type_, |
| 204 DataReductionProxyUsageStats::AUDIO_VIDEO, |
| 205 content_length); |
| 206 } |
205 } | 207 } |
206 | 208 |
207 if (last_bypass_type_ != BYPASS_EVENT_TYPE_MAX) { | 209 if (last_bypass_type_ != BYPASS_EVENT_TYPE_MAX) { |
208 RecordBypassedBytes(last_bypass_type_, | 210 RecordBypassedBytes(last_bypass_type_, |
209 DataReductionProxyUsageStats::BYPASSED_BYTES_TYPE_MAX, | 211 DataReductionProxyUsageStats::BYPASSED_BYTES_TYPE_MAX, |
210 content_length); | 212 content_length); |
211 return; | 213 return; |
212 } | 214 } |
213 | 215 |
214 if (data_reduction_proxy_params_-> | 216 if (data_reduction_proxy_params_-> |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 default: | 350 default: |
349 break; | 351 break; |
350 } | 352 } |
351 break; | 353 break; |
352 } | 354 } |
353 } | 355 } |
354 | 356 |
355 } // namespace data_reduction_proxy | 357 } // namespace data_reduction_proxy |
356 | 358 |
357 | 359 |
OLD | NEW |