Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/CPUProfileDataModel.js

Issue 2450663004: DevTools: do not allow using 'this' before call into super. (Closed)
Patch Set: rebaselined Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 * @constructor 6 * @constructor
7 * @extends {WebInspector.ProfileNode} 7 * @extends {WebInspector.ProfileNode}
8 * @param {!ProfilerAgent.ProfileNode} node 8 * @param {!ProfilerAgent.ProfileNode} node
9 * @param {number} sampleTime 9 * @param {number} sampleTime
10 */ 10 */
(...skipping 19 matching lines...) Expand all
30 __proto__: WebInspector.ProfileNode.prototype 30 __proto__: WebInspector.ProfileNode.prototype
31 }; 31 };
32 32
33 /** 33 /**
34 * @constructor 34 * @constructor
35 * @extends {WebInspector.ProfileTreeModel} 35 * @extends {WebInspector.ProfileTreeModel}
36 * @param {!ProfilerAgent.Profile} profile 36 * @param {!ProfilerAgent.Profile} profile
37 */ 37 */
38 WebInspector.CPUProfileDataModel = function(profile) 38 WebInspector.CPUProfileDataModel = function(profile)
39 { 39 {
40 WebInspector.ProfileTreeModel.call(this);
40 var isLegacyFormat = !!profile["head"]; 41 var isLegacyFormat = !!profile["head"];
41 if (isLegacyFormat) { 42 if (isLegacyFormat) {
42 // Legacy format contains raw timestamps and start/stop times are in sec onds. 43 // Legacy format contains raw timestamps and start/stop times are in sec onds.
43 this.profileStartTime = profile.startTime * 1000; 44 this.profileStartTime = profile.startTime * 1000;
44 this.profileEndTime = profile.endTime * 1000; 45 this.profileEndTime = profile.endTime * 1000;
45 this.timestamps = profile.timestamps; 46 this.timestamps = profile.timestamps;
46 this._compatibilityConversionHeadToNodes(profile); 47 this._compatibilityConversionHeadToNodes(profile);
47 } else { 48 } else {
48 // Current format encodes timestamps as deltas. Start/stop times are in microseconds. 49 // Current format encodes timestamps as deltas. Start/stop times are in microseconds.
49 this.profileStartTime = profile.startTime / 1000; 50 this.profileStartTime = profile.startTime / 1000;
50 this.profileEndTime = profile.endTime / 1000; 51 this.profileEndTime = profile.endTime / 1000;
51 this.timestamps = this._convertTimeDeltas(profile); 52 this.timestamps = this._convertTimeDeltas(profile);
52 } 53 }
53 this.samples = profile.samples; 54 this.samples = profile.samples;
54 this.totalHitCount = 0; 55 this.totalHitCount = 0;
55 this.profileHead = this._translateProfileTree(profile.nodes); 56 this.profileHead = this._translateProfileTree(profile.nodes);
56 WebInspector.ProfileTreeModel.call(this, this.profileHead); 57 this.initialize(this.profileHead);
57 this._extractMetaNodes(); 58 this._extractMetaNodes();
58 if (this.samples) { 59 if (this.samples) {
59 this._buildIdToNodeMap(); 60 this._buildIdToNodeMap();
60 this._sortSamples(); 61 this._sortSamples();
61 this._normalizeTimestamps(); 62 this._normalizeTimestamps();
62 } 63 }
63 }; 64 };
64 65
65 WebInspector.CPUProfileDataModel.prototype = { 66 WebInspector.CPUProfileDataModel.prototype = {
66 /** 67 /**
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 * @param {number} index 369 * @param {number} index
369 * @return {?WebInspector.CPUProfileNode} 370 * @return {?WebInspector.CPUProfileNode}
370 */ 371 */
371 nodeByIndex: function(index) 372 nodeByIndex: function(index)
372 { 373 {
373 return this._idToNode.get(this.samples[index]) || null; 374 return this._idToNode.get(this.samples[index]) || null;
374 }, 375 },
375 376
376 __proto__: WebInspector.ProfileTreeModel.prototype 377 __proto__: WebInspector.ProfileTreeModel.prototype
377 }; 378 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698