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

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

Issue 2857213005: PlzNavigate: implement process reuse for ServiceWorkers (Closed)
Patch Set: Addressed comments + fixed tests Created 3 years, 7 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_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 55e731cda2a209abf59122cee740afa2cf320f40..f0397dfb883eb9b0dfa289fc3e2c5e4daa8c4269 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -484,6 +484,8 @@ RenderFrameHostImpl::~RenderFrameHostImpl() {
// RenderFrameHost during cleanup.
ClearAllWebUI();
+ SetLastCommittedSiteUrl(GURL());
+
GetProcess()->RemoveRoute(routing_id_);
g_routing_id_frame_map.Get().erase(
RenderFrameHostID(GetProcess()->GetID(), routing_id_));
@@ -1455,6 +1457,15 @@ void RenderFrameHostImpl::OnDidCommitProvisionalLoad(const IPC::Message& msg) {
TakeNavigationHandleForCommit(validated_params);
DCHECK(navigation_handle);
+ // Update the site url if the navigation was successful and the page is not an
+ // interstitial.
+ if (validated_params.url_is_unreachable ||
+ delegate_->GetAsInterstitialPage()) {
+ SetLastCommittedSiteUrl(GURL());
+ } else {
+ SetLastCommittedSiteUrl(validated_params.url);
+ }
+
// PlzNavigate sends searchable form data in the BeginNavigation message
// while non-PlzNavigate sends it in the DidCommitProvisionalLoad message.
// Update |navigation_handle| if necessary.
@@ -3926,6 +3937,32 @@ void RenderFrameHostImpl::BeforeUnloadTimeout() {
SimulateBeforeUnloadAck();
}
+void RenderFrameHostImpl::SetLastCommittedSiteUrl(const GURL& url) {
+ GURL site_url =
+ url.is_empty() ? GURL()
+ : SiteInstance::GetSiteForURL(frame_tree_node_->navigator()
+ ->GetController()
+ ->GetBrowserContext(),
+ url);
+
+ if (last_committed_site_url_ == site_url)
+ return;
+
+ if (!last_committed_site_url_.is_empty()) {
+ RenderProcessHostImpl::RemoveFrameWithSite(
+ frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
+ GetProcess(), last_committed_site_url_);
+ }
+
+ last_committed_site_url_ = site_url;
+
+ if (!last_committed_site_url_.is_empty()) {
+ RenderProcessHostImpl::AddFrameWithSite(
+ frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
+ GetProcess(), last_committed_site_url_);
+ }
+}
+
#if defined(OS_ANDROID)
class RenderFrameHostImpl::JavaInterfaceProvider
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698