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

Unified Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 2226023003: Fix RenderView reuse issues after a pending RenderFrameHost dies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve conflicts Created 4 years, 4 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/frame_host/render_frame_host_manager.cc
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index 6e33a629383190e33f19f24dcca72a011c0106e7..b9d06d59cf7508453eff9aa460ab50a7aa0df303 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -1029,6 +1029,15 @@ void RenderFrameHostManager::RenderProcessGone(SiteInstanceImpl* instance) {
GetRenderFrameProxyHost(instance)->set_render_frame_proxy_created(false);
}
+void RenderFrameHostManager::CancelPendingIfNecessary(
Charlie Reis 2016/08/09 16:31:18 Drive-by: I just made CancelPending() public in ht
alexmos 2016/08/09 23:09:46 Done.
+ RenderFrameHostImpl* render_frame_host) {
+ if (render_frame_host == pending_render_frame_host_.get())
+ CancelPending();
+ else if (render_frame_host == speculative_render_frame_host_.get()) {
+ frame_tree_node_->ResetNavigationRequest(false);
alexmos 2016/08/08 23:59:02 Does this make sense in the PlzNavigate case? I f
nasko 2016/08/09 18:32:32 We shouldn't be cancelling the request if the spec
alexmos 2016/08/09 23:09:46 Done. Filed https://crbug.com/636119 and referenc
+ }
+}
+
void RenderFrameHostManager::ActiveFrameCountIsZero(
SiteInstanceImpl* site_instance) {
// |site_instance| no longer contains any active RenderFrameHosts, so we don't
@@ -2136,6 +2145,8 @@ void RenderFrameHostManager::CommitPending() {
if (is_main_frame) {
render_frame_host_->render_view_host()->set_main_frame_routing_id(
render_frame_host_->routing_id());
+ render_frame_host_->render_view_host()->set_is_active(true);
+ render_frame_host_->render_view_host()->set_is_swapped_out(false);
old_render_frame_host->render_view_host()->set_main_frame_routing_id(
MSG_ROUTING_NONE);
}
@@ -2193,9 +2204,15 @@ RenderFrameHostImpl* RenderFrameHostManager::UpdateStateForNavigate(
// different SiteInstance, we want to get back to normal and then navigate as
// usual. We will reuse the pending RFH below if it matches the destination
// SiteInstance.
- if (pending_render_frame_host_ &&
- pending_render_frame_host_->GetSiteInstance() != new_instance)
- CancelPending();
+ if (pending_render_frame_host_) {
+ if (pending_render_frame_host_->GetSiteInstance() != new_instance) {
+ CancelPending();
+ } else {
+ // When a pending RFH is reused, it should always be live, since it is
+ // cleared whenever a process dies.
+ CHECK(pending_render_frame_host_->IsRenderFrameLive());
nasko 2016/08/09 18:32:32 Should this be CHECK or DCHECK?
alexmos 2016/08/09 23:09:46 It'd be safer with a DCHECK, but I was thinking th
nasko 2016/08/09 23:49:15 Acknowledged.
+ }
+ }
if (new_instance.get() != current_instance) {
TRACE_EVENT_INSTANT2(

Powered by Google App Engine
This is Rietveld 408576698