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

Unified Diff: content/browser/frame_host/navigator_impl.cc

Issue 577963002: Add time-to-network histogram considering browser side navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor changes for addressing CR comments Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/navigator_impl.cc
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index 384bceeafbe37a8ccaab4546a517d86c8df019d1..c20f909dcb04d33dac6a926fda808c6d6f2be950 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -5,6 +5,7 @@
#include "content/browser/frame_host/navigator_impl.h"
#include "base/command_line.h"
+#include "base/metrics/histogram.h"
#include "base/time/time.h"
#include "content/browser/frame_host/frame_tree.h"
#include "content/browser/frame_host/frame_tree_node.h"
@@ -351,6 +352,8 @@ bool NavigatorImpl::NavigateToEntry(
// node.
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableBrowserSideNavigation)) {
+ navigation_start_time_ = navigation_start;
+ navigation_start_url_ = entry.GetURL();
// Create the navigation parameters.
MakeNavigateParams(
entry, *controller_, reload_type, navigation_start, &navigate_params);
@@ -388,6 +391,8 @@ bool NavigatorImpl::NavigateToEntry(
navigate_params.transferred_request_child_id ==
dest_render_frame_host->GetProcess()->GetID();
if (!is_transfer_to_same) {
+ navigation_start_time_ = navigation_start;
+ navigation_start_url_ = entry.GetURL();
dest_render_frame_host->Navigate(navigate_params);
} else {
// No need to navigate again. Just resume the deferred request.
@@ -549,6 +554,17 @@ void NavigatorImpl::DidNavigate(
// DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if
// necessary, please).
+ // TODO(carlosk): Move this out when PlzNavigate implementation properly calls
+ // the observer methods.
+ if (details.is_main_frame &&
+ navigation_start_time_.ToInternalValue() != 0
+ && navigation_start_url_ == params.original_request_url) {
+ base::TimeDelta time_to_commit =
+ base::TimeTicks::Now() - navigation_start_time_;
+ UMA_HISTOGRAM_TIMES("Navigation.TimeToCommit", time_to_commit);
+ navigation_start_time_ = base::TimeTicks();
+ }
+
// Run post-commit tasks.
if (delegate_) {
if (details.is_main_frame)
@@ -672,6 +688,15 @@ void NavigatorImpl::CommitNavigation(
// renderer.
}
+void NavigatorImpl::LogResourceRequestTime(
+ base::TimeTicks timestamp, const GURL& url) {
+ if (navigation_start_time_.ToInternalValue() != 0
+ && navigation_start_url_ == url) {
+ base::TimeDelta time_to_network = timestamp - navigation_start_time_;
+ UMA_HISTOGRAM_TIMES("Navigation.TimeToURLJobStart", time_to_network);
+ }
+}
+
void NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(
RenderFrameHostImpl* render_frame_host,
const GURL& url) {

Powered by Google App Engine
This is Rietveld 408576698