OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """The page cycler measurement. | 5 """The page cycler measurement. |
6 | 6 |
7 This measurement registers a window load handler in which is forces a layout and | 7 This measurement registers a window load handler in which is forces a layout and |
8 then records the value of performance.now(). This call to now() measures the | 8 then records the value of performance.now(). This call to now() measures the |
9 time from navigationStart (immediately after the previous page's beforeunload | 9 time from navigationStart (immediately after the previous page's beforeunload |
10 event) until after the layout in the page's load event. In addition, two garbage | 10 event) until after the layout in the page's load event. In addition, two garbage |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 self._v8_object_stats_metric = v8_object_stats.V8ObjectStatsMetric() | 73 self._v8_object_stats_metric = v8_object_stats.V8ObjectStatsMetric() |
74 | 74 |
75 def DidStartHTTPServer(self, tab): | 75 def DidStartHTTPServer(self, tab): |
76 # Avoid paying for a cross-renderer navigation on the first page on legacy | 76 # Avoid paying for a cross-renderer navigation on the first page on legacy |
77 # page cyclers which use the filesystem. | 77 # page cyclers which use the filesystem. |
78 tab.Navigate(tab.browser.http_server.UrlOf('nonexistent.html')) | 78 tab.Navigate(tab.browser.http_server.UrlOf('nonexistent.html')) |
79 | 79 |
80 def WillNavigateToPage(self, page, tab): | 80 def WillNavigateToPage(self, page, tab): |
81 page.script_to_evaluate_on_commit = self._page_cycler_js | 81 page.script_to_evaluate_on_commit = self._page_cycler_js |
82 if self.ShouldRunCold(page.url): | 82 if self.ShouldRunCold(page.url): |
83 tab.ClearCache() | 83 tab.ClearCache(force=True) |
84 if self._report_speed_index: | 84 if self._report_speed_index: |
85 self._speedindex_metric.Start(page, tab) | 85 self._speedindex_metric.Start(page, tab) |
86 | 86 |
87 def DidNavigateToPage(self, page, tab): | 87 def DidNavigateToPage(self, page, tab): |
88 self._memory_metric.Start(page, tab) | 88 self._memory_metric.Start(page, tab) |
89 self._power_metric.Start(page, tab) | 89 self._power_metric.Start(page, tab) |
90 # TODO(qyearsley): Uncomment the following line and move it to | 90 # TODO(qyearsley): Uncomment the following line and move it to |
91 # WillNavigateToPage once the cpu metric has been changed. | 91 # WillNavigateToPage once the cpu metric has been changed. |
92 # This is being temporarily commented out to let the page cycler | 92 # This is being temporarily commented out to let the page cycler |
93 # results return to how they were before the cpu metric was added. | 93 # results return to how they were before the cpu metric was added. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 # preserve any initial profile cache for as long as possible. | 183 # preserve any initial profile cache for as long as possible. |
184 # The second is that, if we did cold runs first, we'd have a transition | 184 # The second is that, if we did cold runs first, we'd have a transition |
185 # page set during which we wanted the run for each URL to both | 185 # page set during which we wanted the run for each URL to both |
186 # contribute to the cold data and warm the catch for the following | 186 # contribute to the cold data and warm the catch for the following |
187 # warm run, and clearing the cache before the load of the following | 187 # warm run, and clearing the cache before the load of the following |
188 # URL would eliminate the intended warmup for the previous URL. | 188 # URL would eliminate the intended warmup for the previous URL. |
189 return (self._has_loaded_page[url] >= self._cold_run_start_index) | 189 return (self._has_loaded_page[url] >= self._cold_run_start_index) |
190 | 190 |
191 def results_are_the_same_on_every_page(self): | 191 def results_are_the_same_on_every_page(self): |
192 return False | 192 return False |
OLD | NEW |