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

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

Issue 1048463004: PlzNavigate: track pending commits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments + rebase on top of 1088933003 Created 5 years, 8 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 cross_process_frame_connector_(NULL), 144 cross_process_frame_connector_(NULL),
145 render_frame_proxy_host_(NULL), 145 render_frame_proxy_host_(NULL),
146 frame_tree_(frame_tree), 146 frame_tree_(frame_tree),
147 frame_tree_node_(frame_tree_node), 147 frame_tree_node_(frame_tree_node),
148 routing_id_(routing_id), 148 routing_id_(routing_id),
149 render_frame_created_(false), 149 render_frame_created_(false),
150 navigations_suspended_(false), 150 navigations_suspended_(false),
151 is_waiting_for_beforeunload_ack_(false), 151 is_waiting_for_beforeunload_ack_(false),
152 unload_ack_is_for_navigation_(false), 152 unload_ack_is_for_navigation_(false),
153 is_loading_(false), 153 is_loading_(false),
154 pending_commit_(false),
154 accessibility_reset_token_(0), 155 accessibility_reset_token_(0),
155 accessibility_reset_count_(0), 156 accessibility_reset_count_(0),
156 no_create_browser_accessibility_manager_for_testing_(false), 157 no_create_browser_accessibility_manager_for_testing_(false),
157 weak_ptr_factory_(this) { 158 weak_ptr_factory_(this) {
158 bool is_swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT); 159 bool is_swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT);
159 bool hidden = !!(flags & CREATE_RF_HIDDEN); 160 bool hidden = !!(flags & CREATE_RF_HIDDEN);
160 frame_tree_->RegisterRenderFrameHost(this); 161 frame_tree_->RegisterRenderFrameHost(this);
161 GetProcess()->AddRoute(routing_id_, this); 162 GetProcess()->AddRoute(routing_id_, this);
162 g_routing_id_frame_map.Get().insert(std::make_pair( 163 g_routing_id_frame_map.Get().insert(std::make_pair(
163 RenderFrameHostID(GetProcess()->GetID(), routing_id_), 164 RenderFrameHostID(GetProcess()->GetID(), routing_id_),
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 // filenames it can't access in a future session restore. 836 // filenames it can't access in a future session restore.
836 if (!render_view_host_->CanAccessFilesOfPageState( 837 if (!render_view_host_->CanAccessFilesOfPageState(
837 validated_params.page_state)) { 838 validated_params.page_state)) {
838 bad_message::ReceivedBadMessage( 839 bad_message::ReceivedBadMessage(
839 GetProcess(), bad_message::RFH_CAN_ACCESS_FILES_OF_PAGE_STATE); 840 GetProcess(), bad_message::RFH_CAN_ACCESS_FILES_OF_PAGE_STATE);
840 return; 841 return;
841 } 842 }
842 843
843 accessibility_reset_count_ = 0; 844 accessibility_reset_count_ = 0;
844 frame_tree_node()->navigator()->DidNavigate(this, validated_params); 845 frame_tree_node()->navigator()->DidNavigate(this, validated_params);
846
847 // PlzNavigate
848 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
849 switches::kEnableBrowserSideNavigation)) {
850 pending_commit_ = false;
851 }
845 } 852 }
846 853
847 void RenderFrameHostImpl::OnDidDropNavigation() { 854 void RenderFrameHostImpl::OnDidDropNavigation() {
848 // At the end of Navigate(), the delegate's DidStartLoading is called to force 855 // At the end of Navigate(), the delegate's DidStartLoading is called to force
849 // the spinner to start, even if the renderer didn't yet begin the load. If it 856 // the spinner to start, even if the renderer didn't yet begin the load. If it
850 // turns out that the renderer dropped the navigation, we need to turn off the 857 // turns out that the renderer dropped the navigation, we need to turn off the
851 // spinner. 858 // spinner.
852 delegate_->DidStopLoading(); 859 delegate_->DidStopLoading();
853 } 860 }
854 861
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 const ResourceResponseHead head = response ? 1739 const ResourceResponseHead head = response ?
1733 response->head : ResourceResponseHead(); 1740 response->head : ResourceResponseHead();
1734 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, 1741 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params,
1735 request_params)); 1742 request_params));
1736 // TODO(clamy): Check if we should start the throbber for non javascript urls 1743 // TODO(clamy): Check if we should start the throbber for non javascript urls
1737 // here. 1744 // here.
1738 1745
1739 // TODO(clamy): Release the stream handle once the renderer has finished 1746 // TODO(clamy): Release the stream handle once the renderer has finished
1740 // reading it. 1747 // reading it.
1741 stream_handle_ = body.Pass(); 1748 stream_handle_ = body.Pass();
1749 pending_commit_ = true;
1742 } 1750 }
1743 1751
1744 void RenderFrameHostImpl::FailedNavigation( 1752 void RenderFrameHostImpl::FailedNavigation(
1745 const CommonNavigationParams& common_params, 1753 const CommonNavigationParams& common_params,
1746 const RequestNavigationParams& request_params, 1754 const RequestNavigationParams& request_params,
1747 bool has_stale_copy_in_cache, 1755 bool has_stale_copy_in_cache,
1748 int error_code) { 1756 int error_code) {
1749 // Get back to a clean state, in case a new navigation started without 1757 // Get back to a clean state, in case a new navigation started without
1750 // completing a RFH swap or unload handler. 1758 // completing a RFH swap or unload handler.
1751 SetState(RenderFrameHostImpl::STATE_DEFAULT); 1759 SetState(RenderFrameHostImpl::STATE_DEFAULT);
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
2001 return; 2009 return;
2002 2010
2003 permission_manager->RegisterPermissionUsage( 2011 permission_manager->RegisterPermissionUsage(
2004 PermissionType::GEOLOCATION, 2012 PermissionType::GEOLOCATION,
2005 GetLastCommittedURL().GetOrigin(), 2013 GetLastCommittedURL().GetOrigin(),
2006 frame_tree_node()->frame_tree()->GetMainFrame() 2014 frame_tree_node()->frame_tree()->GetMainFrame()
2007 ->GetLastCommittedURL().GetOrigin()); 2015 ->GetLastCommittedURL().GetOrigin());
2008 } 2016 }
2009 2017
2010 } // namespace content 2018 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698