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

Unified Diff: chrome/browser/devtools/devtools_ui_bindings.cc

Issue 1056073003: DevTools: introduce RecordEnumeratedHistogram method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix styling Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/devtools/devtools_ui_bindings.h ('k') | content/browser/bad_message.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/devtools_ui_bindings.cc
diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc
index 03c3c97ae391af45b3c3c767c4f90f82e9308181..d75f072f2c6f3658ac46e94736d21a8821ac535e 100644
--- a/chrome/browser/devtools/devtools_ui_bindings.cc
+++ b/chrome/browser/devtools/devtools_ui_bindings.cc
@@ -749,6 +749,19 @@ void DevToolsUIBindings::RecordActionUMA(const std::string& name, int action) {
UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsPanelShownBoundary);
}
+void DevToolsUIBindings::RecordUMA(const std::string& name,
Ilya Sherman 2015/04/06 23:31:21 nit: I would name this method "RecordEnumeratedHis
lushnikov 2015/04/07 13:51:03 Done.
+ int action,
+ int bucket_size) {
Ilya Sherman 2015/04/06 23:31:22 nit: I would name these parameters |sample| and |b
lushnikov 2015/04/07 13:51:03 Done.
+ bool valid_name = name == kDevToolsActionTakenHistogram ||
+ name == kDevToolsPanelShownHistogram;
+ if (bucket_size >= 0 && bucket_size < 100 &&
+ action >= 0 && action < bucket_size && valid_name) {
+ UMA_HISTOGRAM_ENUMERATION(name, action, bucket_size);
Ilya Sherman 2015/04/06 23:31:22 Optional: It might be cleaner to write this method
Ilya Sherman 2015/04/06 23:31:22 This will not work. If you use the macros, you mu
lushnikov 2015/04/07 13:51:03 Every early return will have a body of two lines (
lushnikov 2015/04/07 13:51:03 The name is guaranteed to be one of the constants
Ilya Sherman 2015/04/07 21:45:08 RecordActionUMA has an if/else, which guarantees t
lushnikov 2015/04/07 23:03:07 Done.
+ } else {
+ frontend_host_->BadMessageRecieved();
+ }
+}
+
void DevToolsUIBindings::SendJsonRequest(const DispatchCallback& callback,
const std::string& browser_id,
const std::string& url) {
« no previous file with comments | « chrome/browser/devtools/devtools_ui_bindings.h ('k') | content/browser/bad_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698