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

Side by Side 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 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_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 477
478 RenderFrameHostImpl::~RenderFrameHostImpl() { 478 RenderFrameHostImpl::~RenderFrameHostImpl() {
479 // Destroying navigation handle may call into delegates/observers, 479 // Destroying navigation handle may call into delegates/observers,
480 // so we do it early while |this| object is still in a sane state. 480 // so we do it early while |this| object is still in a sane state.
481 navigation_handle_.reset(); 481 navigation_handle_.reset();
482 482
483 // Release the WebUI instances before all else as the WebUI may accesses the 483 // Release the WebUI instances before all else as the WebUI may accesses the
484 // RenderFrameHost during cleanup. 484 // RenderFrameHost during cleanup.
485 ClearAllWebUI(); 485 ClearAllWebUI();
486 486
487 SetLastCommittedSiteUrl(GURL());
488
487 GetProcess()->RemoveRoute(routing_id_); 489 GetProcess()->RemoveRoute(routing_id_);
488 g_routing_id_frame_map.Get().erase( 490 g_routing_id_frame_map.Get().erase(
489 RenderFrameHostID(GetProcess()->GetID(), routing_id_)); 491 RenderFrameHostID(GetProcess()->GetID(), routing_id_));
490 492
491 if (overlay_routing_token_) 493 if (overlay_routing_token_)
492 g_token_frame_map.Get().erase(*overlay_routing_token_); 494 g_token_frame_map.Get().erase(*overlay_routing_token_);
493 495
494 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 496 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
495 base::Bind(&NotifyRenderFrameDetachedOnIO, 497 base::Bind(&NotifyRenderFrameDetachedOnIO,
496 GetProcess()->GetID(), routing_id_)); 498 GetProcess()->GetID(), routing_id_));
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
1448 frame_tree_node()->DidStartLoading(true, was_loading); 1450 frame_tree_node()->DidStartLoading(true, was_loading);
1449 } 1451 }
1450 pending_commit_ = false; 1452 pending_commit_ = false;
1451 } 1453 }
1452 1454
1453 // Find the appropriate NavigationHandle for this navigation. 1455 // Find the appropriate NavigationHandle for this navigation.
1454 std::unique_ptr<NavigationHandleImpl> navigation_handle = 1456 std::unique_ptr<NavigationHandleImpl> navigation_handle =
1455 TakeNavigationHandleForCommit(validated_params); 1457 TakeNavigationHandleForCommit(validated_params);
1456 DCHECK(navigation_handle); 1458 DCHECK(navigation_handle);
1457 1459
1460 // Update the site url if the navigation was successful.
1461 if (validated_params.url_is_unreachable) {
1462 SetLastCommittedSiteUrl(GURL());
1463 } else {
1464 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.
1465 }
1466
1458 // PlzNavigate sends searchable form data in the BeginNavigation message 1467 // PlzNavigate sends searchable form data in the BeginNavigation message
1459 // while non-PlzNavigate sends it in the DidCommitProvisionalLoad message. 1468 // while non-PlzNavigate sends it in the DidCommitProvisionalLoad message.
1460 // Update |navigation_handle| if necessary. 1469 // Update |navigation_handle| if necessary.
1461 if (!IsBrowserSideNavigationEnabled() && 1470 if (!IsBrowserSideNavigationEnabled() &&
1462 !validated_params.searchable_form_url.is_empty()) { 1471 !validated_params.searchable_form_url.is_empty()) {
1463 navigation_handle->set_searchable_form_url( 1472 navigation_handle->set_searchable_form_url(
1464 validated_params.searchable_form_url); 1473 validated_params.searchable_form_url);
1465 navigation_handle->set_searchable_form_encoding( 1474 navigation_handle->set_searchable_form_encoding(
1466 validated_params.searchable_form_encoding); 1475 validated_params.searchable_form_encoding);
1467 1476
(...skipping 2451 matching lines...) Expand 10 before | Expand all | Expand 10 after
3919 false); // is_form_submission 3928 false); // is_form_submission
3920 } 3929 }
3921 3930
3922 void RenderFrameHostImpl::BeforeUnloadTimeout() { 3931 void RenderFrameHostImpl::BeforeUnloadTimeout() {
3923 if (render_view_host_->GetDelegate()->ShouldIgnoreUnresponsiveRenderer()) 3932 if (render_view_host_->GetDelegate()->ShouldIgnoreUnresponsiveRenderer())
3924 return; 3933 return;
3925 3934
3926 SimulateBeforeUnloadAck(); 3935 SimulateBeforeUnloadAck();
3927 } 3936 }
3928 3937
3938 void RenderFrameHostImpl::SetLastCommittedSiteUrl(const GURL& url) {
3939 GURL site_url = GURL();
3940
3941 // Only record the site url for http(s) schemes. In particular, do not record
3942 // site urls for data urls (eg. interstitials and error pages) and WebUIs.
3943 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.
3944 site_url = SiteInstance::GetSiteForURL(
3945 frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
3946 url);
3947 }
3948
3949 if (last_committed_site_url_ == site_url)
3950 return;
3951
3952 if (!last_committed_site_url_.is_empty()) {
3953 RenderProcessHostImpl::RemoveFrameWithSite(
3954 frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
3955 GetProcess(), last_committed_site_url_);
3956 }
3957
3958 last_committed_site_url_ = site_url;
3959
3960 if (!last_committed_site_url_.is_empty()) {
3961 RenderProcessHostImpl::AddFrameWithSite(
3962 frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
3963 GetProcess(), last_committed_site_url_);
3964 }
3965 }
3966
3929 #if defined(OS_ANDROID) 3967 #if defined(OS_ANDROID)
3930 3968
3931 class RenderFrameHostImpl::JavaInterfaceProvider 3969 class RenderFrameHostImpl::JavaInterfaceProvider
3932 : public service_manager::mojom::InterfaceProvider { 3970 : public service_manager::mojom::InterfaceProvider {
3933 public: 3971 public:
3934 using BindCallback = 3972 using BindCallback =
3935 base::Callback<void(const std::string&, mojo::ScopedMessagePipeHandle)>; 3973 base::Callback<void(const std::string&, mojo::ScopedMessagePipeHandle)>;
3936 3974
3937 JavaInterfaceProvider( 3975 JavaInterfaceProvider(
3938 const BindCallback& bind_callback, 3976 const BindCallback& bind_callback,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3983 } 4021 }
3984 4022
3985 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( 4023 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame(
3986 const std::string& interface_name, 4024 const std::string& interface_name,
3987 mojo::ScopedMessagePipeHandle pipe) { 4025 mojo::ScopedMessagePipeHandle pipe) {
3988 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); 4026 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe));
3989 } 4027 }
3990 #endif 4028 #endif
3991 4029
3992 } // namespace content 4030 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698