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

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: Addressed Charlie's comments 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 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 } 1090 }
1091 } 1091 }
1092 1092
1093 void WebContentsImpl::WasUnOccluded() { 1093 void WebContentsImpl::WasUnOccluded() {
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() {
Charlie Reis 2015/01/29 23:20:41 I think I'm missing part of the picture of how thi
clamy 2015/02/02 16:16:27 To match what we were doing in 2, I now have Rende
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*>(
1105 GetRenderViewHost())->SuddenTerminationAllowed(); 1105 GetMainFrame())->SuddenTerminationAllowed();
Charlie Reis 2015/01/29 23:20:41 This doesn't seem quite right to me. What if the
clamy 2015/02/02 16:16:27 RenderFrameHostImpl::DispatchBeforeUnload skips ex
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 2912 matching lines...) Expand 10 before | Expand all | Expand 10 after
4028 // Ignore renderer unresponsive event if debugger is attached to the tab 4028 // Ignore renderer unresponsive event if debugger is attached to the tab
4029 // since the event may be a result of the renderer sitting on a breakpoint. 4029 // since the event may be a result of the renderer sitting on a breakpoint.
4030 // See http://crbug.com/65458 4030 // See http://crbug.com/65458
4031 if (DevToolsAgentHost::IsDebuggerAttached(this)) 4031 if (DevToolsAgentHost::IsDebuggerAttached(this))
4032 return; 4032 return;
4033 4033
4034 if (rfhi->IsWaitingForBeforeUnloadACK() || 4034 if (rfhi->IsWaitingForBeforeUnloadACK() ||
4035 rfhi->IsWaitingForUnloadACK()) { 4035 rfhi->IsWaitingForUnloadACK()) {
4036 // Hang occurred while firing the beforeunload/unload handler. 4036 // Hang occurred while firing the beforeunload/unload handler.
4037 // Pretend the handler fired so tab closing continues as if it had. 4037 // Pretend the handler fired so tab closing continues as if it had.
4038 rvhi->set_sudden_termination_allowed(true); 4038 rfhi->set_override_sudden_termination_status(true);
Charlie Reis 2015/01/29 23:20:42 Again, this is only the main frame. We'll eventua
clamy 2015/02/02 16:16:27 Done.
4039 4039
4040 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer()) 4040 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer())
4041 return; 4041 return;
4042 4042
4043 // If the tab hangs in the beforeunload/unload handler there's really 4043 // If the tab hangs in the beforeunload/unload handler there's really
4044 // nothing we can do to recover. If the hang is in the beforeunload handler, 4044 // nothing we can do to recover. If the hang is in the beforeunload handler,
4045 // pretend the beforeunload listeners have all fired and allow the delegate 4045 // pretend the beforeunload listeners have all fired and allow the delegate
4046 // to continue closing; the user will not have the option of cancelling the 4046 // to continue closing; the user will not have the option of cancelling the
4047 // close. Otherwise, pretend the unload listeners have all fired and close 4047 // close. Otherwise, pretend the unload listeners have all fired and close
4048 // the tab. 4048 // the tab.
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
4450 node->render_manager()->ResumeResponseDeferredAtStart(); 4450 node->render_manager()->ResumeResponseDeferredAtStart();
4451 } 4451 }
4452 4452
4453 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4453 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4454 force_disable_overscroll_content_ = force_disable; 4454 force_disable_overscroll_content_ = force_disable;
4455 if (view_) 4455 if (view_)
4456 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4456 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4457 } 4457 }
4458 4458
4459 } // namespace content 4459 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698