| Index: content/browser/web_contents/web_contents_impl.cc
|
| diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
| index 566b05fdb556165709a3427fc3323e29b8001e99..c1df0b9d08e65fc0d7fba13fa4fa47ef72f9a73e 100644
|
| --- a/content/browser/web_contents/web_contents_impl.cc
|
| +++ b/content/browser/web_contents/web_contents_impl.cc
|
| @@ -363,11 +363,17 @@ WebContentsImpl::~WebContentsImpl() {
|
| // OnCloseStarted isn't called in unit tests.
|
| if (!close_start_time_.is_null()) {
|
| base::TimeTicks now = base::TimeTicks::Now();
|
| + base::TimeDelta close_time = now - close_start_time_;
|
| + UMA_HISTOGRAM_TIMES("Tab.Close", close_time);
|
| +
|
| base::TimeTicks unload_start_time = close_start_time_;
|
| + base::TimeTicks unload_end_time = now;
|
| 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);
|
| + if (!unload_detached_start_time_.is_null())
|
| + unload_end_time = unload_detached_start_time_;
|
| + base::TimeDelta unload_time = unload_end_time - unload_start_time;
|
| + UMA_HISTOGRAM_TIMES("Tab.Close.UnloadTime", unload_time);
|
| }
|
|
|
| FOR_EACH_OBSERVER(WebContentsObserver,
|
| @@ -1755,8 +1761,15 @@ void WebContentsImpl::Close() {
|
| }
|
|
|
| void WebContentsImpl::OnCloseStarted() {
|
| - if (close_start_time_.is_null())
|
| + if (close_start_time_.is_null()) {
|
| close_start_time_ = base::TimeTicks::Now();
|
| + }
|
| +}
|
| +
|
| +void WebContentsImpl::OnUnloadDetachedStarted() {
|
| + if (unload_detached_start_time_.is_null()) {
|
| + unload_detached_start_time_ = base::TimeTicks::Now();
|
| + }
|
| }
|
|
|
| bool WebContentsImpl::ShouldAcceptDragAndDrop() const {
|
| @@ -3320,6 +3333,7 @@ void WebContentsImpl::OnDialogClosed(RenderViewHost* rvh,
|
|
|
| close_start_time_ = base::TimeTicks();
|
| before_unload_end_time_ = base::TimeTicks();
|
| + unload_detached_start_time_ = base::TimeTicks();
|
| }
|
| is_showing_before_unload_dialog_ = false;
|
| static_cast<RenderViewHostImpl*>(
|
|
|