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

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

Issue 475783002: PlzNavigate: add cancel navigation logic for uncommitted requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ignores commits of stale navigation requests Created 6 years, 4 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 navigation_request_.reset(new NavigationRequest( 574 navigation_request_.reset(new NavigationRequest(
575 info, frame_tree_node_->frame_tree_node_id())); 575 info, frame_tree_node_->frame_tree_node_id()));
576 navigation_request_->BeginNavigation(params.request_body); 576 navigation_request_->BeginNavigation(params.request_body);
577 } 577 }
578 578
579 // PlzNavigate 579 // PlzNavigate
580 void RenderFrameHostManager::CommitNavigation( 580 void RenderFrameHostManager::CommitNavigation(
581 const NavigationBeforeCommitInfo& info) { 581 const NavigationBeforeCommitInfo& info) {
582 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( 582 CHECK(CommandLine::ForCurrentProcess()->HasSwitch(
583 switches::kEnableBrowserSideNavigation)); 583 switches::kEnableBrowserSideNavigation));
584 DCHECK(navigation_request_.get());
585 // Ignores navigation commits if the request ID doesn't match the current
586 // active request.
587 if (navigation_request_->navigation_request_id() !=
588 info.navigation_request_id) {
589 return;
590 }
591
584 // Pick the right RenderFrameHost to commit the navigation. 592 // Pick the right RenderFrameHost to commit the navigation.
585 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); 593 SiteInstance* current_instance = render_frame_host_->GetSiteInstance();
586 // TODO(clamy): Replace the default values by the right ones. This may require 594 // TODO(clamy): Replace the default values by the right ones. This may require
587 // some storing in RequestNavigation. 595 // some storing in RequestNavigation.
588 SiteInstance* new_instance = GetSiteInstanceForNavigation( 596 SiteInstance* new_instance = GetSiteInstanceForNavigation(
589 info.navigation_url, 597 info.navigation_url,
590 NULL, 598 NULL,
591 navigation_request_->info().navigation_params.transition_type, 599 navigation_request_->info().navigation_params.transition_type,
592 false, 600 false,
593 false); 601 false);
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 void RenderFrameHostManager::DeleteRenderFrameProxyHost( 1658 void RenderFrameHostManager::DeleteRenderFrameProxyHost(
1651 SiteInstance* instance) { 1659 SiteInstance* instance) {
1652 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); 1660 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId());
1653 if (iter != proxy_hosts_.end()) { 1661 if (iter != proxy_hosts_.end()) {
1654 delete iter->second; 1662 delete iter->second;
1655 proxy_hosts_.erase(iter); 1663 proxy_hosts_.erase(iter);
1656 } 1664 }
1657 } 1665 }
1658 1666
1659 } // namespace content 1667 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698