Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Unified Diff: tools/telemetry/telemetry/timeline/inspector_importer.py

Issue 441873007: Move timeline and importers to use telemetry.value.TraceValue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/timeline/inspector_importer.py
diff --git a/tools/telemetry/telemetry/timeline/inspector_importer.py b/tools/telemetry/telemetry/timeline/inspector_importer.py
index d4d5dd6935c35dbcb8d0c387d752c38c124b062f..c046f50804ede978da6386a15003093a50c03607 100644
--- a/tools/telemetry/telemetry/timeline/inspector_importer.py
+++ b/tools/telemetry/telemetry/timeline/inspector_importer.py
@@ -4,34 +4,26 @@
'''Imports event data obtained from the inspector's timeline.'''
from telemetry.timeline import importer
-from telemetry.timeline import inspector_timeline_data
import telemetry.timeline.thread as timeline_thread
import telemetry.timeline.slice as tracing_slice
+import telemetry.value.trace as trace_value_module
class InspectorTimelineImporter(importer.TimelineImporter):
- def __init__(self, model, timeline_data):
- super(InspectorTimelineImporter, self).__init__(model, timeline_data)
+ def __init__(self, model, trace_value):
+ super(InspectorTimelineImporter, self).__init__(
+ model,
+ trace_value,
+ import_order=1)
+ self._events = trace_value.GetEventsFor(
+ trace_value_module.INSPECTOR_TRACE_PART)
@staticmethod
- def CanImport(timeline_data):
- ''' Checks if timeline_data is from the inspector timeline. We assume
- that if the first event is a valid inspector event, we can import the
- entire list.
- '''
- if not isinstance(timeline_data,
- inspector_timeline_data.InspectorTimelineData):
- return False
-
- event_data = timeline_data.EventData()
-
- if isinstance(event_data, list) and len(event_data):
- event_datum = event_data[0]
- return 'startTime' in event_datum and 'type' in event_datum
- return False
+ def GetSupportedPart():
+ return trace_value_module.INSPECTOR_TRACE_PART
def ImportEvents(self):
render_process = self._model.GetOrCreateProcess(0)
- for raw_event in self._timeline_data.EventData():
+ for raw_event in self._events:
thread = render_process.GetOrCreateThread(raw_event.get('thread', 0))
InspectorTimelineImporter.AddRawEventToThreadRecursive(thread, raw_event)

Powered by Google App Engine
This is Rietveld 408576698