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

Unified Diff: components/startup_metric_utils/browser/startup_metric_utils.h

Issue 1425263003: Use TimeTicks as much as possible in startup_metric_utils. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ifdef thread priority dance out on Mac per lack of support in base Created 5 years, 1 month 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: components/startup_metric_utils/browser/startup_metric_utils.h
diff --git a/components/startup_metric_utils/browser/startup_metric_utils.h b/components/startup_metric_utils/browser/startup_metric_utils.h
index b071321b73a1b80ddf1f8050ed3ec36dced300b1..2b2885f61a9141bbad9ecf0bacc1b6c98ee5e281 100644
--- a/components/startup_metric_utils/browser/startup_metric_utils.h
+++ b/components/startup_metric_utils/browser/startup_metric_utils.h
@@ -9,7 +9,11 @@
#include "base/time/time.h"
-// Utility functions to support metric collection for browser startup.
+// Utility functions to support metric collection for browser startup. Timings
+// should use TimeTicks whenever possible. OS-provided timings are still
+// received as Time out of cross-platform support necessity but are converted to
+// TimeTicks as soon as possible in an attempt to reduce the potential skew
+// between the two basis. See crbug.com/544131 for reasoning.
namespace startup_metric_utils {
@@ -59,43 +63,45 @@ void RecordExeMainEntryPointTime(const base::Time& time);
// Call this with the time recorded just before the message loop is started.
// |is_first_run| - is the current launch part of a first run.
-void RecordBrowserMainMessageLoopStart(const base::Time& time,
+void RecordBrowserMainMessageLoopStart(const base::TimeTicks& ticks,
bool is_first_run);
// Call this with the time when the first browser window became visible.
-void RecordBrowserWindowDisplay(const base::Time& time);
+void RecordBrowserWindowDisplay(const base::TimeTicks& ticks);
// Call this with the time delta that the browser spent opening its tabs.
void RecordBrowserOpenTabsDelta(const base::TimeDelta& delta);
// Call this with the time when the first web contents loaded its main frame,
// only if the first web contents was unimpended in its attempt to do so.
-void RecordFirstWebContentsMainFrameLoad(const base::Time& time);
+void RecordFirstWebContentsMainFrameLoad(const base::TimeTicks& ticks);
// Call this with the time when the first web contents loaded its main frame.
// This records an old stat kept for comparison purposes until M49.
-void RecordDeprecatedFirstWebContentsMainFrameLoad(const base::Time& time);
+void RecordDeprecatedFirstWebContentsMainFrameLoad(
+ const base::TimeTicks& ticks);
// Call this with the time when the first web contents had a non-empty paint,
// only if the first web contents was unimpended in its attempt to do so.
-void RecordFirstWebContentsNonEmptyPaint(const base::Time& time);
+void RecordFirstWebContentsNonEmptyPaint(const base::TimeTicks& ticks);
// Call this with the time when the first web contents had a non-empty paint.
// This records an old stat kept for comparison purposes until M49.
-void RecordDeprecatedFirstWebContentsNonEmptyPaint(const base::Time& time);
+void RecordDeprecatedFirstWebContentsNonEmptyPaint(
+ const base::TimeTicks& ticks);
// Call this with the time when the first web contents began navigating its main
// frame.
-void RecordFirstWebContentsMainNavigationStart(const base::Time& time);
+void RecordFirstWebContentsMainNavigationStart(const base::TimeTicks& ticks);
// Call this with the time when the first web contents successfully committed
// its navigation for the main frame.
-void RecordFirstWebContentsMainNavigationFinished(const base::Time& time);
+void RecordFirstWebContentsMainNavigationFinished(const base::TimeTicks& ticks);
-// Returns the time of main entry recorded from RecordMainEntryPointTime.
-// Returns a null Time if a value has not been recorded yet.
-// This method is expected to be called from the UI thread.
-base::Time MainEntryPointTime();
+// Returns the TimeTicks corresponding to main entry as recorded by
+// RecordMainEntryPointTime. Returns a null TimeTicks if a value has not been
+// recorded yet. This method is expected to be called from the UI thread.
+base::TimeTicks MainEntryPointTicks();
// Returns the startup type. This is only currently supported on the Windows
// platform and will simply return UNCERTAIN_STARTUP_TYPE on other platforms.

Powered by Google App Engine
This is Rietveld 408576698