Chromium Code Reviews| 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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 frame_tree_node->render_manager()->WillBeginNavigating(params, common_params); |
|
Charlie Reis
2014/11/05 17:50:00
nit: Let's keep with the existing naming scheme to
carlosk
2014/11/05 20:28:58
Done.
| |
| 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 navigation_request->BeginNavigation(info.Pass(), params.request_body); |
| 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)); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 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()->CleanUpCurrentNavigation(); | |
|
Charlie Reis
2014/11/05 17:50:01
RFHM::CancelNavigation
carlosk
2014/11/05 20:28:58
Done. I still wanted to have a method to clean-up
| |
| 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 Loading... | |
| 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 |
| OLD | NEW |