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

Unified Diff: components/app_modal/javascript_dialog_manager.cc

Issue 1688183002: Include suppressed dialogs in the FineTiming histogram (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « components/app_modal/javascript_app_modal_dialog.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/app_modal/javascript_dialog_manager.cc
diff --git a/components/app_modal/javascript_dialog_manager.cc b/components/app_modal/javascript_dialog_manager.cc
index f654f8bf3d01283202768bf81aebd77d655ae908..7c4db07af63ab2e967dcdb9e2dbb2dd659e6a4d5 100644
--- a/components/app_modal/javascript_dialog_manager.cc
+++ b/components/app_modal/javascript_dialog_manager.cc
@@ -104,6 +104,21 @@ void JavaScriptDialogManager::RunJavaScriptDialog(
web_contents)];
if (extra_data->suppress_javascript_messages_) {
+ // If a page tries to open dialogs in a tight loop, the number of
+ // suppressions logged can grow out of control. Arbitrarily cap the number
+ // logged at 100. That many suppressed dialogs is enough to indicate the
+ // page is doing something very hinky.
Avi (use Gerrit) 2016/02/11 15:55:04 Wellll... not necessarily. Imagine a calendar tab
+ if (extra_data->suppressed_dialog_count_ < 100) {
+ // Log a suppressed dialog as one that opens and then closes immediately.
+ UMA_HISTOGRAM_MEDIUM_TIMES(
+ "JSDialogs.FineTiming.TimeBetweenDialogCreatedAndSameDialogClosed",
+ base::TimeDelta());
+
+ // Only increment the count if it's not already at the limit, to prevent
+ // overflow.
+ extra_data->suppressed_dialog_count_++;
+ }
+
*did_suppress_message = true;
return;
}
« no previous file with comments | « components/app_modal/javascript_app_modal_dialog.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698