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

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

Issue 2857213005: PlzNavigate: implement process reuse for ServiceWorkers (Closed)
Patch Set: Fix compilation error 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 cd3a864d50d0e1a705539d3bfec517dfd39ce22b..8c9e1fdebec708e84adb729a2eb640d7848aea60 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,13 @@ void RenderFrameHostImpl::OnDidCommitProvisionalLoad(const IPC::Message& msg) {
TakeNavigationHandleForCommit(validated_params);
DCHECK(navigation_handle);
+ // Update the site url if the navigation was successful.
+ if (validated_params.url_is_unreachable) {
+ SetLastCommittedSiteUrl(GURL());
+ } else {
+ SetLastCommittedSiteUrl(navigation_handle->GetURL());
Charlie Reis 2017/05/23 07:29:13 We're using validated_params.url everywhere else h
clamy 2017/05/23 13:41:15 Done.
+ }
+
// 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 +3935,35 @@ void RenderFrameHostImpl::BeforeUnloadTimeout() {
SimulateBeforeUnloadAck();
}
+void RenderFrameHostImpl::SetLastCommittedSiteUrl(const GURL& url) {
+ GURL site_url = GURL();
+
+ // Only record the site url for http(s) schemes. In particular, do not record
+ // site urls for data urls (eg. interstitials and error pages) and WebUIs.
+ if (!url.is_empty() && url.SchemeIsHTTPOrHTTPS()) {
Charlie Reis 2017/05/23 07:29:13 This doesn't sound right to me. What's the reason
clamy 2017/05/23 13:41:15 The issue was with interstitials. There's a bad se
Charlie Reis 2017/05/24 04:50:54 Ah, thanks. That makes more sense.
+ site_url = 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

Powered by Google App Engine
This is Rietveld 408576698