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

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

Issue 818853005: Store NavigationEntryImpl data into NavigationRequest for later usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed respective TODOs. 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/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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 : frame_tree_node->frame_tree()->root()->current_url(); 776 : frame_tree_node->frame_tree()->root()->current_url();
777 info->is_main_frame = frame_tree_node->IsMainFrame(); 777 info->is_main_frame = frame_tree_node->IsMainFrame();
778 info->parent_is_main_frame = !frame_tree_node->parent() ? 778 info->parent_is_main_frame = !frame_tree_node->parent() ?
779 false : frame_tree_node->parent()->IsMainFrame(); 779 false : frame_tree_node->parent()->IsMainFrame();
780 780
781 // First start the request on the IO thread. 781 // First start the request on the IO thread.
782 navigation_request->BeginNavigation(info.Pass(), params.request_body); 782 navigation_request->BeginNavigation(info.Pass(), params.request_body);
783 783
784 // Then notify the RenderFrameHostManager so it can speculatively create a 784 // Then notify the RenderFrameHostManager so it can speculatively create a
785 // RenderFrameHost (and potentially a new renderer process) in parallel. 785 // RenderFrameHost (and potentially a new renderer process) in parallel.
786 frame_tree_node->render_manager()->BeginNavigation(common_params); 786 frame_tree_node->render_manager()->BeginNavigation(navigation_request);
787 } 787 }
788 788
789 // PlzNavigate 789 // PlzNavigate
790 void NavigatorImpl::CommitNavigation(FrameTreeNode* frame_tree_node, 790 void NavigatorImpl::CommitNavigation(FrameTreeNode* frame_tree_node,
791 ResourceResponse* response, 791 ResourceResponse* response,
792 scoped_ptr<StreamHandle> body) { 792 scoped_ptr<StreamHandle> body) {
793 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 793 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
794 switches::kEnableBrowserSideNavigation)); 794 switches::kEnableBrowserSideNavigation));
795 795
796 // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not 796 // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not
797 // commit; they leave the frame showing the previous page. 797 // commit; they leave the frame showing the previous page.
798 if (response->head.headers.get() && 798 if (response->head.headers.get() &&
799 (response->head.headers->response_code() == 204 || 799 (response->head.headers->response_code() == 204 ||
800 response->head.headers->response_code() == 205)) { 800 response->head.headers->response_code() == 205)) {
801 CancelNavigation(frame_tree_node); 801 CancelNavigation(frame_tree_node);
802 return; 802 return;
803 } 803 }
804 804
805 NavigationRequest* navigation_request = 805 NavigationRequest* navigation_request =
806 navigation_request_map_.get(frame_tree_node->frame_tree_node_id()); 806 navigation_request_map_.get(frame_tree_node->frame_tree_node_id());
807 DCHECK(navigation_request); 807 DCHECK(navigation_request);
808 808
809 // Select an appropriate renderer to commit the navigation. 809 // Select an appropriate renderer to commit the navigation.
810 RenderFrameHostImpl* render_frame_host = 810 RenderFrameHostImpl* render_frame_host =
811 frame_tree_node->render_manager()->GetFrameHostForNavigation( 811 frame_tree_node->render_manager()->GetFrameHostForNavigation(
812 navigation_request->common_params().url, 812 navigation_request);
813 navigation_request->common_params().transition);
814 CheckWebUIRendererDoesNotDisplayNormalURL( 813 CheckWebUIRendererDoesNotDisplayNormalURL(
815 render_frame_host, navigation_request->common_params().url); 814 render_frame_host, navigation_request->common_params().url);
816 815
817 render_frame_host->CommitNavigation(response, body.Pass(), 816 render_frame_host->CommitNavigation(response, body.Pass(),
818 navigation_request->common_params(), 817 navigation_request->common_params(),
819 navigation_request->commit_params()); 818 navigation_request->commit_params());
820 } 819 }
821 820
822 // PlzNavigate 821 // PlzNavigate
823 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { 822 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 scoped_ptr<NavigationRequest> navigation_request(new NavigationRequest( 887 scoped_ptr<NavigationRequest> navigation_request(new NavigationRequest(
889 frame_tree_node, 888 frame_tree_node,
890 CommonNavigationParams(entry.GetURL(), 889 CommonNavigationParams(entry.GetURL(),
891 entry.GetReferrer(), 890 entry.GetReferrer(),
892 entry.GetTransitionType(), 891 entry.GetTransitionType(),
893 navigation_type, 892 navigation_type,
894 !entry.IsViewSourceMode()), 893 !entry.IsViewSourceMode()),
895 CommitNavigationParams(entry.GetPageState(), 894 CommitNavigationParams(entry.GetPageState(),
896 entry.GetIsOverridingUserAgent(), 895 entry.GetIsOverridingUserAgent(),
897 navigation_start))); 896 navigation_start)));
897 navigation_request->CopyDataFrom(entry);
clamy 2015/01/16 16:39:02 Considering that we only call CopyDataFrom once, j
carlosk 2015/01/19 15:02:52 Done.
898 RequestNavigationParams request_params(entry.GetHasPostData(), 898 RequestNavigationParams request_params(entry.GetHasPostData(),
899 entry.extra_headers(), 899 entry.extra_headers(),
900 entry.GetBrowserInitiatedPostData()); 900 entry.GetBrowserInitiatedPostData());
901 // TODO(clamy): Check if navigations are blocked and if so store the 901 // TODO(clamy): Check if navigations are blocked and if so store the
902 // parameters. 902 // parameters.
903 903
904 // If there is an ongoing request, replace it. 904 // If there is an ongoing request, replace it.
905 navigation_request_map_.set(frame_tree_node_id, navigation_request.Pass()); 905 navigation_request_map_.set(frame_tree_node_id, navigation_request.Pass());
906 906
907 if (frame_tree_node->current_frame_host()->IsRenderFrameLive()) { 907 if (frame_tree_node->current_frame_host()->IsRenderFrameLive()) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", 969 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted",
970 time_to_commit); 970 time_to_commit);
971 UMA_HISTOGRAM_TIMES( 971 UMA_HISTOGRAM_TIMES(
972 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", 972 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted",
973 time_to_network); 973 time_to_network);
974 } 974 }
975 navigation_data_.reset(); 975 navigation_data_.reset();
976 } 976 }
977 977
978 } // namespace content 978 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698