diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-21 21:29:12 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-21 21:29:12 +0000 |
commit | 6d65a46ab8dff07d44aea625222587e09aae06ca (patch) | |
tree | 68d59bf622916f4a487308e3fbfa82224699e486 /content | |
parent | e52291df4e21fb9857f7225b86ca50fbcb8cc583 (diff) | |
download | chromium_src-6d65a46ab8dff07d44aea625222587e09aae06ca.zip chromium_src-6d65a46ab8dff07d44aea625222587e09aae06ca.tar.gz chromium_src-6d65a46ab8dff07d44aea625222587e09aae06ca.tar.bz2 |
Move histograms and supporting code that don't belong in content out.
This CL was originally based on top of r205149 (Fast Tab Closure) and committed as r207181. The Fast Tab Closure CL was backed out together with the previous version of this CL.
Here's another shot, doing the same cleanup as before but with r205149 reverted.
BUG=
Review URL: https://chromiumcodereview.appspot.com/17153008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207925 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/web_contents/web_contents_impl.cc | 30 | ||||
-rw-r--r-- | content/browser/web_contents/web_contents_impl.h | 12 | ||||
-rw-r--r-- | content/public/browser/web_contents.h | 9 | ||||
-rw-r--r-- | content/public/browser/web_contents_observer.h | 6 |
4 files changed, 10 insertions, 47 deletions
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index ee3eaa4..a14d1f3 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -398,16 +398,6 @@ WebContentsImpl::~WebContentsImpl() { } #endif - // 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); - } - FOR_EACH_OBSERVER(WebContentsObserver, observers_, WebContentsImplDestroyed()); @@ -1948,23 +1938,10 @@ RendererPreferences* WebContentsImpl::GetMutableRendererPrefs() { return &renderer_preferences_; } -void WebContentsImpl::SetNewTabStartTime(const base::TimeTicks& time) { - new_tab_start_time_ = time; -} - -base::TimeTicks WebContentsImpl::GetNewTabStartTime() const { - return new_tab_start_time_; -} - void WebContentsImpl::Close() { Close(GetRenderViewHost()); } -void WebContentsImpl::OnCloseStarted() { - if (close_start_time_.is_null()) - close_start_time_ = base::TimeTicks::Now(); -} - void WebContentsImpl::DragSourceEndedAt(int client_x, int client_y, int screen_x, int screen_y, WebKit::WebDragOperation operation) { if (browser_plugin_embedder_.get()) @@ -3498,7 +3475,8 @@ void WebContentsImpl::WorkerCrashed() { void WebContentsImpl::BeforeUnloadFiredFromRenderManager( bool proceed, const base::TimeTicks& proceed_time, bool* proceed_to_fire_unload) { - before_unload_end_time_ = proceed_time; + FOR_EACH_OBSERVER(WebContentsObserver, observers_, + BeforeUnloadFired(proceed_time)); if (delegate_) delegate_->BeforeUnloadFired(this, proceed, proceed_to_fire_unload); } @@ -3641,8 +3619,8 @@ void WebContentsImpl::OnDialogClosed(RenderViewHost* rvh, DidStopLoading(rvh); controller_.DiscardNonCommittedEntries(); - close_start_time_ = base::TimeTicks(); - before_unload_end_time_ = base::TimeTicks(); + FOR_EACH_OBSERVER(WebContentsObserver, observers_, + BeforeUnloadDialogCancelled()); } is_showing_before_unload_dialog_ = false; static_cast<RenderViewHostImpl*>( diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index a91a4c6..df7d535 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h @@ -264,10 +264,7 @@ class CONTENT_EXPORT WebContentsImpl virtual void SetOverrideEncoding(const std::string& encoding) OVERRIDE; virtual void ResetOverrideEncoding() OVERRIDE; virtual RendererPreferences* GetMutableRendererPrefs() OVERRIDE; - virtual void SetNewTabStartTime(const base::TimeTicks& time) OVERRIDE; - virtual base::TimeTicks GetNewTabStartTime() const OVERRIDE; virtual void Close() OVERRIDE; - virtual void OnCloseStarted() OVERRIDE; virtual void SystemDragEnded() OVERRIDE; virtual void UserGestureDone() OVERRIDE; virtual void SetClosedByUserGesture(bool value) OVERRIDE; @@ -870,15 +867,6 @@ class CONTENT_EXPORT WebContentsImpl // Settings that get passed to the renderer process. RendererPreferences renderer_preferences_; - // The time that we started to create the new tab page. - base::TimeTicks new_tab_start_time_; - - // The time that we started to close this WebContents. - base::TimeTicks close_start_time_; - - // The time when onbeforeunload ended. - base::TimeTicks before_unload_end_time_; - // The time that this tab was last selected. base::TimeTicks last_selected_time_; diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h index 309e264..037fef84 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h @@ -361,19 +361,10 @@ class WebContents : public PageNavigator, // Returns the settings which get passed to the renderer. virtual content::RendererPreferences* GetMutableRendererPrefs() = 0; - // Set the time when we started to create the new tab page. This time is - // from before we created this WebContents. - virtual void SetNewTabStartTime(const base::TimeTicks& time) = 0; - virtual base::TimeTicks GetNewTabStartTime() const = 0; - // Tells the tab to close now. The tab will take care not to close until it's // out of nested message loops. virtual void Close() = 0; - // Notification that tab closing has started. This can be called multiple - // times, subsequent calls are ignored. - virtual void OnCloseStarted() = 0; - // A render view-originated drag has ended. Informs the render view host and // WebContentsDelegate. virtual void SystemDragEnded() = 0; diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h index 0a01171..d7490e7 100644 --- a/content/public/browser/web_contents_observer.h +++ b/content/public/browser/web_contents_observer.h @@ -259,6 +259,12 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener, // Invoked before a form repost warning is shown. virtual void BeforeFormRepostWarningShow() {} + // Invoked when the beforeunload handler fires. The time is from the renderer. + virtual void BeforeUnloadFired(const base::TimeTicks& proceed_time) {} + + // Invoked when a user cancels a before unload dialog. + virtual void BeforeUnloadDialogCancelled() {} + // IPC::Listener implementation. virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |