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

Side by Side Diff: content/browser/download/download_stats.cc

Issue 2886933003: Use stricter type checking in UMA_HISTOGRAM_ENUMERATION (Closed)
Patch Set: nocompile test Created 3 years, 6 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 (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 "content/browser/download/download_stats.h" 5 #include "content/browser/download/download_stats.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/metrics/histogram_functions.h" 8 #include "base/metrics/histogram_functions.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/metrics/sparse_histogram.h" 10 #include "base/metrics/sparse_histogram.h"
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 907
908 void RecordSavePackageEvent(SavePackageEvent event) { 908 void RecordSavePackageEvent(SavePackageEvent event) {
909 UMA_HISTOGRAM_ENUMERATION("Download.SavePackage", 909 UMA_HISTOGRAM_ENUMERATION("Download.SavePackage",
910 event, 910 event,
911 SAVE_PACKAGE_LAST_ENTRY); 911 SAVE_PACKAGE_LAST_ENTRY);
912 } 912 }
913 913
914 void RecordOriginStateOnResumption(bool is_partial, 914 void RecordOriginStateOnResumption(bool is_partial,
915 int state) { 915 int state) {
916 if (is_partial) 916 if (is_partial)
917 UMA_HISTOGRAM_ENUMERATION("Download.OriginStateOnPartialResumption", state, 917 UMA_HISTOGRAM_EXACT_LINEAR(
918 ORIGIN_STATE_ON_RESUMPTION_MAX); 918 "Download.OriginStateOnPartialResumption", state,
919 static_cast<int>(ORIGIN_STATE_ON_RESUMPTION_MAX));
Alexei Svitkine (slow) 2017/05/31 20:22:24 But these are actual enums, as defined in XML. I
wychen 2017/07/14 23:18:44 Fixed. Some static casts are still needed because
919 else 920 else
920 UMA_HISTOGRAM_ENUMERATION("Download.OriginStateOnFullResumption", state, 921 UMA_HISTOGRAM_EXACT_LINEAR(
921 ORIGIN_STATE_ON_RESUMPTION_MAX); 922 "Download.OriginStateOnFullResumption", state,
923 static_cast<int>(ORIGIN_STATE_ON_RESUMPTION_MAX));
922 } 924 }
923 925
924 namespace { 926 namespace {
925 927
926 // Enumeration for histogramming purposes. 928 // Enumeration for histogramming purposes.
927 // DO NOT CHANGE THE ORDERING OF THESE VALUES. 929 // DO NOT CHANGE THE ORDERING OF THESE VALUES.
928 enum DownloadConnectionSecurity { 930 enum DownloadConnectionSecurity {
929 DOWNLOAD_SECURE, // Final download url and its redirects all use https 931 DOWNLOAD_SECURE, // Final download url and its redirects all use https
930 DOWNLOAD_TARGET_INSECURE, // Final download url uses http, redirects are all 932 DOWNLOAD_TARGET_INSECURE, // Final download url uses http, redirects are all
931 // https 933 // https
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 } 979 }
978 980
979 void RecordDownloadHttpResponseCode(int response_code) { 981 void RecordDownloadHttpResponseCode(int response_code) {
980 UMA_HISTOGRAM_CUSTOM_ENUMERATION( 982 UMA_HISTOGRAM_CUSTOM_ENUMERATION(
981 "Download.HttpResponseCode", 983 "Download.HttpResponseCode",
982 net::HttpUtil::MapStatusCodeForHistogram(response_code), 984 net::HttpUtil::MapStatusCodeForHistogram(response_code),
983 net::HttpUtil::GetStatusCodesForHistogram()); 985 net::HttpUtil::GetStatusCodesForHistogram());
984 } 986 }
985 987
986 } // namespace content 988 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698