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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 10945042: Add UMA to measure potential impact of Fast Tab Close. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Forward the "preceed time" from render view host manager. Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 // NULL if this contents was part of a window that closed. 383 // NULL if this contents was part of a window that closed.
384 if (GetNativeView()) { 384 if (GetNativeView()) {
385 RenderViewHost* host = GetRenderViewHost(); 385 RenderViewHost* host = GetRenderViewHost();
386 if (host && host->GetView()) 386 if (host && host->GetView())
387 RenderWidgetHostViewPort::FromRWHV(host->GetView())->WillWmDestroy(); 387 RenderWidgetHostViewPort::FromRWHV(host->GetView())->WillWmDestroy();
388 } 388 }
389 #endif 389 #endif
390 390
391 // OnCloseStarted isn't called in unit tests. 391 // OnCloseStarted isn't called in unit tests.
392 if (!close_start_time_.is_null()) { 392 if (!close_start_time_.is_null()) {
393 UMA_HISTOGRAM_TIMES("Tab.Close", 393 base::TimeTicks now = base::TimeTicks::Now();
394 base::TimeTicks::Now() - close_start_time_); 394 base::TimeTicks unload_start_time = close_start_time_;
395 if (!before_unload_end_time_.is_null())
396 unload_start_time = before_unload_end_time_;
397 UMA_HISTOGRAM_TIMES("Tab.Close", now - close_start_time_);
398 UMA_HISTOGRAM_TIMES("Tab.Close.UnloadTime", now - unload_start_time);
395 } 399 }
396 400
397 FOR_EACH_OBSERVER(WebContentsObserver, 401 FOR_EACH_OBSERVER(WebContentsObserver,
398 observers_, 402 observers_,
399 WebContentsImplDestroyed()); 403 WebContentsImplDestroyed());
400 404
401 SetDelegate(NULL); 405 SetDelegate(NULL);
402 } 406 }
403 407
404 WebContentsImpl* WebContentsImpl::Create( 408 WebContentsImpl* WebContentsImpl::Create(
(...skipping 2702 matching lines...) Expand 10 before | Expand all | Expand 10 after
3107 content::INVALIDATE_TYPE_LOAD | content::INVALIDATE_TYPE_TAB); 3111 content::INVALIDATE_TYPE_LOAD | content::INVALIDATE_TYPE_TAB);
3108 } 3112 }
3109 } 3113 }
3110 3114
3111 void WebContentsImpl::WorkerCrashed() { 3115 void WebContentsImpl::WorkerCrashed() {
3112 if (delegate_) 3116 if (delegate_)
3113 delegate_->WorkerCrashed(this); 3117 delegate_->WorkerCrashed(this);
3114 } 3118 }
3115 3119
3116 void WebContentsImpl::BeforeUnloadFiredFromRenderManager( 3120 void WebContentsImpl::BeforeUnloadFiredFromRenderManager(
3117 bool proceed, 3121 bool proceed, const base::TimeTicks& proceed_time,
3118 bool* proceed_to_fire_unload) { 3122 bool* proceed_to_fire_unload) {
3123 before_unload_end_time_ = proceed_time;
3119 if (delegate_) 3124 if (delegate_)
3120 delegate_->BeforeUnloadFired(this, proceed, proceed_to_fire_unload); 3125 delegate_->BeforeUnloadFired(this, proceed, proceed_to_fire_unload);
3121 } 3126 }
3122 3127
3123 void WebContentsImpl::RenderViewGoneFromRenderManager( 3128 void WebContentsImpl::RenderViewGoneFromRenderManager(
3124 RenderViewHost* render_view_host) { 3129 RenderViewHost* render_view_host) {
3125 DCHECK(crashed_status_ != base::TERMINATION_STATUS_STILL_RUNNING); 3130 DCHECK(crashed_status_ != base::TERMINATION_STATUS_STILL_RUNNING);
3126 RenderViewGone(render_view_host, crashed_status_, crashed_error_code_); 3131 RenderViewGone(render_view_host, crashed_status_, crashed_error_code_);
3127 } 3132 }
3128 3133
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
3230 IPC::Message* reply_msg, 3235 IPC::Message* reply_msg,
3231 bool success, 3236 bool success,
3232 const string16& user_input) { 3237 const string16& user_input) {
3233 if (is_showing_before_unload_dialog_ && !success) { 3238 if (is_showing_before_unload_dialog_ && !success) {
3234 // If a beforeunload dialog is canceled, we need to stop the throbber from 3239 // If a beforeunload dialog is canceled, we need to stop the throbber from
3235 // spinning, since we forced it to start spinning in Navigate. 3240 // spinning, since we forced it to start spinning in Navigate.
3236 DidStopLoading(rvh); 3241 DidStopLoading(rvh);
3237 controller_.DiscardNonCommittedEntries(); 3242 controller_.DiscardNonCommittedEntries();
3238 3243
3239 close_start_time_ = base::TimeTicks(); 3244 close_start_time_ = base::TimeTicks();
3245 before_unload_end_time_ = base::TimeTicks();
3240 } 3246 }
3241 is_showing_before_unload_dialog_ = false; 3247 is_showing_before_unload_dialog_ = false;
3242 static_cast<RenderViewHostImpl*>( 3248 static_cast<RenderViewHostImpl*>(
3243 rvh)->JavaScriptDialogClosed(reply_msg, success, user_input); 3249 rvh)->JavaScriptDialogClosed(reply_msg, success, user_input);
3244 } 3250 }
3245 3251
3246 void WebContentsImpl::SetEncoding(const std::string& encoding) { 3252 void WebContentsImpl::SetEncoding(const std::string& encoding) {
3247 encoding_ = content::GetContentClient()->browser()-> 3253 encoding_ = content::GetContentClient()->browser()->
3248 GetCanonicalEncodingNameByAliasName(encoding); 3254 GetCanonicalEncodingNameByAliasName(encoding);
3249 } 3255 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3292 old_browser_plugin_host()->embedder_render_process_host(); 3298 old_browser_plugin_host()->embedder_render_process_host();
3293 *embedder_container_id = old_browser_plugin_host()->instance_id(); 3299 *embedder_container_id = old_browser_plugin_host()->instance_id();
3294 int embedder_process_id = 3300 int embedder_process_id =
3295 embedder_render_process_host ? embedder_render_process_host->GetID() : -1; 3301 embedder_render_process_host ? embedder_render_process_host->GetID() : -1;
3296 if (embedder_process_id != -1) { 3302 if (embedder_process_id != -1) {
3297 *embedder_channel_name = 3303 *embedder_channel_name =
3298 StringPrintf("%d.r%d", render_view_host->GetProcess()->GetID(), 3304 StringPrintf("%d.r%d", render_view_host->GetProcess()->GetID(),
3299 embedder_process_id); 3305 embedder_process_id);
3300 } 3306 }
3301 } 3307 }
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698