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) { |