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 import sys | 4 import sys |
5 | 5 |
6 from measurements import smooth_gesture_util | 6 from measurements import smooth_gesture_util |
7 from telemetry.core.timeline.model import TimelineModel | 7 from telemetry.core.timeline.model import TimelineModel |
8 from telemetry.page import page_measurement | 8 from telemetry.page import page_measurement |
9 from telemetry.page.actions import action_runner | 9 from telemetry.page.actions import action_runner |
10 from telemetry.web_perf import timeline_interaction_record as tir_module | 10 from telemetry.web_perf import timeline_interaction_record as tir_module |
(...skipping 13 matching lines...) Expand all Loading... |
24 self._timeline_model = None | 24 self._timeline_model = None |
25 self._tracing_timeline_data = None | 25 self._tracing_timeline_data = None |
26 | 26 |
27 def Start(self, page, tab): | 27 def Start(self, page, tab): |
28 custom_categories = ['webkit.console', 'benchmark'] | 28 custom_categories = ['webkit.console', 'benchmark'] |
29 custom_categories += page.GetSyntheticDelayCategories() | 29 custom_categories += page.GetSyntheticDelayCategories() |
30 tab.browser.StartTracing(','.join(custom_categories), 60) | 30 tab.browser.StartTracing(','.join(custom_categories), 60) |
31 if tab.browser.platform.IsRawDisplayFrameRateSupported(): | 31 if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
32 tab.browser.platform.StartRawDisplayFrameRateMeasurement() | 32 tab.browser.platform.StartRawDisplayFrameRateMeasurement() |
33 # Start the smooth marker for all smooth actions. | 33 # Start the smooth marker for all smooth actions. |
34 runner = action_runner.ActionRunner(None, tab) | 34 runner = action_runner.ActionRunner(tab) |
35 runner.BeginInteraction(RUN_SMOOTH_ACTIONS, [tir_module.IS_SMOOTH]) | 35 runner.BeginInteraction(RUN_SMOOTH_ACTIONS, [tir_module.IS_SMOOTH]) |
36 | 36 |
37 def Stop(self, tab): | 37 def Stop(self, tab): |
38 # End the smooth marker for all smooth actions. | 38 # End the smooth marker for all smooth actions. |
39 runner = action_runner.ActionRunner(None, tab) | 39 runner = action_runner.ActionRunner(tab) |
40 runner.EndInteraction(RUN_SMOOTH_ACTIONS, [tir_module.IS_SMOOTH]) | 40 runner.EndInteraction(RUN_SMOOTH_ACTIONS, [tir_module.IS_SMOOTH]) |
41 # Stop tracing for smoothness metric. | 41 # Stop tracing for smoothness metric. |
42 if tab.browser.platform.IsRawDisplayFrameRateSupported(): | 42 if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
43 tab.browser.platform.StopRawDisplayFrameRateMeasurement() | 43 tab.browser.platform.StopRawDisplayFrameRateMeasurement() |
44 self._tracing_timeline_data = tab.browser.StopTracing() | 44 self._tracing_timeline_data = tab.browser.StopTracing() |
45 self._timeline_model = TimelineModel( | 45 self._timeline_model = TimelineModel( |
46 timeline_data=self._tracing_timeline_data) | 46 timeline_data=self._tracing_timeline_data) |
47 | 47 |
48 def AddResults(self, tab, results): | 48 def AddResults(self, tab, results): |
49 # Add results of smoothness metric. This computes the smoothness metric for | 49 # Add results of smoothness metric. This computes the smoothness metric for |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): | 91 for r in tab.browser.platform.GetRawDisplayFrameRateMeasurements(): |
92 if r.value is None: | 92 if r.value is None: |
93 raise MissingDisplayFrameRateError(r.name) | 93 raise MissingDisplayFrameRateError(r.name) |
94 results.Add(r.name, r.unit, r.value) | 94 results.Add(r.name, r.unit, r.value) |
95 | 95 |
96 def CleanUp(self, tab): | 96 def CleanUp(self, tab): |
97 if tab.browser.platform.IsRawDisplayFrameRateSupported(): | 97 if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
98 tab.browser.platform.StopRawDisplayFrameRateMeasurement() | 98 tab.browser.platform.StopRawDisplayFrameRateMeasurement() |
99 if tab.browser.is_tracing_running: | 99 if tab.browser.is_tracing_running: |
100 tab.browser.StopTracing() | 100 tab.browser.StopTracing() |
OLD | NEW |