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

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

Issue 2155383002: Add an histogram to differentiate between hang types of the renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 5 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 4592 matching lines...) Expand 10 before | Expand all | Expand 10 after
4603 if (rdh && type != blink::WebInputEvent::MouseWheel) 4603 if (rdh && type != blink::WebInputEvent::MouseWheel)
4604 rdh->OnUserGesture(); 4604 rdh->OnUserGesture();
4605 } 4605 }
4606 4606
4607 void WebContentsImpl::OnIgnoredUIEvent() { 4607 void WebContentsImpl::OnIgnoredUIEvent() {
4608 // Notify observers. 4608 // Notify observers.
4609 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetIgnoredUIEvent()); 4609 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetIgnoredUIEvent());
4610 } 4610 }
4611 4611
4612 void WebContentsImpl::RendererUnresponsive( 4612 void WebContentsImpl::RendererUnresponsive(
4613 RenderWidgetHostImpl* render_widget_host) { 4613 RenderWidgetHostImpl* render_widget_host,
4614 RenderWidgetHostDelegate::RendererUnresponsiveType type) {
4614 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 4615 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
4615 OnRendererUnresponsive(render_widget_host)); 4616 OnRendererUnresponsive(render_widget_host));
4616 4617
4617 // Don't show hung renderer dialog for a swapped out RVH. 4618 // Don't show hung renderer dialog for a swapped out RVH.
4618 if (render_widget_host != GetRenderViewHost()->GetWidget()) 4619 if (render_widget_host != GetRenderViewHost()->GetWidget())
4619 return; 4620 return;
4620 4621
4621 RenderFrameHostImpl* rfhi = 4622 RenderFrameHostImpl* rfhi =
4622 static_cast<RenderFrameHostImpl*>(GetRenderViewHost()->GetMainFrame()); 4623 static_cast<RenderFrameHostImpl*>(GetRenderViewHost()->GetMainFrame());
4623 4624
4624 // Ignore renderer unresponsive event if debugger is attached to the tab 4625 // Ignore renderer unresponsive event if debugger is attached to the tab
4625 // since the event may be a result of the renderer sitting on a breakpoint. 4626 // since the event may be a result of the renderer sitting on a breakpoint.
4626 // See http://crbug.com/65458 4627 // See http://crbug.com/65458
4627 if (DevToolsAgentHost::IsDebuggerAttached(this)) 4628 if (DevToolsAgentHost::IsDebuggerAttached(this))
4628 return; 4629 return;
4629 4630
4631 // Record histograms about the type of renderer hang.
4632 UMA_HISTOGRAM_ENUMERATION(
4633 "ChildProcess.HangRendererType", type,
4634 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_MAX);
4635
4630 // We might have been waiting for both beforeunload and unload ACK. 4636 // We might have been waiting for both beforeunload and unload ACK.
4631 // Check if tab is to be unloaded first. 4637 // Check if tab is to be unloaded first.
4632 if (rfhi->IsWaitingForUnloadACK()) { 4638 if (rfhi->IsWaitingForUnloadACK()) {
4633 // Hang occurred while firing the unload handler. 4639 // Hang occurred while firing the unload handler.
4634 // Pretend the handler fired so tab closing continues as if it had. 4640 // Pretend the handler fired so tab closing continues as if it had.
4635 GetRenderViewHost()->set_sudden_termination_allowed(true); 4641 GetRenderViewHost()->set_sudden_termination_allowed(true);
4636 4642
4637 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer()) 4643 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer())
4638 return; 4644 return;
4639 4645
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
5147 for (RenderViewHost* render_view_host : render_view_host_set) 5153 for (RenderViewHost* render_view_host : render_view_host_set)
5148 render_view_host->OnWebkitPreferencesChanged(); 5154 render_view_host->OnWebkitPreferencesChanged();
5149 } 5155 }
5150 5156
5151 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 5157 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
5152 JavaScriptDialogManager* dialog_manager) { 5158 JavaScriptDialogManager* dialog_manager) {
5153 dialog_manager_ = dialog_manager; 5159 dialog_manager_ = dialog_manager;
5154 } 5160 }
5155 5161
5156 } // namespace content 5162 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698