OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <link rel="import" href="/tracing/base/color_scheme.html"> | 8 <link rel="import" href="/tracing/base/color_scheme.html"> |
9 <link rel="import" href="/tracing/base/guid.html"> | 9 <link rel="import" href="/tracing/base/guid.html"> |
10 <link rel="import" href="/tracing/base/sorted_array_utils.html"> | 10 <link rel="import" href="/tracing/base/sorted_array_utils.html"> |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 }, | 268 }, |
269 | 269 |
270 copySlice: function(slice) { | 270 copySlice: function(slice) { |
271 var newSlice = new this.sliceConstructor(slice.category, slice.title, | 271 var newSlice = new this.sliceConstructor(slice.category, slice.title, |
272 slice.colorId, slice.start, | 272 slice.colorId, slice.start, |
273 slice.args, slice.duration, slice.cpuStart, slice.cpuDuration); | 273 slice.args, slice.duration, slice.cpuStart, slice.cpuDuration); |
274 newSlice.didNotFinish = slice.didNotFinish; | 274 newSlice.didNotFinish = slice.didNotFinish; |
275 return newSlice; | 275 return newSlice; |
276 }, | 276 }, |
277 | 277 |
278 findTopmostSlicesInThisContainer: function(eventPredicate, callback, | 278 findTopmostSlicesInThisContainer: function*(eventPredicate, opt_this) { |
279 opt_this) { | |
280 if (!this.haveTopLevelSlicesBeenBuilt) | 279 if (!this.haveTopLevelSlicesBeenBuilt) |
281 throw new Error('Nope'); | 280 throw new Error('Nope'); |
282 | 281 |
283 this.topLevelSlices.forEach(function(s) { | 282 for (var s of this.topLevelSlices) |
284 s.findTopmostSlicesRelativeToThisSlice(eventPredicate, callback, | 283 yield * s.findTopmostSlicesRelativeToThisSlice(eventPredicate); |
285 opt_this); | |
286 }); | |
287 }, | 284 }, |
288 | 285 |
289 childEvents: function*(eventTypePredicate, opt_this) { | 286 childEvents: function*() { |
290 if (eventTypePredicate.call(opt_this, this.sliceConstructor)) | 287 yield * this.slices; |
291 yield * this.slices; | |
292 }, | 288 }, |
293 | 289 |
294 childEventContainers: function*() { | 290 childEventContainers: function*() { |
295 }, | 291 }, |
296 | 292 |
297 getSlicesOfName: function(title) { | 293 getSlicesOfName: function(title) { |
298 var slices = []; | 294 var slices = []; |
299 for (var i = 0; i < this.slices.length; i++) { | 295 for (var i = 0; i < this.slices.length; i++) { |
300 if (this.slices[i].title == title) { | 296 if (this.slices[i].title == title) { |
301 slices.push(this.slices[i]); | 297 slices.push(this.slices[i]); |
302 } | 298 } |
303 } | 299 } |
304 return slices; | 300 return slices; |
305 }, | 301 }, |
306 | 302 |
307 iterSlicesInTimeRange: function(callback, start, end) { | 303 iterSlicesInTimeRange: function(callback, start, end) { |
308 var ret = []; | 304 var ret = []; |
309 tr.b.iterateOverIntersectingIntervals( | 305 tr.b.iterateOverIntersectingIntervals( |
310 this.topLevelSlices, | 306 this.topLevelSlices, |
311 function(s) { return s.start; }, | 307 function(s) { return s.start; }, |
312 function(s) { return s.duration; }, | 308 function(s) { return s.duration; }, |
313 start, | 309 start, |
314 end, | 310 end, |
315 function(topLevelSlice) { | 311 function(topLevelSlice) { |
316 callback(topLevelSlice); | 312 callback(topLevelSlice); |
317 topLevelSlice.iterateAllDescendents(callback); | 313 for (var slice of topLevelSlice.enumerateAllDescendents()) |
| 314 callback(slice); |
318 }); | 315 }); |
319 return ret; | 316 return ret; |
320 }, | 317 }, |
321 | 318 |
322 findFirstSlice: function() { | 319 findFirstSlice: function() { |
323 if (!this.haveTopLevelSlicesBeenBuilt) | 320 if (!this.haveTopLevelSlicesBeenBuilt) |
324 throw new Error('Nope'); | 321 throw new Error('Nope'); |
325 if (0 === this.slices.length) | 322 if (0 === this.slices.length) |
326 return undefined; | 323 return undefined; |
327 return this.slices[0]; | 324 return this.slices[0]; |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 closeOpenSlices(); | 654 closeOpenSlices(); |
658 | 655 |
659 return result; | 656 return result; |
660 }; | 657 }; |
661 | 658 |
662 return { | 659 return { |
663 SliceGroup: SliceGroup | 660 SliceGroup: SliceGroup |
664 }; | 661 }; |
665 }); | 662 }); |
666 </script> | 663 </script> |
OLD | NEW |