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

Unified Diff: chrome/browser/ui/tab_contents/core_tab_helper.cc

Issue 17153008: Move histograms and supporting code that don't belong in content out. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/tab_contents/core_tab_helper.h ('k') | chrome/browser/ui/tabs/tab_strip_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/tab_contents/core_tab_helper.cc
diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.cc b/chrome/browser/ui/tab_contents/core_tab_helper.cc
index 502a3f8083e23c928148f166b0ee9b5148dd167f..a7853663f406123755265a0ffad7c3a7d9c288f3 100644
--- a/chrome/browser/ui/tab_contents/core_tab_helper.cc
+++ b/chrome/browser/ui/tab_contents/core_tab_helper.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/tab_contents/core_tab_helper.h"
+#include "base/metrics/histogram.h"
#include "chrome/browser/renderer_host/web_cache_manager.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
@@ -84,6 +85,16 @@ string16 CoreTabHelper::GetStatusText() const {
return string16();
}
+void CoreTabHelper::OnCloseStarted() {
+ if (close_start_time_.is_null())
+ close_start_time_ = base::TimeTicks::Now();
+}
+
+void CoreTabHelper::OnCloseCanceled() {
+ close_start_time_ = base::TimeTicks();
+ before_unload_end_time_ = base::TimeTicks();
+}
+
////////////////////////////////////////////////////////////////////////////////
// WebContentsObserver overrides
@@ -91,3 +102,24 @@ void CoreTabHelper::WasShown() {
WebCacheManager::GetInstance()->ObserveActivity(
web_contents()->GetRenderProcessHost()->GetID());
}
+
+void CoreTabHelper::WebContentsDestroyed(WebContents* web_contents) {
+ // OnCloseStarted isn't called in unit tests.
+ if (!close_start_time_.is_null()) {
+ base::TimeTicks now = base::TimeTicks::Now();
+ base::TimeTicks unload_start_time = close_start_time_;
+ if (!before_unload_end_time_.is_null())
+ unload_start_time = before_unload_end_time_;
+ UMA_HISTOGRAM_TIMES("Tab.Close", now - close_start_time_);
+ UMA_HISTOGRAM_TIMES("Tab.Close.UnloadTime", now - unload_start_time);
+ }
+
+}
+
+void CoreTabHelper::BeforeUnloadFired(const base::TimeTicks& proceed_time) {
+ before_unload_end_time_ = proceed_time;
+}
+
+void CoreTabHelper::BeforeUnloadDialogCancelled() {
+ OnCloseCanceled();
+}
« no previous file with comments | « chrome/browser/ui/tab_contents/core_tab_helper.h ('k') | chrome/browser/ui/tabs/tab_strip_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698