OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 if (postOrderCallback && postOrderCallback(record, depth)) | 143 if (postOrderCallback && postOrderCallback(record, depth)) |
144 return true; | 144 return true; |
145 } | 145 } |
146 return false; | 146 return false; |
147 } | 147 } |
148 return processRecords(recordsArray, 0); | 148 return processRecords(recordsArray, 0); |
149 } | 149 } |
150 | 150 |
151 WebInspector.TimelineModel.prototype = { | 151 WebInspector.TimelineModel.prototype = { |
152 /** | 152 /** |
| 153 * @return {boolean} |
| 154 */ |
| 155 loadedFromFile: function() |
| 156 { |
| 157 return this._loadedFromFile; |
| 158 }, |
| 159 |
| 160 /** |
153 * @param {?function(!WebInspector.TimelineModel.Record)|?function(!WebInspe
ctor.TimelineModel.Record,number)} preOrderCallback | 161 * @param {?function(!WebInspector.TimelineModel.Record)|?function(!WebInspe
ctor.TimelineModel.Record,number)} preOrderCallback |
154 * @param {function(!WebInspector.TimelineModel.Record)|function(!WebInspect
or.TimelineModel.Record,number)=} postOrderCallback | 162 * @param {function(!WebInspector.TimelineModel.Record)|function(!WebInspect
or.TimelineModel.Record,number)=} postOrderCallback |
155 */ | 163 */ |
156 forAllRecords: function(preOrderCallback, postOrderCallback) | 164 forAllRecords: function(preOrderCallback, postOrderCallback) |
157 { | 165 { |
158 WebInspector.TimelineModel.forAllRecords(this._records, preOrderCallback
, postOrderCallback); | 166 WebInspector.TimelineModel.forAllRecords(this._records, preOrderCallback
, postOrderCallback); |
159 }, | 167 }, |
160 | 168 |
161 /** | 169 /** |
162 * @param {!WebInspector.TimelineModel.Filter} filter | 170 * @param {!WebInspector.TimelineModel.Filter} filter |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 if (!accepted) | 424 if (!accepted) |
417 return; | 425 return; |
418 var saver = new WebInspector.TimelineSaver(stream); | 426 var saver = new WebInspector.TimelineSaver(stream); |
419 saver.save(this._payloads, window.navigator.appVersion); | 427 saver.save(this._payloads, window.navigator.appVersion); |
420 } | 428 } |
421 stream.open(fileName, callback.bind(this)); | 429 stream.open(fileName, callback.bind(this)); |
422 }, | 430 }, |
423 | 431 |
424 reset: function() | 432 reset: function() |
425 { | 433 { |
| 434 this._loadedFromFile = false; |
426 this._records = []; | 435 this._records = []; |
427 this._payloads = []; | 436 this._payloads = []; |
428 this._stringPool = {}; | 437 this._stringPool = {}; |
429 this._minimumRecordTime = -1; | 438 this._minimumRecordTime = -1; |
430 this._maximumRecordTime = -1; | 439 this._maximumRecordTime = -1; |
431 this._bindings._reset(); | 440 this._bindings._reset(); |
432 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */ | 441 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */ |
433 this._mainThreadTasks = []; | 442 this._mainThreadTasks = []; |
434 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */ | 443 /** @type {!Array.<!WebInspector.TimelineModel.Record>} */ |
435 this._gpuThreadTasks = []; | 444 this._gpuThreadTasks = []; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 this._lastChildEndTime = this.endTime; | 568 this._lastChildEndTime = this.endTime; |
560 this._startTimeOffset = this.startTime - model.minimumRecordTime(); | 569 this._startTimeOffset = this.startTime - model.minimumRecordTime(); |
561 | 570 |
562 if (record.data) { | 571 if (record.data) { |
563 if (record.data["url"]) | 572 if (record.data["url"]) |
564 this.url = record.data["url"]; | 573 this.url = record.data["url"]; |
565 if (record.data["rootNode"]) | 574 if (record.data["rootNode"]) |
566 this._relatedBackendNodeId = record.data["rootNode"]; | 575 this._relatedBackendNodeId = record.data["rootNode"]; |
567 else if (record.data["elementId"]) | 576 else if (record.data["elementId"]) |
568 this._relatedBackendNodeId = record.data["elementId"]; | 577 this._relatedBackendNodeId = record.data["elementId"]; |
569 if (record.data["scriptName"]) { | 578 if (record.data["scriptName"] || record.data["scriptId"]) { |
| 579 this.scriptId = record.data["scriptId"]; |
570 this.scriptName = record.data["scriptName"]; | 580 this.scriptName = record.data["scriptName"]; |
571 this.scriptLine = record.data["scriptLine"]; | 581 this.scriptLine = record.data["scriptLine"]; |
572 } | 582 } |
573 } | 583 } |
574 | 584 |
575 if (parentRecord && parentRecord.callSiteStackTrace) | 585 if (parentRecord && parentRecord.callSiteStackTrace) |
576 this.callSiteStackTrace = parentRecord.callSiteStackTrace; | 586 this.callSiteStackTrace = parentRecord.callSiteStackTrace; |
577 | 587 |
578 var recordTypes = WebInspector.TimelineModel.RecordType; | 588 var recordTypes = WebInspector.TimelineModel.RecordType; |
579 switch (record.type) { | 589 switch (record.type) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 } | 695 } |
686 break; | 696 break; |
687 | 697 |
688 case recordTypes.EmbedderCallback: | 698 case recordTypes.EmbedderCallback: |
689 this.embedderCallbackName = record.data["callbackName"]; | 699 this.embedderCallbackName = record.data["callbackName"]; |
690 break; | 700 break; |
691 } | 701 } |
692 } | 702 } |
693 | 703 |
694 WebInspector.TimelineModel.Record.prototype = { | 704 WebInspector.TimelineModel.Record.prototype = { |
| 705 /** |
| 706 * @return {!WebInspector.TimelineModel} |
| 707 */ |
| 708 model: function() |
| 709 { |
| 710 return this._model; |
| 711 }, |
| 712 |
695 get lastChildEndTime() | 713 get lastChildEndTime() |
696 { | 714 { |
697 return this._lastChildEndTime; | 715 return this._lastChildEndTime; |
698 }, | 716 }, |
699 | 717 |
700 set lastChildEndTime(time) | 718 set lastChildEndTime(time) |
701 { | 719 { |
702 this._lastChildEndTime = time; | 720 this._lastChildEndTime = time; |
703 }, | 721 }, |
704 | 722 |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 this._version = items[0]; | 1036 this._version = items[0]; |
1019 this._firstChunk = false; | 1037 this._firstChunk = false; |
1020 this._model.reset(); | 1038 this._model.reset(); |
1021 } | 1039 } |
1022 | 1040 |
1023 // Skip 0-th element - it is either version or 0. | 1041 // Skip 0-th element - it is either version or 0. |
1024 for (var i = 1, size = items.length; i < size; ++i) | 1042 for (var i = 1, size = items.length; i < size; ++i) |
1025 this._model._addRecord(items[i]); | 1043 this._model._addRecord(items[i]); |
1026 }, | 1044 }, |
1027 | 1045 |
1028 close: function() { } | 1046 close: function() |
| 1047 { |
| 1048 this._model._loadedFromFile = true; |
| 1049 } |
1029 } | 1050 } |
1030 | 1051 |
1031 /** | 1052 /** |
1032 * @constructor | 1053 * @constructor |
1033 * @implements {WebInspector.OutputStreamDelegate} | 1054 * @implements {WebInspector.OutputStreamDelegate} |
1034 * @param {!WebInspector.TimelineModel} model | 1055 * @param {!WebInspector.TimelineModel} model |
1035 * @param {!WebInspector.Progress} progress | 1056 * @param {!WebInspector.Progress} progress |
1036 */ | 1057 */ |
1037 WebInspector.TimelineModelLoadFromFileDelegate = function(model, progress) | 1058 WebInspector.TimelineModelLoadFromFileDelegate = function(model, progress) |
1038 { | 1059 { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 WebInspector.TimelineModel._quadFromRectData = function(data) | 1212 WebInspector.TimelineModel._quadFromRectData = function(data) |
1192 { | 1213 { |
1193 if (typeof data["x"] === "undefined" || typeof data["y"] === "undefined") | 1214 if (typeof data["x"] === "undefined" || typeof data["y"] === "undefined") |
1194 return null; | 1215 return null; |
1195 var x0 = data["x"]; | 1216 var x0 = data["x"]; |
1196 var x1 = data["x"] + data["width"]; | 1217 var x1 = data["x"] + data["width"]; |
1197 var y0 = data["y"]; | 1218 var y0 = data["y"]; |
1198 var y1 = data["y"] + data["height"]; | 1219 var y1 = data["y"] + data["height"]; |
1199 return [x0, y0, x1, y0, x1, y1, x0, y1]; | 1220 return [x0, y0, x1, y0, x1, y1, x0, y1]; |
1200 } | 1221 } |
OLD | NEW |