| 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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 var importerConstructors = []; | 495 var importerConstructors = []; |
| 496 | 496 |
| 497 /** | 497 /** |
| 498 * Registers an importer. All registered importers are considered | 498 * Registers an importer. All registered importers are considered |
| 499 * when processing an import request. | 499 * when processing an import request. |
| 500 * | 500 * |
| 501 * @param {Function} importerConstructor The importer's constructor function. | 501 * @param {Function} importerConstructor The importer's constructor function. |
| 502 */ | 502 */ |
| 503 TimelineModel.registerImporter = function(importerConstructor) { | 503 TimelineModel.registerImporter = function(importerConstructor) { |
| 504 importerConstructors.push(importerConstructor); | 504 importerConstructors.push(importerConstructor); |
| 505 } | 505 }; |
| 506 |
| 507 function TimelineModelEmptyImporter(events) { |
| 508 }; |
| 509 |
| 510 TimelineModelEmptyImporter.canImport = function(eventData) { |
| 511 if (eventData instanceof Array && eventData.length == 0) |
| 512 return true; |
| 513 if (typeof(eventData) === 'string' || eventData instanceof String) { |
| 514 return eventData.length == 0; |
| 515 } |
| 516 return false; |
| 517 }; |
| 518 |
| 519 TimelineModelEmptyImporter.prototype = { |
| 520 __proto__: Object.prototype, |
| 521 |
| 522 importEvents : function() { |
| 523 } |
| 524 }; |
| 525 |
| 526 TimelineModel.registerImporter(TimelineModelEmptyImporter); |
| 506 | 527 |
| 507 TimelineModel.prototype = { | 528 TimelineModel.prototype = { |
| 508 __proto__: cr.EventTarget.prototype, | 529 __proto__: cr.EventTarget.prototype, |
| 509 | 530 |
| 510 get numProcesses() { | 531 get numProcesses() { |
| 511 var n = 0; | 532 var n = 0; |
| 512 for (var p in this.processes) | 533 for (var p in this.processes) |
| 513 n++; | 534 n++; |
| 514 return n; | 535 return n; |
| 515 }, | 536 }, |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 getStringHash: getStringHash, | 801 getStringHash: getStringHash, |
| 781 getStringColorId: getStringColorId, | 802 getStringColorId: getStringColorId, |
| 782 | 803 |
| 783 TimelineSlice: TimelineSlice, | 804 TimelineSlice: TimelineSlice, |
| 784 TimelineThread: TimelineThread, | 805 TimelineThread: TimelineThread, |
| 785 TimelineCounter: TimelineCounter, | 806 TimelineCounter: TimelineCounter, |
| 786 TimelineProcess: TimelineProcess, | 807 TimelineProcess: TimelineProcess, |
| 787 TimelineCpu: TimelineCpu, | 808 TimelineCpu: TimelineCpu, |
| 788 TimelineModel: TimelineModel | 809 TimelineModel: TimelineModel |
| 789 }; | 810 }; |
| 811 |
| 790 }); | 812 }); |
| OLD | NEW |