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.platform import tracing_category_filter | 6 from telemetry.core.platform import tracing_category_filter |
7 from telemetry.timeline.model import TimelineModel | 7 from telemetry.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 28 matching lines...) Expand all Loading... |
39 def Start(self, tab): | 39 def Start(self, tab): |
40 # Start the smooth marker for all actions. | 40 # Start the smooth marker for all actions. |
41 runner = action_runner.ActionRunner(tab) | 41 runner = action_runner.ActionRunner(tab) |
42 self._interaction = runner.BeginInteraction( | 42 self._interaction = runner.BeginInteraction( |
43 RUN_SMOOTH_ACTIONS, is_smooth=True) | 43 RUN_SMOOTH_ACTIONS, is_smooth=True) |
44 | 44 |
45 def Stop(self, tab): | 45 def Stop(self, tab): |
46 # End the smooth marker for all actions. | 46 # End the smooth marker for all actions. |
47 self._interaction.End() | 47 self._interaction.End() |
48 # Stop tracing. | 48 # Stop tracing. |
49 timeline_data = tab.browser.StopTracing() | 49 self._model = TimelineModel(tab.browser.StopTracing()) |
50 self._model = TimelineModel(timeline_data) | |
51 self._renderer_process = self._model.GetRendererProcessFromTabId(tab.id) | 50 self._renderer_process = self._model.GetRendererProcessFromTabId(tab.id) |
52 renderer_thread = self.model.GetRendererThreadFromTabId(tab.id) | 51 renderer_thread = self.model.GetRendererThreadFromTabId(tab.id) |
53 | 52 |
54 run_smooth_actions_record = None | 53 run_smooth_actions_record = None |
55 self._smooth_records = [] | 54 self._smooth_records = [] |
56 for event in renderer_thread.async_slices: | 55 for event in renderer_thread.async_slices: |
57 if not tir_module.IsTimelineInteractionRecord(event.name): | 56 if not tir_module.IsTimelineInteractionRecord(event.name): |
58 continue | 57 continue |
59 r = tir_module.TimelineInteractionRecord.FromAsyncEvent(event) | 58 r = tir_module.TimelineInteractionRecord.FromAsyncEvent(event) |
60 if r.label == RUN_SMOOTH_ACTIONS: | 59 if r.label == RUN_SMOOTH_ACTIONS: |
(...skipping 22 matching lines...) Expand all Loading... |
83 def model(self): | 82 def model(self): |
84 return self._model | 83 return self._model |
85 | 84 |
86 @property | 85 @property |
87 def renderer_process(self): | 86 def renderer_process(self): |
88 return self._renderer_process | 87 return self._renderer_process |
89 | 88 |
90 @property | 89 @property |
91 def smooth_records(self): | 90 def smooth_records(self): |
92 return self._smooth_records | 91 return self._smooth_records |
OLD | NEW |