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.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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 self._model = TimelineModel(timeline_data) | 49 self._model = TimelineModel(timeline_data) |
50 self._renderer_process = self._model.GetRendererProcessFromTabId(tab.id) | 50 self._renderer_process = self._model.GetRendererProcessFromTabId(tab.id) |
51 renderer_thread = self.model.GetRendererThreadFromTabId(tab.id) | 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.label == 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' % |
62 RUN_SMOOTH_ACTIONS) | 62 RUN_SMOOTH_ACTIONS) |
63 run_smooth_actions_record = r | 63 run_smooth_actions_record = r |
64 elif r.is_smooth: | 64 elif r.is_smooth: |
65 self._smooth_records.append( | 65 self._smooth_records.append( |
66 smooth_gesture_util.GetAdjustedInteractionIfContainGesture( | 66 smooth_gesture_util.GetAdjustedInteractionIfContainGesture( |
67 self.model, r)) | 67 self.model, r)) |
68 | 68 |
69 # If there is no other smooth records, we make measurements on time range | 69 # If there is no other smooth records, we make measurements on time range |
(...skipping 12 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 |