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

Side by Side Diff: Source/devtools/front_end/HeapSnapshotGridNodes.js

Issue 222443003: DevTools: Treat system object distances with less priority (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressing comments. Created 6 years, 8 months 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 }, 177 },
178 178
179 /** 179 /**
180 * @override 180 * @override
181 */ 181 */
182 wasDetached: function() 182 wasDetached: function()
183 { 183 {
184 this._dataGrid.nodeWasDetached(this); 184 this._dataGrid.nodeWasDetached(this);
185 }, 185 },
186 186
187 /**
188 * @param {number} num
189 * @return {string}
190 */
187 _toPercentString: function(num) 191 _toPercentString: function(num)
188 { 192 {
189 return num.toFixed(0) + "\u2009%"; // \u2009 is a thin space. 193 return num.toFixed(0) + "\u2009%"; // \u2009 is a thin space.
190 }, 194 },
191 195
192 /** 196 /**
197 * @param {number} distance
198 * @return {string}
199 */
200 _toUIDistance: function(distance)
201 {
202 var baseSystemDistance = WebInspector.HeapSnapshotCommon.baseSystemDista nce;
203 return distance >= 0 && distance < baseSystemDistance ? WebInspector.UIS tring("%d", distance) : WebInspector.UIString("\u2212");
204 },
205
206 /**
193 * @return {!Array.<!WebInspector.DataGridNode>} 207 * @return {!Array.<!WebInspector.DataGridNode>}
194 */ 208 */
195 allChildren: function() 209 allChildren: function()
196 { 210 {
197 return this._dataGrid.allChildren(this); 211 return this._dataGrid.allChildren(this);
198 }, 212 },
199 213
200 /** 214 /**
201 * @param {number} index 215 * @param {number} index
202 */ 216 */
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 this._reachableFromWindow = true; 513 this._reachableFromWindow = true;
500 } else if (node.canBeQueried) 514 } else if (node.canBeQueried)
501 this._reachableFromWindow = true; 515 this._reachableFromWindow = true;
502 if (node.detachedDOMTreeNode) 516 if (node.detachedDOMTreeNode)
503 this.detachedDOMTreeNode = true; 517 this.detachedDOMTreeNode = true;
504 518
505 var snapshot = dataGrid.snapshot; 519 var snapshot = dataGrid.snapshot;
506 var shallowSizePercent = this._shallowSize / snapshot.totalSize * 100.0; 520 var shallowSizePercent = this._shallowSize / snapshot.totalSize * 100.0;
507 var retainedSizePercent = this._retainedSize / snapshot.totalSize * 100.0; 521 var retainedSizePercent = this._retainedSize / snapshot.totalSize * 100.0;
508 this.data = { 522 this.data = {
509 "distance": this._distance, 523 "distance": this._toUIDistance(this._distance),
510 "shallowSize": Number.withThousandsSeparator(this._shallowSize), 524 "shallowSize": Number.withThousandsSeparator(this._shallowSize),
511 "retainedSize": Number.withThousandsSeparator(this._retainedSize), 525 "retainedSize": Number.withThousandsSeparator(this._retainedSize),
512 "shallowSize-percent": this._toPercentString(shallowSizePercent), 526 "shallowSize-percent": this._toPercentString(shallowSizePercent),
513 "retainedSize-percent": this._toPercentString(retainedSizePercent) 527 "retainedSize-percent": this._toPercentString(retainedSizePercent)
514 }; 528 };
515 }; 529 };
516 530
517 WebInspector.HeapSnapshotGenericObjectNode.prototype = { 531 WebInspector.HeapSnapshotGenericObjectNode.prototype = {
518 /** 532 /**
519 * @return {?{snapshot:!WebInspector.HeapSnapshotProxy, snapshotNodeIndex:nu mber}} 533 * @return {?{snapshot:!WebInspector.HeapSnapshotProxy, snapshotNodeIndex:nu mber}}
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 this._shallowSize = aggregate.self; 912 this._shallowSize = aggregate.self;
899 this._retainedSize = aggregate.maxRet; 913 this._retainedSize = aggregate.maxRet;
900 914
901 var snapshot = dataGrid.snapshot; 915 var snapshot = dataGrid.snapshot;
902 var countPercent = this._count / snapshot.nodeCount * 100.0; 916 var countPercent = this._count / snapshot.nodeCount * 100.0;
903 var retainedSizePercent = this._retainedSize / snapshot.totalSize * 100.0; 917 var retainedSizePercent = this._retainedSize / snapshot.totalSize * 100.0;
904 var shallowSizePercent = this._shallowSize / snapshot.totalSize * 100.0; 918 var shallowSizePercent = this._shallowSize / snapshot.totalSize * 100.0;
905 919
906 this.data = { 920 this.data = {
907 "object": className, 921 "object": className,
908 "count": Number.withThousandsSeparator(this._count), 922 "count": Number.withThousandsSeparator(this._count),
909 "distance": this._distance, 923 "distance": this._toUIDistance(this._distance),
910 "shallowSize": Number.withThousandsSeparator(this._shallowSize), 924 "shallowSize": Number.withThousandsSeparator(this._shallowSize),
911 "retainedSize": Number.withThousandsSeparator(this._retainedSize), 925 "retainedSize": Number.withThousandsSeparator(this._retainedSize),
912 "count-percent": this._toPercentString(countPercent), 926 "count-percent": this._toPercentString(countPercent),
913 "shallowSize-percent": this._toPercentString(shallowSizePercent), 927 "shallowSize-percent": this._toPercentString(shallowSizePercent),
914 "retainedSize-percent": this._toPercentString(retainedSizePercent) 928 "retainedSize-percent": this._toPercentString(retainedSizePercent)
915 }; 929 };
916 } 930 }
917 931
918 WebInspector.HeapSnapshotConstructorNode.prototype = { 932 WebInspector.HeapSnapshotConstructorNode.prototype = {
919 /** 933 /**
920 * @override 934 * @override
921 * @return {!WebInspector.HeapSnapshotProviderProxy} 935 * @return {!WebInspector.HeapSnapshotProviderProxy}
922 */ 936 */
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 /** 1454 /**
1441 * @return {number} 1455 * @return {number}
1442 */ 1456 */
1443 allocationNodeId: function() 1457 allocationNodeId: function()
1444 { 1458 {
1445 return this.data.id; 1459 return this.data.id;
1446 }, 1460 },
1447 1461
1448 __proto__: WebInspector.HeapSnapshotGridNode.prototype 1462 __proto__: WebInspector.HeapSnapshotGridNode.prototype
1449 } 1463 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698