| 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 4820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4831 } | 4831 } |
| 4832 } | 4832 } |
| 4833 | 4833 |
| 4834 void WebContentsImpl::OnIgnoredUIEvent() { | 4834 void WebContentsImpl::OnIgnoredUIEvent() { |
| 4835 // Notify observers. | 4835 // Notify observers. |
| 4836 for (auto& observer : observers_) | 4836 for (auto& observer : observers_) |
| 4837 observer.DidGetIgnoredUIEvent(); | 4837 observer.DidGetIgnoredUIEvent(); |
| 4838 } | 4838 } |
| 4839 | 4839 |
| 4840 void WebContentsImpl::RendererUnresponsive( | 4840 void WebContentsImpl::RendererUnresponsive( |
| 4841 RenderWidgetHostImpl* render_widget_host, | 4841 RenderWidgetHostImpl* render_widget_host) { |
| 4842 RendererUnresponsiveType type) { | |
| 4843 for (auto& observer : observers_) | 4842 for (auto& observer : observers_) |
| 4844 observer.OnRendererUnresponsive(render_widget_host); | 4843 observer.OnRendererUnresponsive(render_widget_host); |
| 4845 | 4844 |
| 4846 // Don't show hung renderer dialog for a swapped out RVH. | 4845 // Don't show hung renderer dialog for a swapped out RVH. |
| 4847 if (render_widget_host != GetRenderViewHost()->GetWidget()) | 4846 if (render_widget_host != GetRenderViewHost()->GetWidget()) |
| 4848 return; | 4847 return; |
| 4849 | 4848 |
| 4850 if (ShouldIgnoreUnresponsiveRenderer()) | 4849 if (ShouldIgnoreUnresponsiveRenderer()) |
| 4851 return; | 4850 return; |
| 4852 | 4851 |
| 4853 // Record histograms about the type of renderer hang. | |
| 4854 UMA_HISTOGRAM_ENUMERATION( | |
| 4855 "ChildProcess.HangRendererType", type, | |
| 4856 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_MAX); | |
| 4857 | |
| 4858 RenderFrameHostImpl* rfhi = | 4852 RenderFrameHostImpl* rfhi = |
| 4859 static_cast<RenderFrameHostImpl*>(GetRenderViewHost()->GetMainFrame()); | 4853 static_cast<RenderFrameHostImpl*>(GetRenderViewHost()->GetMainFrame()); |
| 4860 if (rfhi->is_waiting_for_beforeunload_ack()) { | 4854 if (rfhi->is_waiting_for_beforeunload_ack()) { |
| 4861 // If the hang is in the beforeunload handler, pretend the beforeunload | 4855 // If the hang is in the beforeunload handler, pretend the beforeunload |
| 4862 // listeners have all fired and allow the delegate to continue closing; | 4856 // listeners have all fired and allow the delegate to continue closing; |
| 4863 // the user will not have the option of cancelling the close. | 4857 // the user will not have the option of cancelling the close. |
| 4864 rfhi->SimulateBeforeUnloadAck(); | 4858 rfhi->SimulateBeforeUnloadAck(); |
| 4865 return; | 4859 return; |
| 4866 } | 4860 } |
| 4867 | 4861 |
| 4868 if (!GetRenderViewHost() || !GetRenderViewHost()->IsRenderViewLive()) | 4862 if (!GetRenderViewHost() || !GetRenderViewHost()->IsRenderViewLive()) |
| 4869 return; | 4863 return; |
| 4870 | 4864 |
| 4871 if (delegate_) { | 4865 if (delegate_) { |
| 4872 WebContentsUnresponsiveState unresponsive_state; | 4866 WebContentsUnresponsiveState unresponsive_state; |
| 4873 unresponsive_state.reason = type; | |
| 4874 unresponsive_state.outstanding_ack_count = | 4867 unresponsive_state.outstanding_ack_count = |
| 4875 render_widget_host->in_flight_event_count(); | 4868 render_widget_host->in_flight_event_count(); |
| 4876 unresponsive_state.outstanding_event_type = | 4869 unresponsive_state.outstanding_event_type = |
| 4877 render_widget_host->hang_monitor_event_type(); | 4870 render_widget_host->hang_monitor_event_type(); |
| 4878 unresponsive_state.last_event_type = render_widget_host->last_event_type(); | 4871 unresponsive_state.last_event_type = render_widget_host->last_event_type(); |
| 4879 delegate_->RendererUnresponsive(this, unresponsive_state); | 4872 delegate_->RendererUnresponsive(this, unresponsive_state); |
| 4880 } | 4873 } |
| 4881 } | 4874 } |
| 4882 | 4875 |
| 4883 void WebContentsImpl::RendererResponsive( | 4876 void WebContentsImpl::RendererResponsive( |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5413 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); | 5406 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); |
| 5414 if (!render_view_host) | 5407 if (!render_view_host) |
| 5415 continue; | 5408 continue; |
| 5416 render_view_host_set.insert(render_view_host); | 5409 render_view_host_set.insert(render_view_host); |
| 5417 } | 5410 } |
| 5418 for (RenderViewHost* render_view_host : render_view_host_set) | 5411 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5419 render_view_host->OnWebkitPreferencesChanged(); | 5412 render_view_host->OnWebkitPreferencesChanged(); |
| 5420 } | 5413 } |
| 5421 | 5414 |
| 5422 } // namespace content | 5415 } // namespace content |
| OLD | NEW |