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

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: Moved state tracking to RFH 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 cross_process_frame_connector_(NULL), 143 cross_process_frame_connector_(NULL),
144 render_frame_proxy_host_(NULL), 144 render_frame_proxy_host_(NULL),
145 frame_tree_(frame_tree), 145 frame_tree_(frame_tree),
146 frame_tree_node_(frame_tree_node), 146 frame_tree_node_(frame_tree_node),
147 routing_id_(routing_id), 147 routing_id_(routing_id),
148 render_frame_created_(false), 148 render_frame_created_(false),
149 navigations_suspended_(false), 149 navigations_suspended_(false),
150 is_waiting_for_beforeunload_ack_(false), 150 is_waiting_for_beforeunload_ack_(false),
151 unload_ack_is_for_navigation_(false), 151 unload_ack_is_for_navigation_(false),
152 is_loading_(false), 152 is_loading_(false),
153 pending_commit_(false),
153 accessibility_reset_token_(0), 154 accessibility_reset_token_(0),
154 accessibility_reset_count_(0), 155 accessibility_reset_count_(0),
155 no_create_browser_accessibility_manager_for_testing_(false), 156 no_create_browser_accessibility_manager_for_testing_(false),
156 weak_ptr_factory_(this) { 157 weak_ptr_factory_(this) {
157 bool is_swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT); 158 bool is_swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT);
158 bool hidden = !!(flags & CREATE_RF_HIDDEN); 159 bool hidden = !!(flags & CREATE_RF_HIDDEN);
159 frame_tree_->RegisterRenderFrameHost(this); 160 frame_tree_->RegisterRenderFrameHost(this);
160 GetProcess()->AddRoute(routing_id_, this); 161 GetProcess()->AddRoute(routing_id_, this);
161 g_routing_id_frame_map.Get().insert(std::make_pair( 162 g_routing_id_frame_map.Get().insert(std::make_pair(
162 RenderFrameHostID(GetProcess()->GetID(), routing_id_), 163 RenderFrameHostID(GetProcess()->GetID(), routing_id_),
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 // filenames it can't access in a future session restore. 833 // filenames it can't access in a future session restore.
833 if (!render_view_host_->CanAccessFilesOfPageState( 834 if (!render_view_host_->CanAccessFilesOfPageState(
834 validated_params.page_state)) { 835 validated_params.page_state)) {
835 bad_message::ReceivedBadMessage( 836 bad_message::ReceivedBadMessage(
836 GetProcess(), bad_message::RFH_CAN_ACCESS_FILES_OF_PAGE_STATE); 837 GetProcess(), bad_message::RFH_CAN_ACCESS_FILES_OF_PAGE_STATE);
837 return; 838 return;
838 } 839 }
839 840
840 accessibility_reset_count_ = 0; 841 accessibility_reset_count_ = 0;
841 frame_tree_node()->navigator()->DidNavigate(this, validated_params); 842 frame_tree_node()->navigator()->DidNavigate(this, validated_params);
843
844 // PlzNavigate
845 // Check that a commit is expected.
846 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
847 switches::kEnableBrowserSideNavigation)) {
848 DCHECK(pending_commit_);
Charlie Reis 2015/04/07 17:04:47 This doesn't seem right to me. If the renderer pr
clamy 2015/04/08 11:56:23 I think we want to inform the browser that we're d
Charlie Reis 2015/04/08 16:45:27 Ok, so the renderer will tell the browser via Begi
clamy 2015/04/10 14:40:15 No that it is not implemented yet. We do not curre
Charlie Reis 2015/04/10 23:04:01 Ok. If you're expecting this check to fail, pleas
clamy 2015/04/14 14:14:16 Considering that the DCHECK may fail for a certain
849 pending_commit_ = false;
850 }
842 } 851 }
843 852
844 void RenderFrameHostImpl::OnDidDropNavigation() { 853 void RenderFrameHostImpl::OnDidDropNavigation() {
845 // At the end of Navigate(), the delegate's DidStartLoading is called to force 854 // At the end of Navigate(), the delegate's DidStartLoading is called to force
846 // the spinner to start, even if the renderer didn't yet begin the load. If it 855 // the spinner to start, even if the renderer didn't yet begin the load. If it
847 // turns out that the renderer dropped the navigation, we need to turn off the 856 // turns out that the renderer dropped the navigation, we need to turn off the
848 // spinner. 857 // spinner.
849 delegate_->DidStopLoading(); 858 delegate_->DidStopLoading();
850 } 859 }
851 860
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 replication_state = proxy->frame_tree_node()->current_replication_state(); 940 replication_state = proxy->frame_tree_node()->current_replication_state();
932 } 941 }
933 942
934 if (IsRenderFrameLive()) { 943 if (IsRenderFrameLive()) {
935 Send(new FrameMsg_SwapOut(routing_id_, proxy_routing_id, is_loading, 944 Send(new FrameMsg_SwapOut(routing_id_, proxy_routing_id, is_loading,
936 replication_state)); 945 replication_state));
937 } 946 }
938 947
939 if (!GetParent()) 948 if (!GetParent())
940 delegate_->SwappedOut(this); 949 delegate_->SwappedOut(this);
950
951 // PlzNavigate
952 // A commit is no longer expected as the frame is swapped out.
Charlie Reis 2015/04/07 17:04:47 I don't understand how this would happen. When wo
clamy 2015/04/08 11:56:23 If the current RFH was supposed to commit a naviga
Charlie Reis 2015/04/08 16:45:27 I thought that the DidCommitProvisionalLoad IPC wa
clamy 2015/04/10 14:40:15 No the DidCommitProvisionalLoad IPC is sent when t
Charlie Reis 2015/04/10 23:04:01 Oh. Wouldn't all sorts of things potentially canc
clamy 2015/04/14 14:14:16 Good point. I removed the DCHECK, and I wont reset
953 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
954 switches::kEnableBrowserSideNavigation)) {
955 pending_commit_ = false;
956 }
941 } 957 }
942 958
943 void RenderFrameHostImpl::OnBeforeUnloadACK( 959 void RenderFrameHostImpl::OnBeforeUnloadACK(
944 bool proceed, 960 bool proceed,
945 const base::TimeTicks& renderer_before_unload_start_time, 961 const base::TimeTicks& renderer_before_unload_start_time,
946 const base::TimeTicks& renderer_before_unload_end_time) { 962 const base::TimeTicks& renderer_before_unload_end_time) {
947 TRACE_EVENT_ASYNC_END0( 963 TRACE_EVENT_ASYNC_END0(
948 "navigation", "RenderFrameHostImpl::BeforeUnload", this); 964 "navigation", "RenderFrameHostImpl::BeforeUnload", this);
949 DCHECK(!GetParent()); 965 DCHECK(!GetParent());
950 // If this renderer navigated while the beforeunload request was in flight, we 966 // If this renderer navigated while the beforeunload request was in flight, we
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 const ResourceResponseHead head = response ? 1723 const ResourceResponseHead head = response ?
1708 response->head : ResourceResponseHead(); 1724 response->head : ResourceResponseHead();
1709 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, 1725 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params,
1710 request_params)); 1726 request_params));
1711 // TODO(clamy): Check if we should start the throbber for non javascript urls 1727 // TODO(clamy): Check if we should start the throbber for non javascript urls
1712 // here. 1728 // here.
1713 1729
1714 // TODO(clamy): Release the stream handle once the renderer has finished 1730 // TODO(clamy): Release the stream handle once the renderer has finished
1715 // reading it. 1731 // reading it.
1716 stream_handle_ = body.Pass(); 1732 stream_handle_ = body.Pass();
1733 pending_commit_ = true;
1717 } 1734 }
1718 1735
1719 void RenderFrameHostImpl::SetUpMojoIfNeeded() { 1736 void RenderFrameHostImpl::SetUpMojoIfNeeded() {
1720 if (service_registry_.get()) 1737 if (service_registry_.get())
1721 return; 1738 return;
1722 1739
1723 service_registry_.reset(new ServiceRegistryImpl()); 1740 service_registry_.reset(new ServiceRegistryImpl());
1724 if (!GetProcess()->GetServiceRegistry()) 1741 if (!GetProcess()->GetServiceRegistry())
1725 return; 1742 return;
1726 1743
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 return; 1972 return;
1956 1973
1957 permission_manager->RegisterPermissionUsage( 1974 permission_manager->RegisterPermissionUsage(
1958 PermissionType::GEOLOCATION, 1975 PermissionType::GEOLOCATION,
1959 GetLastCommittedURL().GetOrigin(), 1976 GetLastCommittedURL().GetOrigin(),
1960 frame_tree_node()->frame_tree()->GetMainFrame() 1977 frame_tree_node()->frame_tree()->GetMainFrame()
1961 ->GetLastCommittedURL().GetOrigin()); 1978 ->GetLastCommittedURL().GetOrigin());
1962 } 1979 }
1963 1980
1964 } // namespace content 1981 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698