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

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

Issue 2383773002: Prevent RFH from attempting to transfer after it's been swapped out (Closed)
Patch Set: Addressed comments Created 4 years, 2 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_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 return; 625 return;
626 626
627 // Create a replacement proxy for the old RenderFrameHost. (There should not 627 // Create a replacement proxy for the old RenderFrameHost. (There should not
628 // be one yet.) This is done even if there are no active frames besides this 628 // be one yet.) This is done even if there are no active frames besides this
629 // one to simplify cleanup logic on the renderer side (see 629 // one to simplify cleanup logic on the renderer side (see
630 // https://crbug.com/568836 for motivation). 630 // https://crbug.com/568836 for motivation).
631 RenderFrameProxyHost* proxy = 631 RenderFrameProxyHost* proxy =
632 CreateRenderFrameProxyHost(old_render_frame_host->GetSiteInstance(), 632 CreateRenderFrameProxyHost(old_render_frame_host->GetSiteInstance(),
633 old_render_frame_host->render_view_host()); 633 old_render_frame_host->render_view_host());
634 634
635 // Reset any NavigationHandle in the RenderFrameHost. This will prevent any
636 // ongoing navigation from attempting to transfer.
637 old_render_frame_host->SetNavigationHandle(nullptr);
638
635 // Tell the old RenderFrameHost to swap out and be replaced by the proxy. 639 // Tell the old RenderFrameHost to swap out and be replaced by the proxy.
636 old_render_frame_host->SwapOut(proxy, true); 640 old_render_frame_host->SwapOut(proxy, true);
637 641
638 // SwapOut creates a RenderFrameProxy, so set the proxy to be initialized. 642 // SwapOut creates a RenderFrameProxy, so set the proxy to be initialized.
639 proxy->set_render_frame_proxy_created(true); 643 proxy->set_render_frame_proxy_created(true);
640 644
641 // |old_render_frame_host| will be deleted when its SwapOut ACK is received, 645 // |old_render_frame_host| will be deleted when its SwapOut ACK is received,
642 // or when the timer times out, or when the RFHM itself is deleted (whichever 646 // or when the timer times out, or when the RFHM itself is deleted (whichever
643 // comes first). 647 // comes first).
644 pending_delete_hosts_.push_back(std::move(old_render_frame_host)); 648 pending_delete_hosts_.push_back(std::move(old_render_frame_host));
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after
2668 resolved_url)) { 2672 resolved_url)) {
2669 DCHECK(!dest_instance || 2673 DCHECK(!dest_instance ||
2670 dest_instance == render_frame_host_->GetSiteInstance()); 2674 dest_instance == render_frame_host_->GetSiteInstance());
2671 return false; 2675 return false;
2672 } 2676 }
2673 2677
2674 return true; 2678 return true;
2675 } 2679 }
2676 2680
2677 } // namespace content 2681 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl.cc ('k') | content/browser/site_per_process_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698