OLD | NEW |
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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 scoped_ptr<NavigationRequestInfo> info(new NavigationRequestInfo(params)); | 757 scoped_ptr<NavigationRequestInfo> info(new NavigationRequestInfo(params)); |
758 | 758 |
759 info->first_party_for_cookies = | 759 info->first_party_for_cookies = |
760 frame_tree_node->IsMainFrame() | 760 frame_tree_node->IsMainFrame() |
761 ? navigation_request->common_params().url | 761 ? navigation_request->common_params().url |
762 : frame_tree_node->frame_tree()->root()->current_url(); | 762 : frame_tree_node->frame_tree()->root()->current_url(); |
763 info->is_main_frame = frame_tree_node->IsMainFrame(); | 763 info->is_main_frame = frame_tree_node->IsMainFrame(); |
764 info->parent_is_main_frame = !frame_tree_node->parent() ? | 764 info->parent_is_main_frame = !frame_tree_node->parent() ? |
765 false : frame_tree_node->parent()->IsMainFrame(); | 765 false : frame_tree_node->parent()->IsMainFrame(); |
766 | 766 |
767 // TODO(clamy): Inform the RenderFrameHostManager that a navigation is about | 767 // First start the request on the IO thread. |
768 // to begin, so that it can speculatively spawn a new renderer if needed. | 768 navigation_request->BeginNavigation(info.Pass(), params.request_body); |
769 | 769 |
770 navigation_request->BeginNavigation(info.Pass(), params.request_body); | 770 // Then notify the RenderFrameHostManager so it can speculatively create a |
| 771 // renderer in parallel. |
| 772 frame_tree_node->render_manager()->BeginNavigation(params, common_params); |
771 } | 773 } |
772 | 774 |
773 // PlzNavigate | 775 // PlzNavigate |
774 void NavigatorImpl::CommitNavigation(FrameTreeNode* frame_tree_node, | 776 void NavigatorImpl::CommitNavigation(FrameTreeNode* frame_tree_node, |
775 ResourceResponse* response, | 777 ResourceResponse* response, |
776 scoped_ptr<StreamHandle> body) { | 778 scoped_ptr<StreamHandle> body) { |
777 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( | 779 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( |
778 switches::kEnableBrowserSideNavigation)); | 780 switches::kEnableBrowserSideNavigation)); |
779 | 781 |
780 // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not | 782 // HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not |
(...skipping 20 matching lines...) Expand all Loading... |
801 render_frame_host->CommitNavigation(response, body.Pass(), | 803 render_frame_host->CommitNavigation(response, body.Pass(), |
802 navigation_request->common_params(), | 804 navigation_request->common_params(), |
803 navigation_request->commit_params()); | 805 navigation_request->commit_params()); |
804 } | 806 } |
805 | 807 |
806 // PlzNavigate | 808 // PlzNavigate |
807 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { | 809 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { |
808 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( | 810 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( |
809 switches::kEnableBrowserSideNavigation)); | 811 switches::kEnableBrowserSideNavigation)); |
810 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id()); | 812 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id()); |
| 813 frame_tree_node->render_manager()->CleanUpNavigation(); |
811 } | 814 } |
812 | 815 |
813 // PlzNavigate | 816 // PlzNavigate |
814 NavigationRequest* NavigatorImpl::GetNavigationRequestForNodeForTesting( | 817 NavigationRequest* NavigatorImpl::GetNavigationRequestForNodeForTesting( |
815 FrameTreeNode* frame_tree_node) { | 818 FrameTreeNode* frame_tree_node) { |
816 return navigation_request_map_.get(frame_tree_node->frame_tree_node_id()); | 819 return navigation_request_map_.get(frame_tree_node->frame_tree_node_id()); |
817 } | 820 } |
818 | 821 |
819 void NavigatorImpl::LogResourceRequestTime( | 822 void NavigatorImpl::LogResourceRequestTime( |
820 base::TimeTicks timestamp, const GURL& url) { | 823 base::TimeTicks timestamp, const GURL& url) { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", | 951 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", |
949 time_to_commit); | 952 time_to_commit); |
950 UMA_HISTOGRAM_TIMES( | 953 UMA_HISTOGRAM_TIMES( |
951 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", | 954 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", |
952 time_to_network); | 955 time_to_network); |
953 } | 956 } |
954 navigation_data_.reset(); | 957 navigation_data_.reset(); |
955 } | 958 } |
956 | 959 |
957 } // namespace content | 960 } // namespace content |
OLD | NEW |