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

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: Addressed Nasko's comments 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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 params.url : frame_tree_node_->frame_tree()->root()->current_url(); 564 params.url : frame_tree_node_->frame_tree()->root()->current_url();
565 info.is_main_frame = frame_tree_node_->IsMainFrame(); 565 info.is_main_frame = frame_tree_node_->IsMainFrame();
566 info.parent_is_main_frame = !frame_tree_node_->parent() ? 566 info.parent_is_main_frame = !frame_tree_node_->parent() ?
567 false : frame_tree_node_->parent()->IsMainFrame(); 567 false : frame_tree_node_->parent()->IsMainFrame();
568 info.is_showing = GetRenderWidgetHostView()->IsShowing(); 568 info.is_showing = GetRenderWidgetHostView()->IsShowing();
569 569
570 // TODO(clamy): Check if the current RFH should be initialized (in case it has 570 // TODO(clamy): Check if the current RFH should be initialized (in case it has
571 // crashed) not to display a sad tab while navigating. 571 // crashed) not to display a sad tab while navigating.
572 // TODO(clamy): Spawn a speculative renderer process if we do not have one to 572 // TODO(clamy): Spawn a speculative renderer process if we do not have one to
573 // use for the navigation. 573 // use for the navigation.
574
575 // The previous existing NavigationRequest instance will be destroyed at this
576 // point, which might cause the cancellation of that request.
574 navigation_request_.reset(new NavigationRequest( 577 navigation_request_.reset(new NavigationRequest(
575 info, frame_tree_node_->frame_tree_node_id())); 578 info, frame_tree_node_->frame_tree_node_id()));
576 navigation_request_->BeginNavigation(params.request_body); 579 navigation_request_->BeginNavigation(params.request_body);
577 } 580 }
578 581
579 // PlzNavigate 582 // PlzNavigate
580 void RenderFrameHostManager::CommitNavigation( 583 void RenderFrameHostManager::CommitNavigation(
581 const NavigationBeforeCommitInfo& info) { 584 const NavigationBeforeCommitInfo& info) {
582 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( 585 CHECK(CommandLine::ForCurrentProcess()->HasSwitch(
583 switches::kEnableBrowserSideNavigation)); 586 switches::kEnableBrowserSideNavigation));
587 DCHECK(navigation_request_.get());
588 // Ignores navigation commits if the request ID doesn't match the current
589 // active request.
590 if (navigation_request_->navigation_request_id() !=
591 info.navigation_request_id) {
592 return;
593 }
594
584 // Pick the right RenderFrameHost to commit the navigation. 595 // Pick the right RenderFrameHost to commit the navigation.
585 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); 596 SiteInstance* current_instance = render_frame_host_->GetSiteInstance();
586 // TODO(clamy): Replace the default values by the right ones. This may require 597 // TODO(clamy): Replace the default values by the right ones. This may require
587 // some storing in RequestNavigation. 598 // some storing in RequestNavigation.
588 SiteInstance* new_instance = GetSiteInstanceForNavigation( 599 SiteInstance* new_instance = GetSiteInstanceForNavigation(
589 info.navigation_url, 600 info.navigation_url,
590 NULL, 601 NULL,
591 navigation_request_->info().navigation_params.transition_type, 602 navigation_request_->info().navigation_params.transition_type,
592 false, 603 false,
593 false); 604 false);
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 void RenderFrameHostManager::DeleteRenderFrameProxyHost( 1661 void RenderFrameHostManager::DeleteRenderFrameProxyHost(
1651 SiteInstance* instance) { 1662 SiteInstance* instance) {
1652 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); 1663 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId());
1653 if (iter != proxy_hosts_.end()) { 1664 if (iter != proxy_hosts_.end()) {
1654 delete iter->second; 1665 delete iter->second;
1655 proxy_hosts_.erase(iter); 1666 proxy_hosts_.erase(iter);
1656 } 1667 }
1657 } 1668 }
1658 1669
1659 } // namespace content 1670 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698