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

Unified Diff: chrome/browser/prerender/prerender_manager.cc

Issue 58053002: Add UMA histogram for suppressed dialogs on prerender swap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_manager.cc
diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc
index 954edb55bb6d2bfff58f8189336f8b0ef0ab520a..14f93c2d765ae37af23c391889f561f34bb775bd 100644
--- a/chrome/browser/prerender/prerender_manager.cc
+++ b/chrome/browser/prerender/prerender_manager.cc
@@ -160,7 +160,8 @@ class PrerenderManager::OnCloseWebContentsDeleter
OnCloseWebContentsDeleter(PrerenderManager* manager,
WebContents* tab)
: manager_(manager),
- tab_(tab) {
+ tab_(tab),
+ suppressed_dialog_(false) {
tab_->SetDelegate(this);
base::MessageLoop::current()->PostDelayedTask(FROM_HERE,
base::Bind(&OnCloseWebContentsDeleter::ScheduleWebContentsForDeletion,
@@ -179,6 +180,9 @@ class PrerenderManager::OnCloseWebContentsDeleter
}
virtual bool ShouldSuppressDialogs() OVERRIDE {
+ // Use this as a proxy for getting statistics on how often we fail to honor
+ // the beforeunload event.
+ suppressed_dialog_ = true;
return true;
}
@@ -186,13 +190,17 @@ class PrerenderManager::OnCloseWebContentsDeleter
static const int kDeleteWithExtremePrejudiceSeconds = 3;
void ScheduleWebContentsForDeletion(bool timeout) {
+ UMA_HISTOGRAM_BOOLEAN("Prerender.TabContentsDeleterTimeout", timeout);
+ UMA_HISTOGRAM_BOOLEAN("Prerender.TabContentsDeleterSuppressedDialog",
+ suppressed_dialog_);
tab_->SetDelegate(NULL);
manager_->ScheduleDeleteOldWebContents(tab_.release(), this);
- UMA_HISTOGRAM_BOOLEAN("Prerender.TabContentsDeleterTimeout", timeout);
+ // |this| is deleted at this point.
}
PrerenderManager* manager_;
scoped_ptr<WebContents> tab_;
+ bool suppressed_dialog_;
DISALLOW_COPY_AND_ASSIGN(OnCloseWebContentsDeleter);
};
@@ -584,6 +592,7 @@ bool PrerenderManager::MaybeUsePrerenderedPage(const GURL& url,
if (old_web_contents->NeedToFireBeforeUnload()) {
// Schedule the delete to occur after the tab has run its unload handlers.
+ // TODO(davidben): Honor the beforeunload event. http://crbug.com/304932
on_close_web_contents_deleters_.push_back(
new OnCloseWebContentsDeleter(this, old_web_contents));
old_web_contents->GetRenderViewHost()->
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698