| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 | 7 |
| 8 <link rel="import" href="/tracing/base/iteration_helpers.html"> | 8 <link rel="import" href="/tracing/base/iteration_helpers.html"> |
| 9 <link rel="import" href="/tracing/base/range.html"> | 9 <link rel="import" href="/tracing/base/range.html"> |
| 10 <link rel="import" href="/tracing/model/memory_allocator_dump.html"> | 10 <link rel="import" href="/tracing/model/memory_allocator_dump.html"> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 </polymer-element> | 65 </polymer-element> |
| 66 <script> | 66 <script> |
| 67 'use strict'; | 67 'use strict'; |
| 68 | 68 |
| 69 tr.exportTo('tr.ui.analysis', function() { | 69 tr.exportTo('tr.ui.analysis', function() { |
| 70 | 70 |
| 71 // Constant representing the context in suballocation rows. | 71 // Constant representing the context in suballocation rows. |
| 72 var SUBALLOCATION_CONTEXT = true; | 72 var SUBALLOCATION_CONTEXT = true; |
| 73 | 73 |
| 74 // Size attribute names. | 74 // Size attribute names. |
| 75 var SizeAttributeInfoType = tr.model.SizeAttributeInfoType; | 75 var MemoryAllocatorDumpInfoType = tr.model.MemoryAllocatorDumpInfoType; |
| 76 var PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN = | 76 var PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN = |
| 77 SizeAttributeInfoType.PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN; | 77 MemoryAllocatorDumpInfoType.PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN; |
| 78 var PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER = | 78 var PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER = |
| 79 SizeAttributeInfoType.PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER; | 79 MemoryAllocatorDumpInfoType.PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER; |
| 80 | 80 |
| 81 // Unicode symbols used for memory cell info icons and messages. | 81 // Unicode symbols used for memory cell info icons and messages. |
| 82 var LEFTWARDS_OPEN_HEADED_ARROW = String.fromCharCode(0x21FD); | 82 var LEFTWARDS_OPEN_HEADED_ARROW = String.fromCharCode(0x21FD); |
| 83 var RIGHTWARDS_OPEN_HEADED_ARROW = String.fromCharCode(0x21FE); | 83 var RIGHTWARDS_OPEN_HEADED_ARROW = String.fromCharCode(0x21FE); |
| 84 var EN_DASH = String.fromCharCode(0x2013); | 84 var EN_DASH = String.fromCharCode(0x2013); |
| 85 var CIRCLED_LATIN_SMALL_LETTER_I = String.fromCharCode(0x24D8); | 85 var CIRCLED_LATIN_SMALL_LETTER_I = String.fromCharCode(0x24D8); |
| 86 | 86 |
| 87 /** @constructor */ | 87 /** @constructor */ |
| 88 function AllocatorDumpNameColumn() { | 88 function AllocatorDumpNameColumn() { |
| 89 tr.ui.analysis.TitleColumn.call(this, 'Component'); | 89 tr.ui.analysis.TitleColumn.call(this, 'Component'); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 if (units !== 'bytes') | 354 if (units !== 'bytes') |
| 355 throw new Error('Invalid size column units: ' + units); | 355 throw new Error('Invalid size column units: ' + units); |
| 356 tr.ui.analysis.ScalarMemoryColumn.call( | 356 tr.ui.analysis.ScalarMemoryColumn.call( |
| 357 this, name, units, cellGetter, aggregationMode); | 357 this, name, units, cellGetter, aggregationMode); |
| 358 } | 358 } |
| 359 | 359 |
| 360 SizeColumn.prototype = { | 360 SizeColumn.prototype = { |
| 361 __proto__: tr.ui.analysis.ScalarMemoryColumn.prototype, | 361 __proto__: tr.ui.analysis.ScalarMemoryColumn.prototype, |
| 362 | 362 |
| 363 addInfos: function(attrs, memoryAllocatorDumps, infos) { | 363 addInfos: function(attrs, memoryAllocatorDumps, infos) { |
| 364 if (memoryAllocatorDumps === undefined) |
| 365 return; |
| 364 this.addOverlapInfo_(attrs, memoryAllocatorDumps, infos); | 366 this.addOverlapInfo_(attrs, memoryAllocatorDumps, infos); |
| 365 this.addProvidedSizeWarningInfos_(attrs, infos); | 367 this.addProvidedSizeWarningInfos_(attrs, memoryAllocatorDumps, infos); |
| 366 }, | 368 }, |
| 367 | 369 |
| 368 addOverlapInfo_: function(attrs, memoryAllocatorDumps, infos) { | 370 addOverlapInfo_: function(attrs, memoryAllocatorDumps, infos) { |
| 369 if (memoryAllocatorDumps === undefined) | |
| 370 return; | |
| 371 | |
| 372 // Sibling allocator dump name -> {count, size}. The latter field (size) | 371 // Sibling allocator dump name -> {count, size}. The latter field (size) |
| 373 // is omitted in multi-selection mode. | 372 // is omitted in multi-selection mode. |
| 374 var siblingNameToEntry = new Map(); | 373 var siblingNameToEntry = new Map(); |
| 375 for (var i = 0; i < attrs.length; i++) { | 374 for (var i = 0; i < attrs.length; i++) { |
| 376 if (attrs[i] === undefined) | 375 if (attrs[i] === undefined) |
| 377 continue; | 376 continue; |
| 378 var dump = memoryAllocatorDumps[i]; | 377 var dump = memoryAllocatorDumps[i]; |
| 379 if (dump === SUBALLOCATION_CONTEXT) | 378 if (dump === SUBALLOCATION_CONTEXT) |
| 380 return; // No ownership of suballocation internal rows. | 379 return; // No ownership of suballocation internal rows. |
| 381 var ownedBySiblingSizes = dump.ownedBySiblingSizes; | 380 var ownedBySiblingSizes = dump.ownedBySiblingSizes; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 405 messageBuilder.appendSomeTimestampsQuantifier(); | 404 messageBuilder.appendSomeTimestampsQuantifier(); |
| 406 }, this); | 405 }, this); |
| 407 infos.push({ | 406 infos.push({ |
| 408 message: messageBuilder.build(), | 407 message: messageBuilder.build(), |
| 409 icon: CIRCLED_LATIN_SMALL_LETTER_I, | 408 icon: CIRCLED_LATIN_SMALL_LETTER_I, |
| 410 color: 'blue' | 409 color: 'blue' |
| 411 }); | 410 }); |
| 412 } | 411 } |
| 413 }, | 412 }, |
| 414 | 413 |
| 415 addProvidedSizeWarningInfos_: function(attrs, infos) { | 414 addProvidedSizeWarningInfos_: function(attrs, memoryAllocatorDumps, infos) { |
| 416 // Info type (see SizeAttributeInfoType) -> {count, providedSize, | 415 // Info type (see MemoryAllocatorDumpInfoType) -> {count, providedSize, |
| 417 // dependencySize}. The latter two fields (providedSize and | 416 // dependencySize}. The latter two fields (providedSize and |
| 418 // dependencySize) are omitted in multi-selection mode. | 417 // dependencySize) are omitted in multi-selection mode. |
| 419 var infoTypeToEntry = new Map(); | 418 var infoTypeToEntry = new Map(); |
| 420 for (var i = 0; i < attrs.length; i++) { | 419 for (var i = 0; i < attrs.length; i++) { |
| 421 var attr = attrs[i]; | 420 var attr = attrs[i]; |
| 422 if (attr === undefined) | 421 if (attr === undefined) |
| 423 continue; | 422 continue; |
| 424 attr.infos.forEach(function(attrInfo) { | 423 var dump = memoryAllocatorDumps[i]; |
| 425 getAndUpdateEntry(infoTypeToEntry, attrInfo.type, function(newEntry) { | 424 if (dump === SUBALLOCATION_CONTEXT) |
| 425 return; // Suballocation internal rows have no provided size. |
| 426 dump.infos.forEach(function(dumpInfo) { |
| 427 getAndUpdateEntry(infoTypeToEntry, dumpInfo.type, function(newEntry) { |
| 426 if (attrs.length === 1 /* single-selection mode */) { | 428 if (attrs.length === 1 /* single-selection mode */) { |
| 427 newEntry.providedSize = attrInfo.providedSize; | 429 newEntry.providedSize = dumpInfo.providedSize; |
| 428 newEntry.dependencySize = attrInfo.dependencySize; | 430 newEntry.dependencySize = dumpInfo.dependencySize; |
| 429 } | 431 } |
| 430 }); | 432 }); |
| 431 }); | 433 }); |
| 432 } | 434 } |
| 433 | 435 |
| 434 // Emit a warning info for every info type. | 436 // Emit a warning info for every info type. |
| 435 for (var infoType of infoTypeToEntry.keys()) { | 437 for (var infoType of infoTypeToEntry.keys()) { |
| 436 var entry = infoTypeToEntry.get(infoType); | 438 var entry = infoTypeToEntry.get(infoType); |
| 437 var messageBuilder = new SizeInfoMessageBuilder(); | 439 var messageBuilder = new SizeInfoMessageBuilder(); |
| 438 messageBuilder.append('provided size'); | 440 messageBuilder.append('provided size'); |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 | 777 |
| 776 return { | 778 return { |
| 777 // All exports are for testing only. | 779 // All exports are for testing only. |
| 778 SUBALLOCATION_CONTEXT: SUBALLOCATION_CONTEXT, | 780 SUBALLOCATION_CONTEXT: SUBALLOCATION_CONTEXT, |
| 779 AllocatorDumpNameColumn: AllocatorDumpNameColumn, | 781 AllocatorDumpNameColumn: AllocatorDumpNameColumn, |
| 780 EffectiveSizeColumn: EffectiveSizeColumn, | 782 EffectiveSizeColumn: EffectiveSizeColumn, |
| 781 SizeColumn: SizeColumn | 783 SizeColumn: SizeColumn |
| 782 }; | 784 }; |
| 783 }); | 785 }); |
| 784 </script> | 786 </script> |
| OLD | NEW |