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

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: Address feedback from creis@ and nasko@ 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..651c3590e50df1020770698e46d306bf1b358b2a 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -1029,6 +1029,17 @@ void RenderFrameHostManager::RenderProcessGone(SiteInstanceImpl* instance) {
GetRenderFrameProxyHost(instance)->set_render_frame_proxy_created(false);
}
+void RenderFrameHostManager::CancelPendingIfNecessary(
+ RenderFrameHostImpl* render_frame_host) {
+ if (render_frame_host == pending_render_frame_host_.get())
+ CancelPending();
+ else if (render_frame_host == speculative_render_frame_host_.get()) {
+ // TODO(nasko, clamy): This should just clean up the speculative RFH
+ // without canceling the request. See https://crbug.com/636119.
+ frame_tree_node_->ResetNavigationRequest(false);
+ }
+}
+
void RenderFrameHostManager::ActiveFrameCountIsZero(
SiteInstanceImpl* site_instance) {
// |site_instance| no longer contains any active RenderFrameHosts, so we don't
@@ -2136,6 +2147,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 +2206,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());
+ }
+ }
if (new_instance.get() != current_instance) {
TRACE_EVENT_INSTANT2(
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.h ('k') | content/browser/renderer_host/render_view_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698