OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 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 from metrics import loading | 4 from metrics import loading |
5 from metrics import smoothness | 5 from metrics import smoothness |
6 from metrics.gpu_rendering_stats import GpuRenderingStats | 6 from metrics.gpu_rendering_stats import GpuRenderingStats |
7 from telemetry.page import page_measurement | 7 from telemetry.page import page_measurement |
8 | 8 |
9 class DidNotScrollException(page_measurement.MeasurementFailure): | 9 class DidNotScrollException(page_measurement.MeasurementFailure): |
10 def __init__(self): | 10 def __init__(self): |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 def CustomizeBrowserOptions(self, options): | 29 def CustomizeBrowserOptions(self, options): |
30 smoothness.SmoothnessMetrics.CustomizeBrowserOptions(options) | 30 smoothness.SmoothnessMetrics.CustomizeBrowserOptions(options) |
31 if self.force_enable_threaded_compositing: | 31 if self.force_enable_threaded_compositing: |
32 options.extra_browser_args.append('--enable-threaded-compositing') | 32 options.extra_browser_args.append('--enable-threaded-compositing') |
33 | 33 |
34 def CanRunForPage(self, page): | 34 def CanRunForPage(self, page): |
35 return hasattr(page, 'smoothness') | 35 return hasattr(page, 'smoothness') |
36 | 36 |
37 def WillRunAction(self, page, tab, action): | 37 def WillRunAction(self, page, tab, action): |
38 tab.browser.StartTracing('webkit,cc,benchmark', 60) | 38 tab.browser.StartTracing('webkit,benchmark', 60) |
39 if tab.browser.platform.IsRawDisplayFrameRateSupported(): | 39 if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
40 tab.browser.platform.StartRawDisplayFrameRateMeasurement() | 40 tab.browser.platform.StartRawDisplayFrameRateMeasurement() |
41 self._metrics = smoothness.SmoothnessMetrics(tab) | 41 self._metrics = smoothness.SmoothnessMetrics(tab) |
42 if action.CanBeBound(): | 42 if action.CanBeBound(): |
43 self._metrics.BindToAction(action) | 43 self._metrics.BindToAction(action) |
44 else: | 44 else: |
45 self._metrics.Start() | 45 self._metrics.Start() |
46 | 46 |
47 def DidRunAction(self, page, tab, action): | 47 def DidRunAction(self, page, tab, action): |
48 if tab.browser.platform.IsRawDisplayFrameRateSupported(): | 48 if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
(...skipping 30 matching lines...) Expand all Loading... |
79 | 79 |
80 if self.options.report_all_results: | 80 if self.options.report_all_results: |
81 for k, v in rendering_stats_deltas.iteritems(): | 81 for k, v in rendering_stats_deltas.iteritems(): |
82 results.Add(k, '', v) | 82 results.Add(k, '', v) |
83 | 83 |
84 if tab.browser.platform.IsRawDisplayFrameRateSupported(): | 84 if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
85 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): | 85 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): |
86 if r.value is None: | 86 if r.value is None: |
87 raise MissingDisplayFrameRate(r.name) | 87 raise MissingDisplayFrameRate(r.name) |
88 results.Add(r.name, r.unit, r.value) | 88 results.Add(r.name, r.unit, r.value) |
OLD | NEW |