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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/profiler/HeapProfileView.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 * @implements {WebInspector.Searchable} 7 * @implements {WebInspector.Searchable}
8 * @extends {WebInspector.ProfileView} 8 * @extends {WebInspector.ProfileView}
9 * @param {!WebInspector.SamplingHeapProfileHeader} profileHeader 9 * @param {!WebInspector.SamplingHeapProfileHeader} profileHeader
10 */ 10 */
11 WebInspector.HeapProfileView = function(profileHeader) 11 WebInspector.HeapProfileView = function(profileHeader)
12 { 12 {
13 WebInspector.ProfileView.call(this);
13 this._profileHeader = profileHeader; 14 this._profileHeader = profileHeader;
14 this.profile = new WebInspector.SamplingHeapProfileModel(profileHeader._prof ile || profileHeader.protocolProfile()); 15 this.profile = new WebInspector.SamplingHeapProfileModel(profileHeader._prof ile || profileHeader.protocolProfile());
15 this.adjustedTotal = this.profile.total; 16 this.adjustedTotal = this.profile.total;
16 var views = [ 17 var views = [
17 WebInspector.ProfileView.ViewTypes.Flame, 18 WebInspector.ProfileView.ViewTypes.Flame,
18 WebInspector.ProfileView.ViewTypes.Heavy, 19 WebInspector.ProfileView.ViewTypes.Heavy,
19 WebInspector.ProfileView.ViewTypes.Tree 20 WebInspector.ProfileView.ViewTypes.Tree
20 ]; 21 ];
21 WebInspector.ProfileView.call(this, new WebInspector.HeapProfileView.NodeFor matter(this), views); 22 this.initialize(new WebInspector.HeapProfileView.NodeFormatter(this), views) ;
22 }; 23 };
23 24
24 WebInspector.HeapProfileView.prototype = { 25 WebInspector.HeapProfileView.prototype = {
25 /** 26 /**
26 * @override 27 * @override
27 * @param {string} columnId 28 * @param {string} columnId
28 * @return {string} 29 * @return {string}
29 */ 30 */
30 columnHeader: function(columnId) 31 columnHeader: function(columnId)
31 { 32 {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 __proto__: WebInspector.ProfileNode.prototype 238 __proto__: WebInspector.ProfileNode.prototype
238 }; 239 };
239 240
240 /** 241 /**
241 * @constructor 242 * @constructor
242 * @extends {WebInspector.ProfileTreeModel} 243 * @extends {WebInspector.ProfileTreeModel}
243 * @param {!HeapProfilerAgent.SamplingHeapProfile} profile 244 * @param {!HeapProfilerAgent.SamplingHeapProfile} profile
244 */ 245 */
245 WebInspector.SamplingHeapProfileModel = function(profile) 246 WebInspector.SamplingHeapProfileModel = function(profile)
246 { 247 {
247 WebInspector.ProfileTreeModel.call(this, this._translateProfileTree(profile. head)); 248 WebInspector.ProfileTreeModel.call(this);
248 }; 249 this.initialize(translateProfileTree(profile.head));
249 250
250 WebInspector.SamplingHeapProfileModel.prototype = {
251 /** 251 /**
252 * @param {!HeapProfilerAgent.SamplingHeapProfileNode} root 252 * @param {!HeapProfilerAgent.SamplingHeapProfileNode} root
253 * @return {!WebInspector.SamplingHeapProfileNode} 253 * @return {!WebInspector.SamplingHeapProfileNode}
254 */ 254 */
255 _translateProfileTree: function(root) 255 function translateProfileTree(root)
256 { 256 {
257 var resultRoot = new WebInspector.SamplingHeapProfileNode(root); 257 var resultRoot = new WebInspector.SamplingHeapProfileNode(root);
258 var targetNodeStack = [resultRoot]; 258 var targetNodeStack = [resultRoot];
259 var sourceNodeStack = [root]; 259 var sourceNodeStack = [root];
260 while (sourceNodeStack.length) { 260 while (sourceNodeStack.length) {
261 var sourceNode = sourceNodeStack.pop(); 261 var sourceNode = sourceNodeStack.pop();
262 var parentNode = targetNodeStack.pop(); 262 var parentNode = targetNodeStack.pop();
263 parentNode.children = sourceNode.children.map(child => new WebInspec tor.SamplingHeapProfileNode(child)); 263 parentNode.children = sourceNode.children.map(child => new WebInspec tor.SamplingHeapProfileNode(child));
264 sourceNodeStack.push.apply(sourceNodeStack, sourceNode.children); 264 sourceNodeStack.push.apply(sourceNodeStack, sourceNode.children);
265 targetNodeStack.push.apply(targetNodeStack, parentNode.children); 265 targetNodeStack.push.apply(targetNodeStack, parentNode.children);
266 } 266 }
267 return resultRoot; 267 return resultRoot;
268 }, 268 }
269 };
270
271 WebInspector.SamplingHeapProfileModel.prototype = {
269 272
270 __proto__: WebInspector.ProfileTreeModel.prototype 273 __proto__: WebInspector.ProfileTreeModel.prototype
271 }; 274 };
272 275
273 /** 276 /**
274 * @constructor 277 * @constructor
275 * @implements {WebInspector.ProfileDataGridNode.Formatter} 278 * @implements {WebInspector.ProfileDataGridNode.Formatter}
276 * @param {!WebInspector.ProfileView} profileView 279 * @param {!WebInspector.ProfileView} profileView
277 */ 280 */
278 WebInspector.HeapProfileView.NodeFormatter = function(profileView) 281 WebInspector.HeapProfileView.NodeFormatter = function(profileView)
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 var linkifier = new WebInspector.Linkifier(); 434 var linkifier = new WebInspector.Linkifier();
432 var link = linkifier.maybeLinkifyConsoleCallFrame(this._target, node.cal lFrame); 435 var link = linkifier.maybeLinkifyConsoleCallFrame(this._target, node.cal lFrame);
433 if (link) 436 if (link)
434 pushEntryInfoRow(WebInspector.UIString("URL"), link.textContent); 437 pushEntryInfoRow(WebInspector.UIString("URL"), link.textContent);
435 linkifier.dispose(); 438 linkifier.dispose();
436 return WebInspector.ProfileView.buildPopoverTable(entryInfo); 439 return WebInspector.ProfileView.buildPopoverTable(entryInfo);
437 }, 440 },
438 441
439 __proto__: WebInspector.ProfileFlameChartDataProvider.prototype 442 __proto__: WebInspector.ProfileFlameChartDataProvider.prototype
440 }; 443 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698