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

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: Fixing new build issues 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 11b322e492b6d1874666c6ea93b13ac912cd268b..0e9060e26aee1ca390cb9a7d429d0ed2e89b6557 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"
@@ -81,6 +82,9 @@ NavigatorImpl::NavigatorImpl(
delegate_(delegate) {
}
+NavigatorImpl::~NavigatorImpl() {
+}
+
// static.
void NavigatorImpl::MakeNavigateParams(
const NavigationEntryImpl& entry,
@@ -322,6 +326,7 @@ bool NavigatorImpl::NavigateToEntry(
// node.
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableBrowserSideNavigation)) {
+ navigation_start_time_and_url = MakeTuple(navigation_start, entry.GetURL());
// Create the navigation parameters.
MakeNavigateParams(
entry, *controller_, reload_type, navigation_start, &navigate_params);
@@ -359,6 +364,7 @@ bool NavigatorImpl::NavigateToEntry(
navigate_params.transferred_request_child_id ==
dest_render_frame_host->GetProcess()->GetID();
if (!is_transfer_to_same) {
+ navigation_start_time_and_url = MakeTuple(navigation_start, entry.GetURL());
dest_render_frame_host->Navigate(navigate_params);
} else {
// No need to navigate again. Just resume the deferred request.
@@ -520,6 +526,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_and_url.a.ToInternalValue() != 0
+ && navigation_start_time_and_url.b == params.original_request_url) {
+ base::TimeDelta time_to_commit =
+ base::TimeTicks::Now() - navigation_start_time_and_url.a;
+ UMA_HISTOGRAM_TIMES("Navigation.TimeToCommit", time_to_commit);
+ navigation_start_time_and_url = MakeTuple(base::TimeTicks(), GURL());
+ }
+
// Run post-commit tasks.
if (delegate_) {
if (details.is_main_frame)
@@ -644,6 +661,16 @@ void NavigatorImpl::CommitNavigation(
// renderer.
}
+void NavigatorImpl::LogResourceRequestTime(
+ base::TimeTicks timestamp, const GURL& url) {
+ if (navigation_start_time_and_url.a.ToInternalValue() != 0
+ && navigation_start_time_and_url.b == url) {
+ base::TimeDelta time_to_network =
+ timestamp - navigation_start_time_and_url.a;
+ UMA_HISTOGRAM_TIMES("Navigation.TimeToURLJobStart", time_to_network);
+ }
+}
+
void NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(
RenderFrameHostImpl* render_frame_host,
const GURL& url) {
« no previous file with comments | « content/browser/frame_host/navigator_impl.h ('k') | content/browser/frame_host/render_frame_host_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698