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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1759123002: Ensure RenderFrameHost & NavigationHandle are not destroyed during commit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 unload_ack_is_for_navigation_(false), 201 unload_ack_is_for_navigation_(false),
202 is_loading_(false), 202 is_loading_(false),
203 pending_commit_(false), 203 pending_commit_(false),
204 nav_entry_id_(0), 204 nav_entry_id_(0),
205 accessibility_reset_token_(0), 205 accessibility_reset_token_(0),
206 accessibility_reset_count_(0), 206 accessibility_reset_count_(0),
207 no_create_browser_accessibility_manager_for_testing_(false), 207 no_create_browser_accessibility_manager_for_testing_(false),
208 web_ui_type_(WebUI::kNoWebUI), 208 web_ui_type_(WebUI::kNoWebUI),
209 pending_web_ui_type_(WebUI::kNoWebUI), 209 pending_web_ui_type_(WebUI::kNoWebUI),
210 should_reuse_web_ui_(false), 210 should_reuse_web_ui_(false),
211 is_in_commit_(false),
211 weak_ptr_factory_(this) { 212 weak_ptr_factory_(this) {
212 bool is_swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT); 213 bool is_swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT);
213 bool hidden = !!(flags & CREATE_RF_HIDDEN); 214 bool hidden = !!(flags & CREATE_RF_HIDDEN);
214 frame_tree_->AddRenderViewHostRef(render_view_host_); 215 frame_tree_->AddRenderViewHostRef(render_view_host_);
215 GetProcess()->AddRoute(routing_id_, this); 216 GetProcess()->AddRoute(routing_id_, this);
216 g_routing_id_frame_map.Get().insert(std::make_pair( 217 g_routing_id_frame_map.Get().insert(std::make_pair(
217 RenderFrameHostID(GetProcess()->GetID(), routing_id_), 218 RenderFrameHostID(GetProcess()->GetID(), routing_id_),
218 this)); 219 this));
219 site_instance_->AddObserver(this); 220 site_instance_->AddObserver(this);
220 221
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 static_cast<InputRouterImpl*>(render_widget_host_->input_router()); 255 static_cast<InputRouterImpl*>(render_widget_host_->input_router());
255 ir->SetFrameTreeNodeId(frame_tree_node_->frame_tree_node_id()); 256 ir->SetFrameTreeNodeId(frame_tree_node_->frame_tree_node_id());
256 } 257 }
257 } 258 }
258 259
259 RenderFrameHostImpl::~RenderFrameHostImpl() { 260 RenderFrameHostImpl::~RenderFrameHostImpl() {
260 // Release the WebUI instances before all else as the WebUI may accesses the 261 // Release the WebUI instances before all else as the WebUI may accesses the
261 // RenderFrameHost during cleanup. 262 // RenderFrameHost during cleanup.
262 ClearAllWebUI(); 263 ClearAllWebUI();
263 264
265 CHECK(!is_in_commit_);
266
264 GetProcess()->RemoveRoute(routing_id_); 267 GetProcess()->RemoveRoute(routing_id_);
265 g_routing_id_frame_map.Get().erase( 268 g_routing_id_frame_map.Get().erase(
266 RenderFrameHostID(GetProcess()->GetID(), routing_id_)); 269 RenderFrameHostID(GetProcess()->GetID(), routing_id_));
267 270
268 site_instance_->RemoveObserver(this); 271 site_instance_->RemoveObserver(this);
269 272
270 if (delegate_ && render_frame_created_) 273 if (delegate_ && render_frame_created_)
271 delegate_->RenderFrameDeleted(this); 274 delegate_->RenderFrameDeleted(this);
272 275
273 bool is_active = IsRFHStateActive(rfh_state_); 276 bool is_active = IsRFHStateActive(rfh_state_);
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 // has not been notified about the start of the load yet. Do it now. 1081 // has not been notified about the start of the load yet. Do it now.
1079 if (!is_loading()) { 1082 if (!is_loading()) {
1080 bool was_loading = frame_tree_node()->frame_tree()->IsLoading(); 1083 bool was_loading = frame_tree_node()->frame_tree()->IsLoading();
1081 is_loading_ = true; 1084 is_loading_ = true;
1082 frame_tree_node()->DidStartLoading(true, was_loading); 1085 frame_tree_node()->DidStartLoading(true, was_loading);
1083 } 1086 }
1084 pending_commit_ = false; 1087 pending_commit_ = false;
1085 } 1088 }
1086 } 1089 }
1087 1090
1091 // TODO(clamy): Remove this once enough data has been gathered for
1092 // crbug.com/589365.
1093 is_in_commit_ = true;
1094 navigation_handle_->set_is_in_commit(true);
1095
1088 accessibility_reset_count_ = 0; 1096 accessibility_reset_count_ = 0;
1089 frame_tree_node()->navigator()->DidNavigate(this, validated_params); 1097 frame_tree_node()->navigator()->DidNavigate(this, validated_params);
1090 1098
1099 // TODO(clamy): Remove this once enough data has been gathered for
1100 // crbug.com/589365.
1101 is_in_commit_ = false;
1102 if (navigation_handle_.get())
nasko 2016/03/15 14:10:34 Shouldn't the handle be destroyed once we've commi
clamy 2016/03/15 14:16:16 No, hence the TODO in Navigator.
1103 navigation_handle_->set_is_in_commit(false);
1104
1091 // For a top-level frame, there are potential security concerns associated 1105 // For a top-level frame, there are potential security concerns associated
1092 // with displaying graphics from a previously loaded page after the URL in 1106 // with displaying graphics from a previously loaded page after the URL in
1093 // the omnibar has been changed. It is unappealing to clear the page 1107 // the omnibar has been changed. It is unappealing to clear the page
1094 // immediately, but if the renderer is taking a long time to issue any 1108 // immediately, but if the renderer is taking a long time to issue any
1095 // compositor output (possibly because of script deliberately creating this 1109 // compositor output (possibly because of script deliberately creating this
1096 // situation) then we clear it after a while anyway. 1110 // situation) then we clear it after a while anyway.
1097 // See https://crbug.com/497588. 1111 // See https://crbug.com/497588.
1098 if (frame_tree_node_->IsMainFrame() && GetView() && 1112 if (frame_tree_node_->IsMainFrame() && GetView() &&
1099 !validated_params.was_within_same_page) { 1113 !validated_params.was_within_same_page) {
1100 RenderWidgetHostImpl::From(GetView()->GetRenderWidgetHost()) 1114 RenderWidgetHostImpl::From(GetView()->GetRenderWidgetHost())
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after
2712 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame(); 2726 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame();
2713 if (!focused_frame_tree_node) 2727 if (!focused_frame_tree_node)
2714 return; 2728 return;
2715 RenderFrameHostImpl* focused_frame = 2729 RenderFrameHostImpl* focused_frame =
2716 focused_frame_tree_node->current_frame_host(); 2730 focused_frame_tree_node->current_frame_host();
2717 DCHECK(focused_frame); 2731 DCHECK(focused_frame);
2718 dst->focused_tree_id = focused_frame->GetAXTreeID(); 2732 dst->focused_tree_id = focused_frame->GetAXTreeID();
2719 } 2733 }
2720 2734
2721 } // namespace content 2735 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698