OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 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 '''A container for timeline-based events and traces and can handle importing | 4 '''A container for timeline-based events and traces and can handle importing |
5 raw event data from different sources. This model closely resembles that in the | 5 raw event data from different sources. This model closely resembles that in the |
6 trace_viewer project: | 6 trace_viewer project: |
7 https://code.google.com/p/trace-viewer/ | 7 https://code.google.com/p/trace-viewer/ |
8 ''' | 8 ''' |
9 | 9 |
10 from operator import attrgetter | 10 from operator import attrgetter |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 if event.name != names[i]: | 220 if event.name != names[i]: |
221 raise MarkerMismatchError() | 221 raise MarkerMismatchError() |
222 for i in xrange(0, len(events)): | 222 for i in xrange(0, len(events)): |
223 for j in xrange(i+1, len(events)): | 223 for j in xrange(i+1, len(events)): |
224 if (events[j].start < events[i].start + events[i].duration): | 224 if (events[j].start < events[i].start + events[i].duration): |
225 raise MarkerOverlapError() | 225 raise MarkerOverlapError() |
226 | 226 |
227 return events | 227 return events |
228 | 228 |
229 def GetRendererProcessFromTab(self, tab): | 229 def GetRendererProcessFromTab(self, tab): |
| 230 return self._core_object_to_timeline_container_map[tab].parent |
| 231 |
| 232 def GetRendererThreadFromTab(self, tab): |
230 return self._core_object_to_timeline_container_map[tab] | 233 return self._core_object_to_timeline_container_map[tab] |
231 | 234 |
232 def AddCoreObjectToContainerMapping(self, core_object, container): | 235 def AddCoreObjectToContainerMapping(self, core_object, container): |
233 """ Add a mapping from a core object to a timeline container. | 236 """ Add a mapping from a core object to a timeline container. |
234 | 237 |
235 Used for example to map a Tab to its renderer process in the timeline model. | 238 Used for example to map a Tab to its renderer process in the timeline model. |
236 """ | 239 """ |
237 assert(isinstance(core_object, web_contents.WebContents) or | 240 assert(isinstance(core_object, web_contents.WebContents) or |
238 isinstance(core_object, browser.Browser)) | 241 isinstance(core_object, browser.Browser)) |
239 self._core_object_to_timeline_container_map[core_object] = container | 242 self._core_object_to_timeline_container_map[core_object] = container |
240 | 243 |
241 def _CreateImporter(self, event_data): | 244 def _CreateImporter(self, event_data): |
242 for importer_class in _IMPORTERS: | 245 for importer_class in _IMPORTERS: |
243 if importer_class.CanImport(event_data): | 246 if importer_class.CanImport(event_data): |
244 return importer_class(self, event_data) | 247 return importer_class(self, event_data) |
245 raise ValueError("Could not find an importer for the provided event data") | 248 raise ValueError("Could not find an importer for the provided event data") |
OLD | NEW |