| OLD | NEW |
| 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 4615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4626 if (rdh && type != blink::WebInputEvent::MouseWheel) | 4626 if (rdh && type != blink::WebInputEvent::MouseWheel) |
| 4627 rdh->OnUserGesture(); | 4627 rdh->OnUserGesture(); |
| 4628 } | 4628 } |
| 4629 | 4629 |
| 4630 void WebContentsImpl::OnIgnoredUIEvent() { | 4630 void WebContentsImpl::OnIgnoredUIEvent() { |
| 4631 // Notify observers. | 4631 // Notify observers. |
| 4632 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetIgnoredUIEvent()); | 4632 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetIgnoredUIEvent()); |
| 4633 } | 4633 } |
| 4634 | 4634 |
| 4635 void WebContentsImpl::RendererUnresponsive( | 4635 void WebContentsImpl::RendererUnresponsive( |
| 4636 RenderWidgetHostImpl* render_widget_host) { | 4636 RenderWidgetHostImpl* render_widget_host, |
| 4637 RenderWidgetHostDelegate::RendererUnresponsiveType type) { |
| 4637 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 4638 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 4638 OnRendererUnresponsive(render_widget_host)); | 4639 OnRendererUnresponsive(render_widget_host)); |
| 4639 | 4640 |
| 4640 // Don't show hung renderer dialog for a swapped out RVH. | 4641 // Don't show hung renderer dialog for a swapped out RVH. |
| 4641 if (render_widget_host != GetRenderViewHost()->GetWidget()) | 4642 if (render_widget_host != GetRenderViewHost()->GetWidget()) |
| 4642 return; | 4643 return; |
| 4643 | 4644 |
| 4644 RenderFrameHostImpl* rfhi = | 4645 RenderFrameHostImpl* rfhi = |
| 4645 static_cast<RenderFrameHostImpl*>(GetRenderViewHost()->GetMainFrame()); | 4646 static_cast<RenderFrameHostImpl*>(GetRenderViewHost()->GetMainFrame()); |
| 4646 | 4647 |
| 4647 // Ignore renderer unresponsive event if debugger is attached to the tab | 4648 // Ignore renderer unresponsive event if debugger is attached to the tab |
| 4648 // since the event may be a result of the renderer sitting on a breakpoint. | 4649 // since the event may be a result of the renderer sitting on a breakpoint. |
| 4649 // See http://crbug.com/65458 | 4650 // See http://crbug.com/65458 |
| 4650 if (DevToolsAgentHost::IsDebuggerAttached(this)) | 4651 if (DevToolsAgentHost::IsDebuggerAttached(this)) |
| 4651 return; | 4652 return; |
| 4652 | 4653 |
| 4654 // Record histograms about the type of renderer hang. |
| 4655 UMA_HISTOGRAM_ENUMERATION( |
| 4656 "ChildProcess.HangRendererType", type, |
| 4657 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_MAX); |
| 4658 |
| 4653 // We might have been waiting for both beforeunload and unload ACK. | 4659 // We might have been waiting for both beforeunload and unload ACK. |
| 4654 // Check if tab is to be unloaded first. | 4660 // Check if tab is to be unloaded first. |
| 4655 if (rfhi->IsWaitingForUnloadACK()) { | 4661 if (rfhi->IsWaitingForUnloadACK()) { |
| 4656 // Hang occurred while firing the unload handler. | 4662 // Hang occurred while firing the unload handler. |
| 4657 // Pretend the handler fired so tab closing continues as if it had. | 4663 // Pretend the handler fired so tab closing continues as if it had. |
| 4658 GetRenderViewHost()->set_sudden_termination_allowed(true); | 4664 GetRenderViewHost()->set_sudden_termination_allowed(true); |
| 4659 | 4665 |
| 4660 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer()) | 4666 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer()) |
| 4661 return; | 4667 return; |
| 4662 | 4668 |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5170 for (RenderViewHost* render_view_host : render_view_host_set) | 5176 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5171 render_view_host->OnWebkitPreferencesChanged(); | 5177 render_view_host->OnWebkitPreferencesChanged(); |
| 5172 } | 5178 } |
| 5173 | 5179 |
| 5174 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5180 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 5175 JavaScriptDialogManager* dialog_manager) { | 5181 JavaScriptDialogManager* dialog_manager) { |
| 5176 dialog_manager_ = dialog_manager; | 5182 dialog_manager_ = dialog_manager; |
| 5177 } | 5183 } |
| 5178 | 5184 |
| 5179 } // namespace content | 5185 } // namespace content |
| OLD | NEW |