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

Unified Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 857213003: Refactor sudden termination (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nits Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_view_host_impl.cc
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 2be0fc0877e8dc3c3de566d90418b998ee416749..455b0f8285f80c319a343e8f6287ef72987557b3 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -125,6 +125,19 @@ void DismissVirtualKeyboardTask() {
}
#endif
+// Enable sudden termination for the current RenderFrameHost of
+// |frame_tree_node| if the ID of its SiteInstance is |site_instance_id|. Used
+// with FrameTree::ForEach.
+bool EnableSuddenTermination(int32 site_instance_id,
+ FrameTreeNode* frame_tree_node) {
+ if (frame_tree_node->current_frame_host()->GetSiteInstance()->GetId()
+ == site_instance_id) {
+ frame_tree_node->current_frame_host()
+ ->set_override_sudden_termination_status(true);
+ }
+ return true;
+}
+
} // namespace
// static
@@ -183,7 +196,6 @@ RenderViewHostImpl::RenderViewHostImpl(
run_modal_reply_msg_(NULL),
run_modal_opener_id_(MSG_ROUTING_NONE),
is_waiting_for_close_ack_(false),
- sudden_termination_allowed_(false),
render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING),
virtual_keyboard_requested_(false),
is_focused_element_editable_(false),
@@ -555,7 +567,10 @@ void RenderViewHostImpl::ClosePageIgnoringUnloadEvents() {
StopHangMonitorTimeout();
is_waiting_for_close_ack_ = false;
- sudden_termination_allowed_ = true;
+ // Enable sudden termination for all RenderFrameHosts in the FrameTree.
+ FrameTree* frame_tree = static_cast<RenderFrameHostImpl*>(GetMainFrame())
+ ->frame_tree_node()->frame_tree();
+ frame_tree->ForEach(base::Bind(&EnableSuddenTermination, instance_->GetId()));
delegate_->Close(this);
}
@@ -846,11 +861,6 @@ void RenderViewHostImpl::LoadStateChanged(
delegate_->LoadStateChanged(url, load_state, upload_position, upload_size);
}
-bool RenderViewHostImpl::SuddenTerminationAllowed() const {
- return sudden_termination_allowed_ ||
- GetProcess()->SuddenTerminationAllowed();
-}
-
///////////////////////////////////////////////////////////////////////////////
// RenderViewHostImpl, IPC message handlers:
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.h ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698