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 from measurements import smooth_gesture_util | 4 from measurements import smooth_gesture_util |
5 | 5 |
6 from telemetry.core.backends.chrome import tracing_backend | 6 from telemetry.core.backends.chrome import tracing_backend |
7 from telemetry.core.timeline.model import TimelineModel | 7 from telemetry.core.timeline.model import TimelineModel |
8 from telemetry.page.actions import action_runner | 8 from telemetry.page.actions import action_runner |
9 from telemetry.web_perf import timeline_interaction_record as tir_module | 9 from telemetry.web_perf import timeline_interaction_record as tir_module |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 self._renderer_process = None | 29 self._renderer_process = None |
30 if not tab.browser.supports_tracing: | 30 if not tab.browser.supports_tracing: |
31 raise Exception('Not supported') | 31 raise Exception('Not supported') |
32 if self.trace_categories: | 32 if self.trace_categories: |
33 categories = [self.trace_categories] + \ | 33 categories = [self.trace_categories] + \ |
34 page.GetSyntheticDelayCategories() | 34 page.GetSyntheticDelayCategories() |
35 else: | 35 else: |
36 categories = page.GetSyntheticDelayCategories() | 36 categories = page.GetSyntheticDelayCategories() |
37 tab.browser.StartTracing(','.join(categories)) | 37 tab.browser.StartTracing(','.join(categories)) |
38 # Start the smooth marker for all actions. | 38 # Start the smooth marker for all actions. |
39 runner = action_runner.ActionRunner(None, tab) | 39 runner = action_runner.ActionRunner(tab) |
40 runner.BeginInteraction(RUN_SMOOTH_ACTIONS, [tir_module.IS_SMOOTH]) | 40 runner.BeginInteraction(RUN_SMOOTH_ACTIONS, [tir_module.IS_SMOOTH]) |
41 | 41 |
42 def Stop(self, tab): | 42 def Stop(self, tab): |
43 # End the smooth marker for all actions. | 43 # End the smooth marker for all actions. |
44 runner = action_runner.ActionRunner(None, tab) | 44 runner = action_runner.ActionRunner(tab) |
45 runner.EndInteraction(RUN_SMOOTH_ACTIONS, [tir_module.IS_SMOOTH]) | 45 runner.EndInteraction(RUN_SMOOTH_ACTIONS, [tir_module.IS_SMOOTH]) |
46 # Stop tracing. | 46 # Stop tracing. |
47 timeline_data = tab.browser.StopTracing() | 47 timeline_data = tab.browser.StopTracing() |
48 self._model = TimelineModel(timeline_data) | 48 self._model = TimelineModel(timeline_data) |
49 self._renderer_process = self._model.GetRendererProcessFromTab(tab) | 49 self._renderer_process = self._model.GetRendererProcessFromTab(tab) |
50 renderer_thread = self.model.GetRendererThreadFromTab(tab) | 50 renderer_thread = self.model.GetRendererThreadFromTab(tab) |
51 | 51 |
52 run_smooth_actions_record = None | 52 run_smooth_actions_record = None |
53 self._smooth_records = [] | 53 self._smooth_records = [] |
54 for event in renderer_thread.async_slices: | 54 for event in renderer_thread.async_slices: |
(...skipping 26 matching lines...) Expand all Loading... |
81 def model(self): | 81 def model(self): |
82 return self._model | 82 return self._model |
83 | 83 |
84 @property | 84 @property |
85 def renderer_process(self): | 85 def renderer_process(self): |
86 return self._renderer_process | 86 return self._renderer_process |
87 | 87 |
88 @property | 88 @property |
89 def smooth_records(self): | 89 def smooth_records(self): |
90 return self._smooth_records | 90 return self._smooth_records |
OLD | NEW |