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

Side by Side Diff: media/blink/resource_multibuffer_data_provider.cc

Issue 2776853002: Make UMA_HISTOGRAM_ENUMERATION work with scoped enums. (Closed)
Patch Set: iOS, Windows, and CrOS compile fixes Created 3 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "media/blink/resource_multibuffer_data_provider.h" 5 #include "media/blink/resource_multibuffer_data_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 GetCacheValidUntil(response)); 256 GetCacheValidUntil(response));
257 257
258 uint32_t reasons = GetReasonsForUncacheability(response); 258 uint32_t reasons = GetReasonsForUncacheability(response);
259 destination_url_data->set_cacheable(reasons == 0); 259 destination_url_data->set_cacheable(reasons == 0);
260 UMA_HISTOGRAM_BOOLEAN("Media.CacheUseful", reasons == 0); 260 UMA_HISTOGRAM_BOOLEAN("Media.CacheUseful", reasons == 0);
261 int shift = 0; 261 int shift = 0;
262 int max_enum = base::bits::Log2Ceiling(kMaxReason); 262 int max_enum = base::bits::Log2Ceiling(kMaxReason);
263 while (reasons) { 263 while (reasons) {
264 DCHECK_LT(shift, max_enum); // Sanity check. 264 DCHECK_LT(shift, max_enum); // Sanity check.
265 if (reasons & 0x1) { 265 if (reasons & 0x1) {
266 UMA_HISTOGRAM_ENUMERATION("Media.UncacheableReason", shift, 266 UMA_HISTOGRAM_EXACT_LINEAR("Media.UncacheableReason", shift,
rkaplow 2017/03/29 18:02:51 not sure why this can't be an enum either. Add a T
dcheng 2017/03/29 18:24:41 I think it's because the enum itself is a bitmask
rkaplow 2017/03/29 23:21:17 Well, the team can evaluate if they want to change
dcheng 2017/03/30 00:41:59 Done.
267 max_enum); // PRESUBMIT_IGNORE_UMA_MAX 267 max_enum); // PRESUBMIT_IGNORE_UMA_MAX
268 } 268 }
269 269
270 reasons >>= 1; 270 reasons >>= 1;
271 ++shift; 271 ++shift;
272 } 272 }
273 273
274 // Expected content length can be |kPositionNotSpecified|, in that case 274 // Expected content length can be |kPositionNotSpecified|, in that case
275 // |content_length_| is not specified and this is a streaming response. 275 // |content_length_| is not specified and this is a streaming response.
276 int64_t content_length = response.expectedContentLength(); 276 int64_t content_length = response.expectedContentLength();
277 bool end_of_file = false; 277 bool end_of_file = false;
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 } 547 }
548 548
549 if (byte_pos() != first_byte_position) { 549 if (byte_pos() != first_byte_position) {
550 return false; 550 return false;
551 } 551 }
552 552
553 return true; 553 return true;
554 } 554 }
555 555
556 } // namespace media 556 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698