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

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

Issue 789643005: PlzNavigate: make content unit tests work with browser side navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cancel-navigations
Patch Set: Now addressing failures due to speculative RFH Created 5 years, 11 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_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 // in progress. Sanity check this for http://crbug.com/276333. 273 // in progress. Sanity check this for http://crbug.com/276333.
274 CHECK(pending_render_frame_host_); 274 CHECK(pending_render_frame_host_);
275 275
276 // Unload handlers run in the background, so we should never get an 276 // Unload handlers run in the background, so we should never get an
277 // unresponsiveness warning for them. 277 // unresponsiveness warning for them.
278 CHECK(!render_frame_host_->IsWaitingForUnloadACK()); 278 CHECK(!render_frame_host_->IsWaitingForUnloadACK());
279 279
280 // If the tab becomes unresponsive during beforeunload while doing a 280 // If the tab becomes unresponsive during beforeunload while doing a
281 // cross-site navigation, proceed with the navigation. (This assumes that 281 // cross-site navigation, proceed with the navigation. (This assumes that
282 // the pending RenderFrameHost is still responsive.) 282 // the pending RenderFrameHost is still responsive.)
283 if (render_frame_host_->is_waiting_for_beforeunload_ack()) { 283 if (render_frame_host_->IsWaitingForBeforeUnloadACK()) {
284 // Haven't gotten around to starting the request, because we're still 284 // Haven't gotten around to starting the request, because we're still
285 // waiting for the beforeunload handler to finish. We'll pretend that it 285 // waiting for the beforeunload handler to finish. We'll pretend that it
286 // did finish, to let the navigation proceed. Note that there's a danger 286 // did finish, to let the navigation proceed. Note that there's a danger
287 // that the beforeunload handler will later finish and possibly return 287 // that the beforeunload handler will later finish and possibly return
288 // false (meaning the navigation should not proceed), but we'll ignore it 288 // false (meaning the navigation should not proceed), but we'll ignore it
289 // in this case because it took too long. 289 // in this case because it took too long.
290 if (pending_render_frame_host_->are_navigations_suspended()) { 290 if (pending_render_frame_host_->are_navigations_suspended()) {
291 pending_render_frame_host_->SetNavigationsSuspended( 291 pending_render_frame_host_->SetNavigationsSuspended(
292 false, base::TimeTicks::Now()); 292 false, base::TimeTicks::Now());
293 } 293 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 render_frame_host_->ClearPendingTransitionRequestData(); 425 render_frame_host_->ClearPendingTransitionRequestData();
426 } 426 }
427 427
428 void RenderFrameHostManager::DidNavigateFrame( 428 void RenderFrameHostManager::DidNavigateFrame(
429 RenderFrameHostImpl* render_frame_host, 429 RenderFrameHostImpl* render_frame_host,
430 bool was_caused_by_user_gesture) { 430 bool was_caused_by_user_gesture) {
431 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 431 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
432 switches::kEnableBrowserSideNavigation)) { 432 switches::kEnableBrowserSideNavigation)) {
433 if (render_frame_host == speculative_render_frame_host_.get()) { 433 if (render_frame_host == speculative_render_frame_host_.get()) {
434 CommitPending(); 434 CommitPending();
435 cross_navigation_pending_ = false;
nasko 2015/01/21 00:41:32 Shouldn't this flag be cleared in CommitPending it
clamy 2015/01/21 13:22:11 Done.
435 } else if (render_frame_host == render_frame_host_.get()) { 436 } else if (render_frame_host == render_frame_host_.get()) {
436 // TODO(carlosk): this code doesn't properly handle in-page navigation or 437 // TODO(carlosk): this code doesn't properly handle in-page navigation or
437 // interwoven navigation requests. 438 // interwoven navigation requests.
438 DCHECK(!speculative_render_frame_host_); 439 DCHECK(!speculative_render_frame_host_);
439 } else { 440 } else {
440 // No one else should be sending us a DidNavigate in this state. 441 // No one else should be sending us a DidNavigate in this state.
441 DCHECK(false); 442 DCHECK(false);
442 } 443 }
443 DCHECK(!speculative_render_frame_host_); 444 DCHECK(!speculative_render_frame_host_);
444 return; 445 return;
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 if (!navigation_rfh->IsRenderFrameLive()) { 733 if (!navigation_rfh->IsRenderFrameLive()) {
733 // Recreate the opener chain. 734 // Recreate the opener chain.
734 int opener_route_id = delegate_->CreateOpenerRenderViewsForRenderManager( 735 int opener_route_id = delegate_->CreateOpenerRenderViewsForRenderManager(
735 navigation_rfh->GetSiteInstance()); 736 navigation_rfh->GetSiteInstance());
736 if (!InitRenderView(navigation_rfh->render_view_host(), opener_route_id, 737 if (!InitRenderView(navigation_rfh->render_view_host(), opener_route_id,
737 MSG_ROUTING_NONE, frame_tree_node_->IsMainFrame())) { 738 MSG_ROUTING_NONE, frame_tree_node_->IsMainFrame())) {
738 return nullptr; 739 return nullptr;
739 } 740 }
740 } 741 }
741 742
743 cross_navigation_pending_ = navigation_rfh != render_frame_host_.get();
nasko 2015/01/21 00:41:32 Are we sure the returned RFH will actually start o
clamy 2015/01/21 13:22:11 No, this is also called by BeginNavigation, so at
742 return navigation_rfh; 744 return navigation_rfh;
743 } 745 }
744 746
745 // PlzNavigate 747 // PlzNavigate
746 void RenderFrameHostManager::CleanUpNavigation() { 748 void RenderFrameHostManager::CleanUpNavigation() {
747 if (speculative_render_frame_host_) 749 if (speculative_render_frame_host_)
748 DiscardUnusedFrame(UnsetSpeculativeRenderFrameHost()); 750 DiscardUnusedFrame(UnsetSpeculativeRenderFrameHost());
749 } 751 }
750 752
751 // PlzNavigate 753 // PlzNavigate
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 void RenderFrameHostManager::DeleteRenderFrameProxyHost( 1872 void RenderFrameHostManager::DeleteRenderFrameProxyHost(
1871 SiteInstance* instance) { 1873 SiteInstance* instance) {
1872 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); 1874 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId());
1873 if (iter != proxy_hosts_.end()) { 1875 if (iter != proxy_hosts_.end()) {
1874 delete iter->second; 1876 delete iter->second;
1875 proxy_hosts_.erase(iter); 1877 proxy_hosts_.erase(iter);
1876 } 1878 }
1877 } 1879 }
1878 1880
1879 } // namespace content 1881 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698