| 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 import collections | 4 import collections |
| 5 import itertools | 5 import itertools |
| 6 | 6 |
| 7 from metrics import Metric | 7 from metrics import Metric |
| 8 from telemetry.core.timeline.model import TimelineModel | 8 from telemetry.core.timeline.model import TimelineModel |
| 9 from telemetry.core.timeline import bounds | 9 from telemetry.core.timeline import bounds |
| 10 from telemetry.page import page_measurement | 10 from telemetry.page import page_measurement |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 def Stop(self, page, tab): | 54 def Stop(self, page, tab): |
| 55 timeline_data = tab.browser.StopTracing() | 55 timeline_data = tab.browser.StopTracing() |
| 56 self._model = TimelineModel(timeline_data) | 56 self._model = TimelineModel(timeline_data) |
| 57 self._renderer_process = self._model.GetRendererProcessFromTab(tab) | 57 self._renderer_process = self._model.GetRendererProcessFromTab(tab) |
| 58 self._action_ranges = [ action.GetActiveRangeOnTimeline(self._model) | 58 self._action_ranges = [ action.GetActiveRangeOnTimeline(self._model) |
| 59 for action in self._actions ] | 59 for action in self._actions ] |
| 60 # Make sure no action ranges overlap | 60 # Make sure no action ranges overlap |
| 61 for combo in itertools.combinations(self._action_ranges, 2): | 61 for combo in itertools.combinations(self._action_ranges, 2): |
| 62 assert not combo[0].Intersects(combo[1]) | 62 assert not combo[0].Intersects(combo[1]) |
| 63 | 63 |
| 64 def CleanUp(self, tab): |
| 65 if tab.browser.is_tracing_running: |
| 66 tab.browser.StopTracing() |
| 67 |
| 64 def AddActionToIncludeInMetric(self, action): | 68 def AddActionToIncludeInMetric(self, action): |
| 65 self._actions.append(action) | 69 self._actions.append(action) |
| 66 | 70 |
| 67 @property | 71 @property |
| 68 def model(self): | 72 def model(self): |
| 69 return self._model | 73 return self._model |
| 70 | 74 |
| 71 @model.setter | 75 @model.setter |
| 72 def model(self, model): | 76 def model(self, model): |
| 73 self._model = model | 77 self._model = model |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 num_frames = self.CountSlices(frame_slices, FrameTraceName) | 329 num_frames = self.CountSlices(frame_slices, FrameTraceName) |
| 326 | 330 |
| 327 # Report the desired results and details. | 331 # Report the desired results and details. |
| 328 for thread_results in thread_category_results.values(): | 332 for thread_results in thread_category_results.values(): |
| 329 if thread_results.name in self.results_to_report: | 333 if thread_results.name in self.results_to_report: |
| 330 thread_results.AddResults(num_frames, results) | 334 thread_results.AddResults(num_frames, results) |
| 331 # TOOD(nduca): When generic results objects are done, this special case | 335 # TOOD(nduca): When generic results objects are done, this special case |
| 332 # can be replaced with a generic UI feature. | 336 # can be replaced with a generic UI feature. |
| 333 if thread_results.name in self.details_to_report: | 337 if thread_results.name in self.details_to_report: |
| 334 thread_results.AddDetailedResults(num_frames, results) | 338 thread_results.AddDetailedResults(num_frames, results) |
| OLD | NEW |