OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 | 4 |
5 import collections | 5 import collections |
6 | 6 |
7 from metrics import Metric | 7 from metrics import Metric |
8 from telemetry.core import bitmap | 8 from telemetry.core import bitmap |
9 from telemetry.value import scalar | 9 from telemetry.value import scalar |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 self._impl = None | 25 self._impl = None |
26 | 26 |
27 @classmethod | 27 @classmethod |
28 def CustomizeBrowserOptions(cls, options): | 28 def CustomizeBrowserOptions(cls, options): |
29 options.AppendExtraBrowserArgs('--disable-infobars') | 29 options.AppendExtraBrowserArgs('--disable-infobars') |
30 | 30 |
31 def Start(self, _, tab): | 31 def Start(self, _, tab): |
32 """Start recording events. | 32 """Start recording events. |
33 | 33 |
34 This method should be called in the WillNavigateToPage method of | 34 This method should be called in the WillNavigateToPage method of |
35 a PageMeasurement, so that all the events can be captured. If it's called | 35 a PageTest, so that all the events can be captured. If it's called |
36 in DidNavigateToPage, that will be too late. | 36 in DidNavigateToPage, that will be too late. |
37 """ | 37 """ |
38 self._impl = (VideoSpeedIndexImpl() if tab.video_capture_supported else | 38 self._impl = (VideoSpeedIndexImpl() if tab.video_capture_supported else |
39 PaintRectSpeedIndexImpl()) | 39 PaintRectSpeedIndexImpl()) |
40 self._impl.Start(tab) | 40 self._impl.Start(tab) |
41 | 41 |
42 def Stop(self, _, tab): | 42 def Stop(self, _, tab): |
43 """Stop timeline recording.""" | 43 """Stop timeline recording.""" |
44 assert self._impl, 'Must call Start() before Stop()' | 44 assert self._impl, 'Must call Start() before Stop()' |
45 assert self.IsFinished(tab), 'Must wait for IsFinished() before Stop()' | 45 assert self.IsFinished(tab), 'Must wait for IsFinished() before Stop()' |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 frame = paint_event.args['frameId'] | 298 frame = paint_event.args['frameId'] |
299 return (frame,) + GetBox(paint_event.args['data']['clip']) | 299 return (frame,) + GetBox(paint_event.args['data']['clip']) |
300 | 300 |
301 def _GroupEventByRectangle(self, paint_events): | 301 def _GroupEventByRectangle(self, paint_events): |
302 """Group all paint events according to the rectangle that they update.""" | 302 """Group all paint events according to the rectangle that they update.""" |
303 result = collections.defaultdict(list) | 303 result = collections.defaultdict(list) |
304 for event in paint_events: | 304 for event in paint_events: |
305 assert event.name == 'Paint' | 305 assert event.name == 'Paint' |
306 result[self._GetRectangle(event)].append(event) | 306 result[self._GetRectangle(event)].append(event) |
307 return result | 307 return result |
OLD | NEW |