OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 from measurements import smoothness_controller | 5 from measurements import smoothness_controller |
6 from telemetry.page import page_measurement | 6 from telemetry.page import page_measurement |
7 | 7 |
8 | 8 |
9 class Repaint(page_measurement.PageMeasurement): | 9 class Repaint(page_measurement.PageMeasurement): |
10 def __init__(self): | 10 def __init__(self): |
11 super(Repaint, self).__init__('RunRepaint', False) | 11 super(Repaint, self).__init__('RunRepaint', False) |
12 self._smoothness_controller = None | 12 self._smoothness_controller = None |
13 | 13 |
14 def WillRunActions(self, page, tab): | 14 def WillRunActions(self, page, tab): |
15 tab.WaitForDocumentReadyStateToBeComplete() | 15 tab.WaitForDocumentReadyStateToBeComplete() |
16 self._smoothness_controller = smoothness_controller.SmoothnessController() | 16 self._smoothness_controller = smoothness_controller.SmoothnessController() |
17 self._smoothness_controller.Start(page, tab) | 17 self._smoothness_controller.Start(page, tab) |
18 # Rasterize only what's visible. | 18 # Rasterize only what's visible. |
19 tab.ExecuteJavaScript( | 19 tab.ExecuteJavaScript( |
20 'chrome.gpuBenchmarking.setRasterizeOnlyVisibleContent();') | 20 'chrome.gpuBenchmarking.setRasterizeOnlyVisibleContent();') |
21 | 21 |
22 def DidRunAction(self, page, tab, action): | 22 def DidRunAction(self, page, tab, action): |
23 self._smoothness_controller.AddActionToIncludeInMetric(action) | 23 self._smoothness_controller.AddActionToIncludeInMetric(action) |
24 | 24 |
25 def DidRunActions(self, page, tab): | 25 def DidRunActions(self, page, tab): |
26 self._smoothness_controller.Stop(tab) | 26 self._smoothness_controller.Stop(tab) |
27 | 27 |
28 def MeasurePage(self, page, tab, results): | 28 def MeasurePage(self, page, tab, results): |
29 self._smoothness_controller.AddResults(tab, results) | 29 self._smoothness_controller.AddResults(tab, results) |
| 30 |
| 31 def CleanUpAfterPage(self, _, tab): |
| 32 self._smoothness_controller.CleanUp(tab) |
OLD | NEW |