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

Side by Side Diff: tools/telemetry/telemetry/timeline_model.py

Issue 12294002: Revert 182991 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 4
5 class TimelineModel(object): 5 class TimelineModel(object):
6 def __init__(self): 6 def __init__(self):
7 self._events = [] 7 self._events = []
8 self._frozen = False 8 self._frozen = False
9 9
10 def AddEvent(self, event): 10 def AddEvent(self, event):
11 if self._frozen: 11 if self._frozen:
12 raise Exception("Cannot add events once recording is done") 12 raise Exception("Cannot add events once recording is done")
13 self._events.extend( 13 self._events.extend(
14 event.GetAllChildrenRecursive(include_self=True)) 14 event.GetAllChildrenRecursive(include_self=True))
15 15
16 def DidFinishRecording(self): 16 def DidFinishRecording(self):
17 self._frozen = True 17 self._frozen = True
18 18
19 def GetAllEvents(self): 19 def GetAllEvents(self):
20 return self._events 20 return self._events
21 21
22 def GetAllOfName(self, name): 22 def GetAllOfName(self, name):
23 return [e for e in self._events if e.name == name] 23 return [e for e in self._events if e.name == name]
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/timeline_event_unittest.py ('k') | tools/telemetry/telemetry/timeline_model_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698