| 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/model/timed_event.html"> | 8 <link rel="import" href="/tracing/model/timed_event.html"> |
| 9 | 9 |
| 10 <script> | 10 <script> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 get memoryAllocatorDumps() { | 49 get memoryAllocatorDumps() { |
| 50 return this.memoryAllocatorDumps_; | 50 return this.memoryAllocatorDumps_; |
| 51 }, | 51 }, |
| 52 | 52 |
| 53 set memoryAllocatorDumps(memoryAllocatorDumps) { | 53 set memoryAllocatorDumps(memoryAllocatorDumps) { |
| 54 this.memoryAllocatorDumps_ = memoryAllocatorDumps; | 54 this.memoryAllocatorDumps_ = memoryAllocatorDumps; |
| 55 this.forceRebuildingMemoryAllocatorDumpByFullNameIndex(); | 55 this.forceRebuildingMemoryAllocatorDumpByFullNameIndex(); |
| 56 }, | 56 }, |
| 57 | 57 |
| 58 getMemoryAllocatorDumpByFullName: function(fullName) { | 58 getMemoryAllocatorDumpByFullName: function(fullName) { |
| 59 if (this.memoryAllocatorDumps_ === undefined) | 59 if (this.memoryAllocatorDumps_ === undefined) return undefined; |
| 60 return undefined; | |
| 61 | 60 |
| 62 // Lazily generate the index if necessary. | 61 // Lazily generate the index if necessary. |
| 63 if (this.memoryAllocatorDumpsByFullName_ === undefined) { | 62 if (this.memoryAllocatorDumpsByFullName_ === undefined) { |
| 64 var index = {}; | 63 var index = {}; |
| 65 function addDumpsToIndex(dumps) { | 64 function addDumpsToIndex(dumps) { |
| 66 dumps.forEach(function(dump) { | 65 dumps.forEach(function(dump) { |
| 67 index[dump.fullName] = dump; | 66 index[dump.fullName] = dump; |
| 68 addDumpsToIndex(dump.children); | 67 addDumpsToIndex(dump.children); |
| 69 }); | 68 }); |
| 70 } | 69 } |
| 71 addDumpsToIndex(this.memoryAllocatorDumps_); | 70 addDumpsToIndex(this.memoryAllocatorDumps_); |
| 72 this.memoryAllocatorDumpsByFullName_ = index; | 71 this.memoryAllocatorDumpsByFullName_ = index; |
| 73 } | 72 } |
| 74 | 73 |
| 75 return this.memoryAllocatorDumpsByFullName_[fullName]; | 74 return this.memoryAllocatorDumpsByFullName_[fullName]; |
| 76 }, | 75 }, |
| 77 | 76 |
| 78 forceRebuildingMemoryAllocatorDumpByFullNameIndex: function() { | 77 forceRebuildingMemoryAllocatorDumpByFullNameIndex: function() { |
| 79 // Clear the index and generate it lazily. | 78 // Clear the index and generate it lazily. |
| 80 this.memoryAllocatorDumpsByFullName_ = undefined; | 79 this.memoryAllocatorDumpsByFullName_ = undefined; |
| 81 }, | 80 }, |
| 82 | 81 |
| 83 iterateRootAllocatorDumps: function(fn, opt_this) { | 82 iterateRootAllocatorDumps: function(fn, opt_this) { |
| 84 if (this.memoryAllocatorDumps === undefined) | 83 if (this.memoryAllocatorDumps === undefined) return; |
| 85 return; | |
| 86 this.memoryAllocatorDumps.forEach(fn, opt_this || this); | 84 this.memoryAllocatorDumps.forEach(fn, opt_this || this); |
| 87 } | 85 } |
| 88 }; | 86 }; |
| 89 | 87 |
| 90 return { | 88 return { |
| 91 ContainerMemoryDump, | 89 ContainerMemoryDump, |
| 92 }; | 90 }; |
| 93 }); | 91 }); |
| 94 </script> | 92 </script> |
| OLD | NEW |