| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 5 |
| 6 /** | 6 /** |
| 7 * @fileoverview TimelineModel is a parsed representation of the | 7 * @fileoverview TimelineModel is a parsed representation of the |
| 8 * TraceEvents obtained from base/trace_event in which the begin-end | 8 * TraceEvents obtained from base/trace_event in which the begin-end |
| 9 * tokens are converted into a hierarchy of processes, threads, | 9 * tokens are converted into a hierarchy of processes, threads, |
| 10 * subrows, and slices. | 10 * subrows, and slices. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 /** | 103 /** |
| 104 * Builds a model from an array of TraceEvent objects. | 104 * Builds a model from an array of TraceEvent objects. |
| 105 * @param {Array} events An array of TraceEvents created by | 105 * @param {Array} events An array of TraceEvents created by |
| 106 * TraceEvent.ToJSON(). | 106 * TraceEvent.ToJSON(). |
| 107 * @constructor | 107 * @constructor |
| 108 */ | 108 */ |
| 109 function TimelineModel(events) { | 109 function TimelineModel(events) { |
| 110 this.processes = {}; | 110 this.processes = {}; |
| 111 | 111 |
| 112 this.importEvents(events); | 112 if (events) |
| 113 this.importEvents(events); |
| 113 } | 114 } |
| 114 | 115 |
| 115 TimelineModel.prototype = { | 116 TimelineModel.prototype = { |
| 116 __proto__: cr.EventTarget.prototype, | 117 __proto__: cr.EventTarget.prototype, |
| 117 | 118 |
| 118 getProcess: function(pid) { | 119 getProcess: function(pid) { |
| 119 if (!this.processes[pid]) | 120 if (!this.processes[pid]) |
| 120 this.processes[pid] = new TimelineProcess(pid); | 121 this.processes[pid] = new TimelineProcess(pid); |
| 121 return this.processes[pid]; | 122 return this.processes[pid]; |
| 122 }, | 123 }, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 244 |
| 244 }; | 245 }; |
| 245 | 246 |
| 246 return { | 247 return { |
| 247 TimelineSlice: TimelineSlice, | 248 TimelineSlice: TimelineSlice, |
| 248 TimelineThread: TimelineThread, | 249 TimelineThread: TimelineThread, |
| 249 TimelineProcess: TimelineProcess, | 250 TimelineProcess: TimelineProcess, |
| 250 TimelineModel: TimelineModel | 251 TimelineModel: TimelineModel |
| 251 }; | 252 }; |
| 252 }); | 253 }); |
| OLD | NEW |