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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 384503009: Amend sanitization of browser-side navigationStart override. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a browsertest for the navigationStart override. Created 6 years, 5 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
« no previous file with comments | « no previous file | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index af2987fda5b30c540abe6ed6ac8ce081e87930e2..727a194d82359485c37389b72bfd0c3ca8a0077b 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -886,6 +886,9 @@ void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) {
request.setHTTPBody(http_body);
}
+ // Record this before starting the load, we need a lower bound of this time
+ // to sanitize the navigationStart override set below.
+ base::TimeTicks renderer_navigation_start = base::TimeTicks::Now();
frame->loadRequest(request);
// The browser provides the navigation_start time to bootstrap the
@@ -894,11 +897,12 @@ void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) {
// finishing the onbeforeunload handler of the previous page.
DCHECK(!params.browser_navigation_start.is_null());
if (frame->provisionalDataSource()) {
- // browser_navigation_start is likely before this process existed, so we
- // can't use InterProcessTimeTicksConverter. Instead, the best we can do
- // is just ensure we don't report a bogus value in the future.
+ // |browser_navigation_start| is likely before this process existed, so we
+ // can't use InterProcessTimeTicksConverter. We need at least to ensure
+ // that the browser-side navigation start we set is not later than the one
+ // on the renderer side.
base::TimeTicks navigation_start = std::min(
pasko 2014/07/17 13:18:00 This min() could be a reason of bi-modal distribut
ppi 2014/07/17 13:27:43 This is an excellent idea, also solving the proble
- base::TimeTicks::Now(), params.browser_navigation_start);
+ params.browser_navigation_start, renderer_navigation_start);
double navigation_start_seconds =
(navigation_start - base::TimeTicks()).InSecondsF();
frame->provisionalDataSource()->setNavigationStartTime(
« no previous file with comments | « no previous file | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698