Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @constructor | 8 * @constructor |
| 9 * @param {!WebInspector.BackingStorage} backingStorage | 9 * @param {!WebInspector.BackingStorage} backingStorage |
| 10 */ | 10 */ |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 for (var i = 0; i < events.length; ++i) | 153 for (var i = 0; i < events.length; ++i) |
| 154 this._addEvent(events[i]); | 154 this._addEvent(events[i]); |
| 155 }, | 155 }, |
| 156 | 156 |
| 157 tracingComplete: function() | 157 tracingComplete: function() |
| 158 { | 158 { |
| 159 this._processPendingAsyncEvents(); | 159 this._processPendingAsyncEvents(); |
| 160 this._backingStorage.appendString(this._firstWritePending ? "[]" : "]"); | 160 this._backingStorage.appendString(this._firstWritePending ? "[]" : "]"); |
| 161 this._backingStorage.finishWriting(); | 161 this._backingStorage.finishWriting(); |
| 162 this._firstWritePending = false; | 162 this._firstWritePending = false; |
| 163 for (var process of Object.values(this._processById)) { | 163 for (var process of this._processById.values()) { |
| 164 for (var thread of Object.values(process._threads)) | 164 for (var thread of process._threads.values()) |
| 165 thread.tracingComplete(); | 165 thread.tracingComplete(); |
| 166 } | 166 } |
| 167 }, | 167 }, |
| 168 | 168 |
| 169 reset: function() | 169 reset: function() |
| 170 { | 170 { |
| 171 /** @type {!Object.<(number|string), !WebInspector.TracingModel.Process> } */ | 171 /** @type {!Map<(number|string), !WebInspector.TracingModel.Process>} */ |
| 172 this._processById = {}; | 172 this._processById = new Map(); |
| 173 this._processByName = new Map(); | 173 this._processByName = new Map(); |
| 174 this._minimumRecordTime = 0; | 174 this._minimumRecordTime = 0; |
| 175 this._maximumRecordTime = 0; | 175 this._maximumRecordTime = 0; |
| 176 this._devToolsMetadataEvents = []; | 176 this._devToolsMetadataEvents = []; |
| 177 if (!this._firstWritePending) | 177 if (!this._firstWritePending) |
| 178 this._backingStorage.reset(); | 178 this._backingStorage.reset(); |
| 179 | 179 |
| 180 this._firstWritePending = true; | 180 this._firstWritePending = true; |
| 181 /** @type {!Array<!WebInspector.TracingModel.Event>} */ | 181 /** @type {!Array<!WebInspector.TracingModel.Event>} */ |
| 182 this._asyncEvents = []; | 182 this._asyncEvents = []; |
| 183 /** @type {!Map<string, !WebInspector.TracingModel.AsyncEvent>} */ | 183 /** @type {!Map<string, !WebInspector.TracingModel.AsyncEvent>} */ |
| 184 this._openAsyncEvents = new Map(); | 184 this._openAsyncEvents = new Map(); |
| 185 /** @type {!Map<string, !Array<!WebInspector.TracingModel.AsyncEvent>>} */ | 185 /** @type {!Map<string, !Array<!WebInspector.TracingModel.AsyncEvent>>} */ |
| 186 this._openNestableAsyncEvents = new Map(); | 186 this._openNestableAsyncEvents = new Map(); |
| 187 /** @type {!Map<string, !Set<string>>} */ | 187 /** @type {!Map<string, !Set<string>>} */ |
| 188 this._parsedCategories = new Map(); | 188 this._parsedCategories = new Map(); |
| 189 }, | 189 }, |
| 190 | 190 |
| 191 /** | 191 /** |
| 192 * @param {!WebInspector.TracingManager.EventPayload} payload | 192 * @param {!WebInspector.TracingManager.EventPayload} payload |
| 193 */ | 193 */ |
| 194 _addEvent: function(payload) | 194 _addEvent: function(payload) |
| 195 { | 195 { |
| 196 var process = this._processById[payload.pid]; | 196 var process = this._processById.get(payload.pid); |
| 197 if (!process) { | 197 if (!process) { |
| 198 process = new WebInspector.TracingModel.Process(this, payload.pid); | 198 process = new WebInspector.TracingModel.Process(this, payload.pid); |
| 199 this._processById[payload.pid] = process; | 199 this._processById.set(payload.pid, process); |
| 200 } | 200 } |
| 201 | 201 |
| 202 var eventsDelimiter = ",\n"; | 202 var eventsDelimiter = ",\n"; |
| 203 this._backingStorage.appendString(this._firstWritePending ? "[" : events Delimiter); | 203 this._backingStorage.appendString(this._firstWritePending ? "[" : events Delimiter); |
| 204 this._firstWritePending = false; | 204 this._firstWritePending = false; |
| 205 var stringPayload = JSON.stringify(payload); | 205 var stringPayload = JSON.stringify(payload); |
| 206 var isAccessible = payload.ph === WebInspector.TracingModel.Phase.Snapsh otObject; | 206 var isAccessible = payload.ph === WebInspector.TracingModel.Phase.Snapsh otObject; |
| 207 var backingStorage = null; | 207 var backingStorage = null; |
| 208 var keepStringsLessThan = 10000; | 208 var keepStringsLessThan = 10000; |
| 209 if (isAccessible && stringPayload.length > keepStringsLessThan) | 209 if (isAccessible && stringPayload.length > keepStringsLessThan) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 265 maximumRecordTime: function() | 265 maximumRecordTime: function() |
| 266 { | 266 { |
| 267 return this._maximumRecordTime; | 267 return this._maximumRecordTime; |
| 268 }, | 268 }, |
| 269 | 269 |
| 270 /** | 270 /** |
| 271 * @return {!Array.<!WebInspector.TracingModel.Process>} | 271 * @return {!Array.<!WebInspector.TracingModel.Process>} |
| 272 */ | 272 */ |
| 273 sortedProcesses: function() | 273 sortedProcesses: function() |
| 274 { | 274 { |
| 275 return WebInspector.TracingModel.NamedObject._sort(Object.values(this._p rocessById)); | 275 return WebInspector.TracingModel.NamedObject._sort(Array.from(this._proc essById.values())); |
|
lushnikov
2016/07/20 03:02:50
valuesArray
kozy
2016/07/20 17:55:18
Done.
| |
| 276 }, | 276 }, |
| 277 | 277 |
| 278 /** | 278 /** |
| 279 * @param {string} name | 279 * @param {string} name |
| 280 * @return {?WebInspector.TracingModel.Process} | 280 * @return {?WebInspector.TracingModel.Process} |
| 281 */ | 281 */ |
| 282 processByName: function(name) | 282 processByName: function(name) |
| 283 { | 283 { |
| 284 return this._processByName.get(name); | 284 return this._processByName.get(name); |
| 285 }, | 285 }, |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 743 * @constructor | 743 * @constructor |
| 744 * @extends {WebInspector.TracingModel.NamedObject} | 744 * @extends {WebInspector.TracingModel.NamedObject} |
| 745 * @param {!WebInspector.TracingModel} model | 745 * @param {!WebInspector.TracingModel} model |
| 746 * @param {number} id | 746 * @param {number} id |
| 747 */ | 747 */ |
| 748 WebInspector.TracingModel.Process = function(model, id) | 748 WebInspector.TracingModel.Process = function(model, id) |
| 749 { | 749 { |
| 750 WebInspector.TracingModel.NamedObject.call(this); | 750 WebInspector.TracingModel.NamedObject.call(this); |
| 751 this._setName("Process " + id); | 751 this._setName("Process " + id); |
| 752 this._id = id; | 752 this._id = id; |
| 753 /** @type {!Object.<number, !WebInspector.TracingModel.Thread>} */ | 753 /** @type {!Map<number, !WebInspector.TracingModel.Thread>} */ |
| 754 this._threads = {}; | 754 this._threads = new Map(); |
| 755 this._threadByName = new Map(); | 755 this._threadByName = new Map(); |
| 756 this._model = model; | 756 this._model = model; |
| 757 } | 757 } |
| 758 | 758 |
| 759 WebInspector.TracingModel.Process.prototype = { | 759 WebInspector.TracingModel.Process.prototype = { |
| 760 /** | 760 /** |
| 761 * @return {number} | 761 * @return {number} |
| 762 */ | 762 */ |
| 763 id: function() | 763 id: function() |
| 764 { | 764 { |
| 765 return this._id; | 765 return this._id; |
| 766 }, | 766 }, |
| 767 | 767 |
| 768 /** | 768 /** |
| 769 * @param {number} id | 769 * @param {number} id |
| 770 * @return {!WebInspector.TracingModel.Thread} | 770 * @return {!WebInspector.TracingModel.Thread} |
| 771 */ | 771 */ |
| 772 threadById: function(id) | 772 threadById: function(id) |
| 773 { | 773 { |
| 774 var thread = this._threads[id]; | 774 var thread = this._threads.get(id); |
| 775 if (!thread) { | 775 if (!thread) { |
| 776 thread = new WebInspector.TracingModel.Thread(this, id); | 776 thread = new WebInspector.TracingModel.Thread(this, id); |
| 777 this._threads[id] = thread; | 777 this._threads.set(id, thread); |
| 778 } | 778 } |
| 779 return thread; | 779 return thread; |
| 780 }, | 780 }, |
| 781 | 781 |
| 782 /** | 782 /** |
| 783 * @param {string} name | 783 * @param {string} name |
| 784 * @return {?WebInspector.TracingModel.Thread} | 784 * @return {?WebInspector.TracingModel.Thread} |
| 785 */ | 785 */ |
| 786 threadByName: function(name) | 786 threadByName: function(name) |
| 787 { | 787 { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 804 _addEvent: function(payload) | 804 _addEvent: function(payload) |
| 805 { | 805 { |
| 806 return this.threadById(payload.tid)._addEvent(payload); | 806 return this.threadById(payload.tid)._addEvent(payload); |
| 807 }, | 807 }, |
| 808 | 808 |
| 809 /** | 809 /** |
| 810 * @return {!Array.<!WebInspector.TracingModel.Thread>} | 810 * @return {!Array.<!WebInspector.TracingModel.Thread>} |
| 811 */ | 811 */ |
| 812 sortedThreads: function() | 812 sortedThreads: function() |
| 813 { | 813 { |
| 814 return WebInspector.TracingModel.NamedObject._sort(Object.values(this._t hreads)); | 814 return WebInspector.TracingModel.NamedObject._sort(Array.from(this._thre ads.values())); |
|
lushnikov
2016/07/20 03:02:50
valuesArray
kozy
2016/07/20 17:55:18
Done.
| |
| 815 }, | 815 }, |
| 816 | 816 |
| 817 __proto__: WebInspector.TracingModel.NamedObject.prototype | 817 __proto__: WebInspector.TracingModel.NamedObject.prototype |
| 818 } | 818 } |
| 819 | 819 |
| 820 /** | 820 /** |
| 821 * @constructor | 821 * @constructor |
| 822 * @extends {WebInspector.TracingModel.NamedObject} | 822 * @extends {WebInspector.TracingModel.NamedObject} |
| 823 * @param {!WebInspector.TracingModel.Process} process | 823 * @param {!WebInspector.TracingModel.Process} process |
| 824 * @param {number} id | 824 * @param {number} id |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 928 /** | 928 /** |
| 929 * @return {!Array.<!WebInspector.TracingModel.AsyncEvent>} | 929 * @return {!Array.<!WebInspector.TracingModel.AsyncEvent>} |
| 930 */ | 930 */ |
| 931 asyncEvents: function() | 931 asyncEvents: function() |
| 932 { | 932 { |
| 933 return this._asyncEvents; | 933 return this._asyncEvents; |
| 934 }, | 934 }, |
| 935 | 935 |
| 936 __proto__: WebInspector.TracingModel.NamedObject.prototype | 936 __proto__: WebInspector.TracingModel.NamedObject.prototype |
| 937 } | 937 } |
| OLD | NEW |