| 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 11 matching lines...) Expand all Loading... |
| 22 self._metrics = None | 22 self._metrics = None |
| 23 | 23 |
| 24 def AddCommandLineOptions(self, parser): | 24 def AddCommandLineOptions(self, parser): |
| 25 parser.add_option('--report-all-results', dest='report_all_results', | 25 parser.add_option('--report-all-results', dest='report_all_results', |
| 26 action='store_true', | 26 action='store_true', |
| 27 help='Reports all data collected, not just FPS') | 27 help='Reports all data collected, not just FPS') |
| 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.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 tab.browser.StartTracing('webkit,cc,benchmark', 60) | 38 tab.browser.StartTracing('webkit,cc,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(): |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |