| 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 19 matching lines...) Expand all Loading... |
| 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.AppendExtraBrowserArgs('--enable-threaded-compositing') | 32 options.AppendExtraBrowserArgs('--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 # TODO(ernstm): remove 'webkit' category when | 38 # TODO(ernstm): remove 'webkit' category when |
| 39 # https://codereview.chromium.org/23848006/ has landed. | 39 # https://codereview.chromium.org/23848006/ has landed. |
| 40 tab.browser.StartTracing('webkit,webkit.console,cc,benchmark', 60) | 40 tab.browser.StartTracing('webkit,webkit.console,benchmark', 60) |
| 41 if tab.browser.platform.IsRawDisplayFrameRateSupported(): | 41 if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
| 42 tab.browser.platform.StartRawDisplayFrameRateMeasurement() | 42 tab.browser.platform.StartRawDisplayFrameRateMeasurement() |
| 43 self._metrics = smoothness.SmoothnessMetrics(tab) | 43 self._metrics = smoothness.SmoothnessMetrics(tab) |
| 44 if action.CanBeBound(): | 44 if action.CanBeBound(): |
| 45 self._metrics.BindToAction(action) | 45 self._metrics.BindToAction(action) |
| 46 else: | 46 else: |
| 47 self._metrics.Start() | 47 self._metrics.Start() |
| 48 | 48 |
| 49 def DidRunAction(self, page, tab, action): | 49 def DidRunAction(self, page, tab, action): |
| 50 if tab.browser.platform.IsRawDisplayFrameRateSupported(): | 50 if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
| (...skipping 30 matching lines...) Expand all Loading... |
| 81 | 81 |
| 82 if self.options.report_all_results: | 82 if self.options.report_all_results: |
| 83 for k, v in rendering_stats_deltas.iteritems(): | 83 for k, v in rendering_stats_deltas.iteritems(): |
| 84 results.Add(k, '', v) | 84 results.Add(k, '', v) |
| 85 | 85 |
| 86 if tab.browser.platform.IsRawDisplayFrameRateSupported(): | 86 if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
| 87 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): | 87 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): |
| 88 if r.value is None: | 88 if r.value is None: |
| 89 raise MissingDisplayFrameRate(r.name) | 89 raise MissingDisplayFrameRate(r.name) |
| 90 results.Add(r.name, r.unit, r.value) | 90 results.Add(r.name, r.unit, r.value) |
| OLD | NEW |