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 29 matching lines...) Expand all Loading... |
40 runner = action_runner.ActionRunner(tab) | 40 runner = action_runner.ActionRunner(tab) |
41 self._interaction = runner.BeginInteraction( | 41 self._interaction = runner.BeginInteraction( |
42 RUN_SMOOTH_ACTIONS, is_smooth=True) | 42 RUN_SMOOTH_ACTIONS, is_smooth=True) |
43 | 43 |
44 def Stop(self, tab): | 44 def Stop(self, tab): |
45 # End the smooth marker for all actions. | 45 # End the smooth marker for all actions. |
46 self._interaction.End() | 46 self._interaction.End() |
47 # Stop tracing. | 47 # Stop tracing. |
48 timeline_data = tab.browser.StopTracing() | 48 timeline_data = tab.browser.StopTracing() |
49 self._model = TimelineModel(timeline_data) | 49 self._model = TimelineModel(timeline_data) |
50 self._renderer_process = self._model.GetRendererProcessFromTab(tab) | 50 self._renderer_process = self._model.GetRendererProcessFromTabId(tab.id) |
51 renderer_thread = self.model.GetRendererThreadFromTab(tab) | 51 renderer_thread = self.model.GetRendererThreadFromTabId(tab.id) |
52 | 52 |
53 run_smooth_actions_record = None | 53 run_smooth_actions_record = None |
54 self._smooth_records = [] | 54 self._smooth_records = [] |
55 for event in renderer_thread.async_slices: | 55 for event in renderer_thread.async_slices: |
56 if not tir_module.IsTimelineInteractionRecord(event.name): | 56 if not tir_module.IsTimelineInteractionRecord(event.name): |
57 continue | 57 continue |
58 r = tir_module.TimelineInteractionRecord.FromAsyncEvent(event) | 58 r = tir_module.TimelineInteractionRecord.FromAsyncEvent(event) |
59 if r.logical_name == RUN_SMOOTH_ACTIONS: | 59 if r.logical_name == RUN_SMOOTH_ACTIONS: |
60 assert run_smooth_actions_record is None, ( | 60 assert run_smooth_actions_record is None, ( |
61 'TimelineController cannot issue more than 1 %s record' % | 61 'TimelineController cannot issue more than 1 %s record' % |
(...skipping 20 matching lines...) Expand all Loading... |
82 def model(self): | 82 def model(self): |
83 return self._model | 83 return self._model |
84 | 84 |
85 @property | 85 @property |
86 def renderer_process(self): | 86 def renderer_process(self): |
87 return self._renderer_process | 87 return self._renderer_process |
88 | 88 |
89 @property | 89 @property |
90 def smooth_records(self): | 90 def smooth_records(self): |
91 return self._smooth_records | 91 return self._smooth_records |
OLD | NEW |