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

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

Issue 2403813002: Do not create NavigationHandles for inactive RenderFrameHosts (Closed)
Patch Set: 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_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 base::TimeDelta::FromMinutes(10), 100); 1031 base::TimeDelta::FromMinutes(10), 100);
1032 } 1032 }
1033 // This message is only sent for top-level frames. TODO(avi): when frame tree 1033 // This message is only sent for top-level frames. TODO(avi): when frame tree
1034 // mirroring works correctly, add a check here to enforce it. 1034 // mirroring works correctly, add a check here to enforce it.
1035 delegate_->DocumentOnLoadCompleted(this); 1035 delegate_->DocumentOnLoadCompleted(this);
1036 } 1036 }
1037 1037
1038 void RenderFrameHostImpl::OnDidStartProvisionalLoad( 1038 void RenderFrameHostImpl::OnDidStartProvisionalLoad(
1039 const GURL& url, 1039 const GURL& url,
1040 const base::TimeTicks& navigation_start) { 1040 const base::TimeTicks& navigation_start) {
1041 if (!is_active())
nasko 2016/10/10 20:41:11 Do we want to add the same to all navigation relat
clamy 2016/10/11 10:34:27 Added a TODO.
1042 return;
1041 frame_tree_node_->navigator()->DidStartProvisionalLoad(this, url, 1043 frame_tree_node_->navigator()->DidStartProvisionalLoad(this, url,
1042 navigation_start); 1044 navigation_start);
1043 } 1045 }
1044 1046
1045 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( 1047 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError(
1046 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { 1048 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) {
1047 // TODO(clamy): Kill the renderer with RFH_FAIL_PROVISIONAL_LOAD_NO_HANDLE and 1049 // TODO(clamy): Kill the renderer with RFH_FAIL_PROVISIONAL_LOAD_NO_HANDLE and
1048 // return early if navigation_handle_ is null, once we prevent that case from 1050 // return early if navigation_handle_ is null, once we prevent that case from
1049 // happening in practice. 1051 // happening in practice.
1050 1052
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 GlobalFrameRoutingId RenderFrameHostImpl::GetGlobalFrameRoutingId() { 1293 GlobalFrameRoutingId RenderFrameHostImpl::GetGlobalFrameRoutingId() {
1292 return GlobalFrameRoutingId(GetProcess()->GetID(), GetRoutingID()); 1294 return GlobalFrameRoutingId(GetProcess()->GetID(), GetRoutingID());
1293 } 1295 }
1294 1296
1295 int RenderFrameHostImpl::GetEnabledBindings() { 1297 int RenderFrameHostImpl::GetEnabledBindings() {
1296 return render_view_host_->GetEnabledBindings(); 1298 return render_view_host_->GetEnabledBindings();
1297 } 1299 }
1298 1300
1299 void RenderFrameHostImpl::SetNavigationHandle( 1301 void RenderFrameHostImpl::SetNavigationHandle(
1300 std::unique_ptr<NavigationHandleImpl> navigation_handle) { 1302 std::unique_ptr<NavigationHandleImpl> navigation_handle) {
1303 CHECK(!navigation_handle || is_active());
1301 navigation_handle_ = std::move(navigation_handle); 1304 navigation_handle_ = std::move(navigation_handle);
1302
1303 // TODO(clamy): Remove this debug code once we understand better how we get to
1304 // the point of attempting to transfer a navigation from a RFH that is no
1305 // longer active.
1306 if (navigation_handle_ && !is_active())
1307 base::debug::DumpWithoutCrashing();
nasko 2016/10/10 20:41:10 Why not keep this around instead of the CHECK, in
clamy 2016/10/11 10:34:27 Done.
1308 } 1305 }
1309 1306
1310 std::unique_ptr<NavigationHandleImpl> 1307 std::unique_ptr<NavigationHandleImpl>
1311 RenderFrameHostImpl::PassNavigationHandleOwnership() { 1308 RenderFrameHostImpl::PassNavigationHandleOwnership() {
1312 DCHECK(!IsBrowserSideNavigationEnabled()); 1309 DCHECK(!IsBrowserSideNavigationEnabled());
1313 if (navigation_handle_) 1310 if (navigation_handle_)
1314 navigation_handle_->set_is_transferring(true); 1311 navigation_handle_->set_is_transferring(true);
1315 return std::move(navigation_handle_); 1312 return std::move(navigation_handle_);
1316 } 1313 }
1317 1314
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) { 1782 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) {
1786 // This message is only sent for top-level frames. TODO(avi): when frame tree 1783 // This message is only sent for top-level frames. TODO(avi): when frame tree
1787 // mirroring works correctly, add a check here to enforce it. 1784 // mirroring works correctly, add a check here to enforce it.
1788 delegate_->UpdateEncoding(this, encoding_name); 1785 delegate_->UpdateEncoding(this, encoding_name);
1789 } 1786 }
1790 1787
1791 void RenderFrameHostImpl::OnBeginNavigation( 1788 void RenderFrameHostImpl::OnBeginNavigation(
1792 const CommonNavigationParams& common_params, 1789 const CommonNavigationParams& common_params,
1793 const BeginNavigationParams& begin_params) { 1790 const BeginNavigationParams& begin_params) {
1794 CHECK(IsBrowserSideNavigationEnabled()); 1791 CHECK(IsBrowserSideNavigationEnabled());
1792 if (!is_active())
1793 return;
1795 CommonNavigationParams validated_params = common_params; 1794 CommonNavigationParams validated_params = common_params;
1796 GetProcess()->FilterURL(false, &validated_params.url); 1795 GetProcess()->FilterURL(false, &validated_params.url);
1797 frame_tree_node()->navigator()->OnBeginNavigation( 1796 frame_tree_node()->navigator()->OnBeginNavigation(
1798 frame_tree_node(), validated_params, begin_params); 1797 frame_tree_node(), validated_params, begin_params);
1799 } 1798 }
1800 1799
1801 void RenderFrameHostImpl::OnDispatchLoad() { 1800 void RenderFrameHostImpl::OnDispatchLoad() {
1802 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); 1801 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible());
1803 1802
1804 // Don't forward the load event if this RFH is pending deletion. This can 1803 // Don't forward the load event if this RFH is pending deletion. This can
(...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after
3107 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( 3106 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind(
3108 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); 3107 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this)));
3109 return web_bluetooth_service_.get(); 3108 return web_bluetooth_service_.get();
3110 } 3109 }
3111 3110
3112 void RenderFrameHostImpl::DeleteWebBluetoothService() { 3111 void RenderFrameHostImpl::DeleteWebBluetoothService() {
3113 web_bluetooth_service_.reset(); 3112 web_bluetooth_service_.reset();
3114 } 3113 }
3115 3114
3116 } // namespace content 3115 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698