def GetOrCreateThread(self, tid): thread = self.threads.get(tid, None) if thread: return thread thread = tracing_thread.Thread(self, tid) self._threads[tid] = thread return thread
def RawEventToTimelineEvent(raw_inspector_event): """Converts raw_inspector_event to TimelineEvent.""" thread = timeline_thread.Thread(None, 0) InspectorTimelineImporter.AddRawEventToThreadRecursive( thread, raw_inspector_event) thread.FinalizeImport() assert len(thread.toplevel_slices) <= 1 if len(thread.toplevel_slices) == 0: return None return thread.toplevel_slices[0]