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

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

Issue 857213003: Refactor sudden termination (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) { 1094 for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) {
1095 if (view) 1095 if (view)
1096 view->WasUnOccluded(); 1096 view->WasUnOccluded();
1097 } 1097 }
1098 } 1098 }
1099 1099
1100 bool WebContentsImpl::NeedToFireBeforeUnload() { 1100 bool WebContentsImpl::NeedToFireBeforeUnload() {
1101 // TODO(creis): Should we fire even for interstitial pages? 1101 // TODO(creis): Should we fire even for interstitial pages?
1102 return WillNotifyDisconnection() && 1102 return WillNotifyDisconnection() &&
1103 !ShowingInterstitialPage() && 1103 !ShowingInterstitialPage() &&
1104 !static_cast<RenderViewHostImpl*>( 1104 !static_cast<RenderFrameHostImpl*>(
Charlie Reis 2015/01/23 06:01:32 We shouldn't need this cast. Just return RenderFr
clamy 2015/01/26 16:38:40 WebContentsImpl::GetMainFrame returns a RenderFram
Charlie Reis 2015/01/29 23:20:40 You can make WebContentsImpl::GetMainFrame return
1105 GetRenderViewHost())->SuddenTerminationAllowed(); 1105 GetMainFrame())->SuddenTerminationAllowed();
1106 } 1106 }
1107 1107
1108 void WebContentsImpl::DispatchBeforeUnload(bool for_cross_site_transition) { 1108 void WebContentsImpl::DispatchBeforeUnload(bool for_cross_site_transition) {
1109 static_cast<RenderFrameHostImpl*>(GetMainFrame())->DispatchBeforeUnload( 1109 static_cast<RenderFrameHostImpl*>(GetMainFrame())->DispatchBeforeUnload(
1110 for_cross_site_transition); 1110 for_cross_site_transition);
1111 } 1111 }
1112 1112
1113 void WebContentsImpl::Stop() { 1113 void WebContentsImpl::Stop() {
1114 GetRenderManager()->Stop(); 1114 GetRenderManager()->Stop();
1115 FOR_EACH_OBSERVER(WebContentsObserver, observers_, NavigationStopped()); 1115 FOR_EACH_OBSERVER(WebContentsObserver, observers_, NavigationStopped());
(...skipping 2902 matching lines...) Expand 10 before | Expand all | Expand 10 after
4018 // Ignore renderer unresponsive event if debugger is attached to the tab 4018 // Ignore renderer unresponsive event if debugger is attached to the tab
4019 // since the event may be a result of the renderer sitting on a breakpoint. 4019 // since the event may be a result of the renderer sitting on a breakpoint.
4020 // See http://crbug.com/65458 4020 // See http://crbug.com/65458
4021 if (DevToolsAgentHost::IsDebuggerAttached(this)) 4021 if (DevToolsAgentHost::IsDebuggerAttached(this))
4022 return; 4022 return;
4023 4023
4024 if (rfhi->is_waiting_for_beforeunload_ack() || 4024 if (rfhi->is_waiting_for_beforeunload_ack() ||
4025 rfhi->IsWaitingForUnloadACK()) { 4025 rfhi->IsWaitingForUnloadACK()) {
4026 // Hang occurred while firing the beforeunload/unload handler. 4026 // Hang occurred while firing the beforeunload/unload handler.
4027 // Pretend the handler fired so tab closing continues as if it had. 4027 // Pretend the handler fired so tab closing continues as if it had.
4028 rvhi->set_sudden_termination_allowed(true); 4028 rfhi->set_override_sudden_termination_status(true);
4029 4029
4030 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer()) 4030 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer())
4031 return; 4031 return;
4032 4032
4033 // If the tab hangs in the beforeunload/unload handler there's really 4033 // If the tab hangs in the beforeunload/unload handler there's really
4034 // nothing we can do to recover. If the hang is in the beforeunload handler, 4034 // nothing we can do to recover. If the hang is in the beforeunload handler,
4035 // pretend the beforeunload listeners have all fired and allow the delegate 4035 // pretend the beforeunload listeners have all fired and allow the delegate
4036 // to continue closing; the user will not have the option of cancelling the 4036 // to continue closing; the user will not have the option of cancelling the
4037 // close. Otherwise, pretend the unload listeners have all fired and close 4037 // close. Otherwise, pretend the unload listeners have all fired and close
4038 // the tab. 4038 // the tab.
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
4440 node->render_manager()->ResumeResponseDeferredAtStart(); 4440 node->render_manager()->ResumeResponseDeferredAtStart();
4441 } 4441 }
4442 4442
4443 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4443 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4444 force_disable_overscroll_content_ = force_disable; 4444 force_disable_overscroll_content_ = force_disable;
4445 if (view_) 4445 if (view_)
4446 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4446 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4447 } 4447 }
4448 4448
4449 } // namespace content 4449 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698