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

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

Issue 2136173003: Add an histogram to differentiate between hang types of the renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 4606 matching lines...) Expand 10 before | Expand all | Expand 10 after
4617 if (rdh && type != blink::WebInputEvent::MouseWheel) 4617 if (rdh && type != blink::WebInputEvent::MouseWheel)
4618 rdh->OnUserGesture(); 4618 rdh->OnUserGesture();
4619 } 4619 }
4620 4620
4621 void WebContentsImpl::OnIgnoredUIEvent() { 4621 void WebContentsImpl::OnIgnoredUIEvent() {
4622 // Notify observers. 4622 // Notify observers.
4623 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetIgnoredUIEvent()); 4623 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetIgnoredUIEvent());
4624 } 4624 }
4625 4625
4626 void WebContentsImpl::RendererUnresponsive( 4626 void WebContentsImpl::RendererUnresponsive(
4627 RenderWidgetHostImpl* render_widget_host) { 4627 RenderWidgetHostImpl* render_widget_host,
4628 RenderWidgetHostDelegate::RendererUnresponsiveType type) {
4628 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 4629 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
4629 OnRendererUnresponsive(render_widget_host)); 4630 OnRendererUnresponsive(render_widget_host));
4630 4631
4631 // Don't show hung renderer dialog for a swapped out RVH. 4632 // Don't show hung renderer dialog for a swapped out RVH.
4632 if (render_widget_host != GetRenderViewHost()->GetWidget()) 4633 if (render_widget_host != GetRenderViewHost()->GetWidget())
4633 return; 4634 return;
4634 4635
4635 RenderFrameHostImpl* rfhi = 4636 RenderFrameHostImpl* rfhi =
4636 static_cast<RenderFrameHostImpl*>(GetRenderViewHost()->GetMainFrame()); 4637 static_cast<RenderFrameHostImpl*>(GetRenderViewHost()->GetMainFrame());
4637 4638
4638 // Ignore renderer unresponsive event if debugger is attached to the tab 4639 // Ignore renderer unresponsive event if debugger is attached to the tab
4639 // since the event may be a result of the renderer sitting on a breakpoint. 4640 // since the event may be a result of the renderer sitting on a breakpoint.
4640 // See http://crbug.com/65458 4641 // See http://crbug.com/65458
4641 if (DevToolsAgentHost::IsDebuggerAttached(this)) 4642 if (DevToolsAgentHost::IsDebuggerAttached(this))
4642 return; 4643 return;
4643 4644
4645 // Record histograms about the type of renderer hang.
4646 UMA_HISTOGRAM_ENUMERATION(
4647 "ChildProcess.HangRendererType", type,
4648 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_MAX);
4649
4644 // We might have been waiting for both beforeunload and unload ACK. 4650 // We might have been waiting for both beforeunload and unload ACK.
4645 // Check if tab is to be unloaded first. 4651 // Check if tab is to be unloaded first.
4646 if (rfhi->IsWaitingForUnloadACK()) { 4652 if (rfhi->IsWaitingForUnloadACK()) {
4647 // Hang occurred while firing the unload handler. 4653 // Hang occurred while firing the unload handler.
4648 // Pretend the handler fired so tab closing continues as if it had. 4654 // Pretend the handler fired so tab closing continues as if it had.
4649 GetRenderViewHost()->set_sudden_termination_allowed(true); 4655 GetRenderViewHost()->set_sudden_termination_allowed(true);
4650 4656
4651 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer()) 4657 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer())
4652 return; 4658 return;
4653 4659
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
5161 for (RenderViewHost* render_view_host : render_view_host_set) 5167 for (RenderViewHost* render_view_host : render_view_host_set)
5162 render_view_host->OnWebkitPreferencesChanged(); 5168 render_view_host->OnWebkitPreferencesChanged();
5163 } 5169 }
5164 5170
5165 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 5171 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
5166 JavaScriptDialogManager* dialog_manager) { 5172 JavaScriptDialogManager* dialog_manager) {
5167 dialog_manager_ = dialog_manager; 5173 dialog_manager_ = dialog_manager;
5168 } 5174 }
5169 5175
5170 } // namespace content 5176 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698