| OLD | NEW |
| 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 #ifndef COMPONENTS_STARTUP_METRIC_UTILS_BROWSER_STARTUP_METRIC_UTILS_H_ | 5 #ifndef COMPONENTS_STARTUP_METRIC_UTILS_BROWSER_STARTUP_METRIC_UTILS_H_ |
| 6 #define COMPONENTS_STARTUP_METRIC_UTILS_BROWSER_STARTUP_METRIC_UTILS_H_ | 6 #define COMPONENTS_STARTUP_METRIC_UTILS_BROWSER_STARTUP_METRIC_UTILS_H_ |
| 7 | 7 |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 | 9 |
| 10 class PrefRegistrySimple; | 10 class PrefRegistrySimple; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 enum class WebContentsWorkload { | 23 enum class WebContentsWorkload { |
| 24 // Only loading a single tab. | 24 // Only loading a single tab. |
| 25 SINGLE_TAB, | 25 SINGLE_TAB, |
| 26 // Loading multiple tabs (of which the profiled WebContents is foreground). | 26 // Loading multiple tabs (of which the profiled WebContents is foreground). |
| 27 MULTI_TABS, | 27 MULTI_TABS, |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 // Registers startup related prefs in |registry|. | 30 // Registers startup related prefs in |registry|. |
| 31 void RegisterPrefs(PrefRegistrySimple* registry); | 31 void RegisterPrefs(PrefRegistrySimple* registry); |
| 32 | 32 |
| 33 // Returns true if any UI other than the browser window has been displayed | 33 // Returns true when browser UI was not launched normally: some other UI was |
| 34 // so far. Useful to test if UI has been displayed before the first browser | 34 // shown first or browser was launched in background mode. |
| 35 // window was shown, which would invalidate any surrounding timing metrics. | 35 bool WasMainWindowStartupInterrupted(); |
| 36 bool WasNonBrowserUIDisplayed(); | |
| 37 | 36 |
| 38 // Call this when displaying UI that might potentially delay startup events. | 37 // Call this when displaying UI that might potentially delay startup events. |
| 39 // | 38 // |
| 40 // Note on usage: This function is idempotent and its overhead is low enough | 39 // Note on usage: This function is idempotent and its overhead is low enough |
| 41 // in comparison with UI display that it's OK to call it on every | 40 // in comparison with UI display that it's OK to call it on every |
| 42 // UI invocation regardless of whether the browser window has already | 41 // UI invocation regardless of whether the browser window has already |
| 43 // been displayed or not. | 42 // been displayed or not. |
| 44 void SetNonBrowserUIDisplayed(); | 43 void SetNonBrowserUIDisplayed(); |
| 45 | 44 |
| 45 // Call this when background mode gets enabled, as it might delay startup |
| 46 // events. |
| 47 void SetBackgroundModeEnabled(); |
| 48 |
| 46 // Call this with the creation time of the startup (initial/main) process. | 49 // Call this with the creation time of the startup (initial/main) process. |
| 47 void RecordStartupProcessCreationTime(const base::Time& time); | 50 void RecordStartupProcessCreationTime(const base::Time& time); |
| 48 | 51 |
| 49 // Call this with a time recorded as early as possible in the startup process. | 52 // Call this with a time recorded as early as possible in the startup process. |
| 50 // On Android, the entry point time is the time at which the Java code starts. | 53 // On Android, the entry point time is the time at which the Java code starts. |
| 51 // In Mojo, the entry point time is the time at which the shell starts. | 54 // In Mojo, the entry point time is the time at which the shell starts. |
| 52 void RecordMainEntryPointTime(const base::Time& time); | 55 void RecordMainEntryPointTime(const base::Time& time); |
| 53 | 56 |
| 54 // Call this with the time when the executable is loaded and main() is entered. | 57 // Call this with the time when the executable is loaded and main() is entered. |
| 55 // Can be different from |RecordMainEntryPointTime| when the startup process is | 58 // Can be different from |RecordMainEntryPointTime| when the startup process is |
| (...skipping 29 matching lines...) Expand all Loading... |
| 85 | 88 |
| 86 // Call this with the time when the first web contents began navigating its main | 89 // Call this with the time when the first web contents began navigating its main |
| 87 // frame. Adds a suffix to its metrics according to |workload|. | 90 // frame. Adds a suffix to its metrics according to |workload|. |
| 88 void RecordFirstWebContentsMainNavigationStart(const base::TimeTicks& ticks, | 91 void RecordFirstWebContentsMainNavigationStart(const base::TimeTicks& ticks, |
| 89 WebContentsWorkload workload); | 92 WebContentsWorkload workload); |
| 90 | 93 |
| 91 // Call this with the time when the first web contents successfully committed | 94 // Call this with the time when the first web contents successfully committed |
| 92 // its navigation for the main frame. | 95 // its navigation for the main frame. |
| 93 void RecordFirstWebContentsMainNavigationFinished(const base::TimeTicks& ticks); | 96 void RecordFirstWebContentsMainNavigationFinished(const base::TimeTicks& ticks); |
| 94 | 97 |
| 98 // Call this with the time when the Browser window painted its children for the |
| 99 // first time. |
| 100 void RecordBrowserWindowFirstPaint(const base::TimeTicks& ticks); |
| 101 |
| 102 // Call this with the time when the Browser window painted its children for the |
| 103 // first time and we got a CompositingEnded after that. |
| 104 void RecordBrowserWindowFirstPaintCompositingEnded( |
| 105 const base::TimeTicks& ticks); |
| 106 |
| 95 // Returns the TimeTicks corresponding to main entry as recorded by | 107 // Returns the TimeTicks corresponding to main entry as recorded by |
| 96 // RecordMainEntryPointTime. Returns a null TimeTicks if a value has not been | 108 // RecordMainEntryPointTime. Returns a null TimeTicks if a value has not been |
| 97 // recorded yet. This method is expected to be called from the UI thread. | 109 // recorded yet. This method is expected to be called from the UI thread. |
| 98 base::TimeTicks MainEntryPointTicks(); | 110 base::TimeTicks MainEntryPointTicks(); |
| 99 | 111 |
| 100 } // namespace startup_metric_utils | 112 } // namespace startup_metric_utils |
| 101 | 113 |
| 102 #endif // COMPONENTS_STARTUP_METRIC_UTILS_BROWSER_STARTUP_METRIC_UTILS_H_ | 114 #endif // COMPONENTS_STARTUP_METRIC_UTILS_BROWSER_STARTUP_METRIC_UTILS_H_ |
| OLD | NEW |