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

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

Issue 701953006: PlzNavigate: Speculatively spawns a renderer process for navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: When navigating checks if the current WebUI can be reused. Created 6 years, 1 month 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/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 scoped_ptr<NavigationRequestInfo> info(new NavigationRequestInfo(params)); 731 scoped_ptr<NavigationRequestInfo> info(new NavigationRequestInfo(params));
732 732
733 info->first_party_for_cookies = 733 info->first_party_for_cookies =
734 frame_tree_node->IsMainFrame() 734 frame_tree_node->IsMainFrame()
735 ? navigation_request->common_params().url 735 ? navigation_request->common_params().url
736 : frame_tree_node->frame_tree()->root()->current_url(); 736 : frame_tree_node->frame_tree()->root()->current_url();
737 info->is_main_frame = frame_tree_node->IsMainFrame(); 737 info->is_main_frame = frame_tree_node->IsMainFrame();
738 info->parent_is_main_frame = !frame_tree_node->parent() ? 738 info->parent_is_main_frame = !frame_tree_node->parent() ?
739 false : frame_tree_node->parent()->IsMainFrame(); 739 false : frame_tree_node->parent()->IsMainFrame();
740 740
741 // TODO(clamy): Inform the RenderFrameHostManager that a navigation is about 741 navigation_request->BeginNavigation(info.Pass(), params.request_body);
742 // to begin, so that it can speculatively spawn a new renderer if needed.
743 742
744 navigation_request->BeginNavigation(info.Pass(), params.request_body); 743 frame_tree_node->render_manager()->BeginNavigation(params, common_params);
745 } 744 }
746 745
747 // PlzNavigate 746 // PlzNavigate
748 void NavigatorImpl::CommitNavigation(FrameTreeNode* frame_tree_node, 747 void NavigatorImpl::CommitNavigation(FrameTreeNode* frame_tree_node,
749 ResourceResponse* response, 748 ResourceResponse* response,
750 scoped_ptr<StreamHandle> body) { 749 scoped_ptr<StreamHandle> body) {
751 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( 750 CHECK(CommandLine::ForCurrentProcess()->HasSwitch(
752 switches::kEnableBrowserSideNavigation)); 751 switches::kEnableBrowserSideNavigation));
753 752
754 // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not 753 // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not
(...skipping 20 matching lines...) Expand all
775 render_frame_host->CommitNavigation(response, body.Pass(), 774 render_frame_host->CommitNavigation(response, body.Pass(),
776 navigation_request->common_params(), 775 navigation_request->common_params(),
777 navigation_request->commit_params()); 776 navigation_request->commit_params());
778 } 777 }
779 778
780 // PlzNavigate 779 // PlzNavigate
781 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { 780 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) {
782 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( 781 CHECK(CommandLine::ForCurrentProcess()->HasSwitch(
783 switches::kEnableBrowserSideNavigation)); 782 switches::kEnableBrowserSideNavigation));
784 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id()); 783 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id());
784 frame_tree_node->render_manager()->CancelNavigation();
785 } 785 }
786 786
787 void NavigatorImpl::LogResourceRequestTime( 787 void NavigatorImpl::LogResourceRequestTime(
788 base::TimeTicks timestamp, const GURL& url) { 788 base::TimeTicks timestamp, const GURL& url) {
789 if (navigation_data_ && navigation_data_->url_ == url) { 789 if (navigation_data_ && navigation_data_->url_ == url) {
790 navigation_data_->url_job_start_time_ = timestamp; 790 navigation_data_->url_job_start_time_ = timestamp;
791 UMA_HISTOGRAM_TIMES( 791 UMA_HISTOGRAM_TIMES(
792 "Navigation.TimeToURLJobStart", 792 "Navigation.TimeToURLJobStart",
793 navigation_data_->url_job_start_time_ - navigation_data_->start_time_); 793 navigation_data_->url_job_start_time_ - navigation_data_->start_time_);
794 } 794 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", 916 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted",
917 time_to_commit); 917 time_to_commit);
918 UMA_HISTOGRAM_TIMES( 918 UMA_HISTOGRAM_TIMES(
919 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", 919 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted",
920 time_to_network); 920 time_to_network);
921 } 921 }
922 navigation_data_.reset(); 922 navigation_data_.reset();
923 } 923 }
924 924
925 } // namespace content 925 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698