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

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

Issue 789643005: PlzNavigate: make content unit tests work with browser side navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cancel-navigations
Patch Set: 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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 switches::kEnableBrowserSideNavigation)); 823 switches::kEnableBrowserSideNavigation));
824 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id()); 824 navigation_request_map_.erase(frame_tree_node->frame_tree_node_id());
825 } 825 }
826 826
827 // PlzNavigate 827 // PlzNavigate
828 NavigationRequest* NavigatorImpl::GetNavigationRequestForNodeForTesting( 828 NavigationRequest* NavigatorImpl::GetNavigationRequestForNodeForTesting(
829 FrameTreeNode* frame_tree_node) { 829 FrameTreeNode* frame_tree_node) {
830 return navigation_request_map_.get(frame_tree_node->frame_tree_node_id()); 830 return navigation_request_map_.get(frame_tree_node->frame_tree_node_id());
831 } 831 }
832 832
833 bool NavigatorImpl::IsWaitingForBeforeUnloadACK(
834 FrameTreeNode* frame_tree_node) {
835 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
836 switches::kEnableBrowserSideNavigation));
837 NavigationRequest* request =
838 navigation_request_map_.get(frame_tree_node->frame_tree_node_id());
839 if (!request)
840 return false;
841 return request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE;
842 }
843
833 void NavigatorImpl::LogResourceRequestTime( 844 void NavigatorImpl::LogResourceRequestTime(
834 base::TimeTicks timestamp, const GURL& url) { 845 base::TimeTicks timestamp, const GURL& url) {
835 if (navigation_data_ && navigation_data_->url_ == url) { 846 if (navigation_data_ && navigation_data_->url_ == url) {
836 navigation_data_->url_job_start_time_ = timestamp; 847 navigation_data_->url_job_start_time_ = timestamp;
837 UMA_HISTOGRAM_TIMES( 848 UMA_HISTOGRAM_TIMES(
838 "Navigation.TimeToURLJobStart", 849 "Navigation.TimeToURLJobStart",
839 navigation_data_->url_job_start_time_ - navigation_data_->start_time_); 850 navigation_data_->url_job_start_time_ - navigation_data_->start_time_);
840 } 851 }
841 } 852 }
842 853
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", 975 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted",
965 time_to_commit); 976 time_to_commit);
966 UMA_HISTOGRAM_TIMES( 977 UMA_HISTOGRAM_TIMES(
967 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", 978 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted",
968 time_to_network); 979 time_to_network);
969 } 980 }
970 navigation_data_.reset(); 981 navigation_data_.reset();
971 } 982 }
972 983
973 } // namespace content 984 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698