| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "platform/PartitionAllocMemoryDumpProvider.h" | 5 #include "platform/PartitionAllocMemoryDumpProvider.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/trace_event/heap_profiler_allocation_context.h" | 8 #include "base/trace_event/heap_profiler_allocation_context.h" |
| 9 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" | 9 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
| 10 #include "base/trace_event/heap_profiler_allocation_register.h" | 10 #include "base/trace_event/heap_profiler_allocation_register.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 memoryDump->DumpHeapUsage(metricsByContext, overhead, "partition_alloc")
; | 130 memoryDump->DumpHeapUsage(metricsByContext, overhead, "partition_alloc")
; |
| 131 } | 131 } |
| 132 | 132 |
| 133 PartitionStatsDumperImpl partitionStatsDumper(memoryDump, levelOfDetail); | 133 PartitionStatsDumperImpl partitionStatsDumper(memoryDump, levelOfDetail); |
| 134 | 134 |
| 135 base::trace_event::MemoryAllocatorDump* partitionsDump = memoryDump->CreateA
llocatorDump( | 135 base::trace_event::MemoryAllocatorDump* partitionsDump = memoryDump->CreateA
llocatorDump( |
| 136 base::StringPrintf("%s/%s", kPartitionAllocDumpName, kPartitionsDumpName
)); | 136 base::StringPrintf("%s/%s", kPartitionAllocDumpName, kPartitionsDumpName
)); |
| 137 | 137 |
| 138 // This method calls memoryStats.partitionsDumpBucketStats with memory stati
stics. | 138 // This method calls memoryStats.partitionsDumpBucketStats with memory stati
stics. |
| 139 WTF::Partitions::dumpMemoryStats(levelOfDetail == MemoryDumpLevelOfDetail::L
IGHT, &partitionStatsDumper); | 139 WTF::Partitions::dumpMemoryStats(levelOfDetail != MemoryDumpLevelOfDetail::D
ETAILED, &partitionStatsDumper); |
| 140 | 140 |
| 141 base::trace_event::MemoryAllocatorDump* allocatedObjectsDump = memoryDump->C
reateAllocatorDump(Partitions::kAllocatedObjectPoolName); | 141 base::trace_event::MemoryAllocatorDump* allocatedObjectsDump = memoryDump->C
reateAllocatorDump(Partitions::kAllocatedObjectPoolName); |
| 142 allocatedObjectsDump->AddScalar("size", "bytes", partitionStatsDumper.totalA
ctiveBytes()); | 142 allocatedObjectsDump->AddScalar("size", "bytes", partitionStatsDumper.totalA
ctiveBytes()); |
| 143 memoryDump->AddOwnershipEdge(allocatedObjectsDump->guid(), partitionsDump->g
uid()); | 143 memoryDump->AddOwnershipEdge(allocatedObjectsDump->guid(), partitionsDump->g
uid()); |
| 144 | 144 |
| 145 return true; | 145 return true; |
| 146 } | 146 } |
| 147 | 147 |
| 148 // |m_allocationRegister| should be initialized only when necessary to avoid was
te of memory. | 148 // |m_allocationRegister| should be initialized only when necessary to avoid was
te of memory. |
| 149 PartitionAllocMemoryDumpProvider::PartitionAllocMemoryDumpProvider() | 149 PartitionAllocMemoryDumpProvider::PartitionAllocMemoryDumpProvider() |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 183 } |
| 184 | 184 |
| 185 void PartitionAllocMemoryDumpProvider::remove(void* address) | 185 void PartitionAllocMemoryDumpProvider::remove(void* address) |
| 186 { | 186 { |
| 187 MutexLocker locker(m_allocationRegisterMutex); | 187 MutexLocker locker(m_allocationRegisterMutex); |
| 188 if (m_allocationRegister) | 188 if (m_allocationRegister) |
| 189 m_allocationRegister->Remove(address); | 189 m_allocationRegister->Remove(address); |
| 190 } | 190 } |
| 191 | 191 |
| 192 } // namespace blink | 192 } // namespace blink |
| OLD | NEW |