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

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

Issue 2724203004: Test run for https://codereview.chromium.org/2725993002/ with the timer intentionally broken. (Closed)
Patch Set: Created 3 years, 9 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
« 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after
2412 2412
2413 bool WebContentsImpl::IsOverridingUserAgent() { 2413 bool WebContentsImpl::IsOverridingUserAgent() {
2414 return GetController().GetVisibleEntry() && 2414 return GetController().GetVisibleEntry() &&
2415 GetController().GetVisibleEntry()->GetIsOverridingUserAgent(); 2415 GetController().GetVisibleEntry()->GetIsOverridingUserAgent();
2416 } 2416 }
2417 2417
2418 bool WebContentsImpl::IsJavaScriptDialogShowing() const { 2418 bool WebContentsImpl::IsJavaScriptDialogShowing() const {
2419 return is_showing_javascript_dialog_; 2419 return is_showing_javascript_dialog_;
2420 } 2420 }
2421 2421
2422 bool WebContentsImpl::ShouldIgnoreUnresponsiveRenderer() {
2423 // Ignore unresponsive renderers if the debugger is attached to them since the
2424 // unresponsiveness might be a result of the renderer sitting on a breakpoint.
2425 //
2426 // TODO(pfeldman): Fix this to only return true if the renderer is *actually*
2427 // sitting on a breakpoint. https://crbug.com/684202
2428 return DevToolsAgentHost::IsDebuggerAttached(this);
2429 }
2430
2422 AccessibilityMode WebContentsImpl::GetAccessibilityMode() const { 2431 AccessibilityMode WebContentsImpl::GetAccessibilityMode() const {
2423 return accessibility_mode_; 2432 return accessibility_mode_;
2424 } 2433 }
2425 2434
2426 void WebContentsImpl::AccessibilityEventReceived( 2435 void WebContentsImpl::AccessibilityEventReceived(
2427 const std::vector<AXEventNotificationDetails>& details) { 2436 const std::vector<AXEventNotificationDetails>& details) {
2428 for (auto& observer : observers_) 2437 for (auto& observer : observers_)
2429 observer.AccessibilityEventReceived(details); 2438 observer.AccessibilityEventReceived(details);
2430 } 2439 }
2431 2440
(...skipping 2402 matching lines...) Expand 10 before | Expand all | Expand 10 after
4834 void WebContentsImpl::RendererUnresponsive( 4843 void WebContentsImpl::RendererUnresponsive(
4835 RenderWidgetHostImpl* render_widget_host, 4844 RenderWidgetHostImpl* render_widget_host,
4836 RendererUnresponsiveType type) { 4845 RendererUnresponsiveType type) {
4837 for (auto& observer : observers_) 4846 for (auto& observer : observers_)
4838 observer.OnRendererUnresponsive(render_widget_host); 4847 observer.OnRendererUnresponsive(render_widget_host);
4839 4848
4840 // Don't show hung renderer dialog for a swapped out RVH. 4849 // Don't show hung renderer dialog for a swapped out RVH.
4841 if (render_widget_host != GetRenderViewHost()->GetWidget()) 4850 if (render_widget_host != GetRenderViewHost()->GetWidget())
4842 return; 4851 return;
4843 4852
4844 RenderFrameHostImpl* rfhi = 4853 if (ShouldIgnoreUnresponsiveRenderer())
4845 static_cast<RenderFrameHostImpl*>(GetRenderViewHost()->GetMainFrame());
4846
4847 // Ignore renderer unresponsive event if debugger is attached to the tab
4848 // since the event may be a result of the renderer sitting on a breakpoint.
4849 // See http://crbug.com/65458
4850 if (DevToolsAgentHost::IsDebuggerAttached(this))
4851 return; 4854 return;
4852 4855
4853 // Record histograms about the type of renderer hang. 4856 // Record histograms about the type of renderer hang.
4854 UMA_HISTOGRAM_ENUMERATION( 4857 UMA_HISTOGRAM_ENUMERATION(
4855 "ChildProcess.HangRendererType", type, 4858 "ChildProcess.HangRendererType", type,
4856 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_MAX); 4859 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_MAX);
4857 4860
4858 // We might have been waiting for both beforeunload and unload ACK. 4861 RenderFrameHostImpl* rfhi =
4859 // Check if tab is to be unloaded first. 4862 static_cast<RenderFrameHostImpl*>(GetRenderViewHost()->GetMainFrame());
4860 if (rfhi->IsWaitingForUnloadACK()) {
4861 // Hang occurred while firing the unload handler.
4862 // Pretend the handler fired so tab closing continues as if it had.
4863 GetRenderViewHost()->set_sudden_termination_allowed(true);
4864
4865 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer())
4866 return;
4867
4868 // If the tab hangs in the unload handler there's really nothing we can do
4869 // to recover. Pretend the unload listeners have all fired and close
4870 // the tab.
4871 Close();
4872 return;
4873 }
4874
4875 if (rfhi->is_waiting_for_beforeunload_ack()) { 4863 if (rfhi->is_waiting_for_beforeunload_ack()) {
4876 // If the hang is in the beforeunload handler, pretend the beforeunload 4864 // If the hang is in the beforeunload handler, pretend the beforeunload
4877 // listeners have all fired and allow the delegate to continue closing; 4865 // listeners have all fired and allow the delegate to continue closing;
4878 // the user will not have the option of cancelling the close. 4866 // the user will not have the option of cancelling the close.
4879 rfhi->SimulateBeforeUnloadAck(); 4867 rfhi->SimulateBeforeUnloadAck();
4880 return; 4868 return;
4881 } 4869 }
4882 4870
4883 if (!GetRenderViewHost() || !GetRenderViewHost()->IsRenderViewLive()) 4871 if (!GetRenderViewHost() || !GetRenderViewHost()->IsRenderViewLive())
4884 return; 4872 return;
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
5431 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); 5419 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host);
5432 if (!render_view_host) 5420 if (!render_view_host)
5433 continue; 5421 continue;
5434 render_view_host_set.insert(render_view_host); 5422 render_view_host_set.insert(render_view_host);
5435 } 5423 }
5436 for (RenderViewHost* render_view_host : render_view_host_set) 5424 for (RenderViewHost* render_view_host : render_view_host_set)
5437 render_view_host->OnWebkitPreferencesChanged(); 5425 render_view_host->OnWebkitPreferencesChanged();
5438 } 5426 }
5439 5427
5440 } // namespace content 5428 } // namespace content
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