Chromium Code Reviews| Index: third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp |
| diff --git a/third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp b/third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp |
| index d269b2935139513e1d1452d0d4f7d7aa39f788ba..fb2431939d1f530f1fd534d01f42569446ff3eb0 100644 |
| --- a/third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp |
| +++ b/third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp |
| @@ -112,17 +112,19 @@ bool PartitionAllocMemoryDumpProvider::onMemoryDump(WebMemoryDumpLevelOfDetail l |
| if (m_isHeapProfilingEnabled) { |
| // Overhead should always be reported, regardless of light vs. heavy. |
| base::trace_event::TraceEventMemoryOverhead overhead; |
| - base::hash_map<base::trace_event::AllocationContext, size_t> bytesByContext; |
| + base::hash_map<base::trace_event::AllocationContext, base::trace_event::AllocationsSizeAndCount> metricsByContext; |
|
Dmitry Skiba
2016/04/14 19:07:30
I wonder if we should have typedef for this, like
Primiano Tucci (use gerrit)
2016/04/14 19:37:21
IMHO typedef just make the code less readable as y
ssid
2016/04/14 20:17:10
Acknowledged.
|
| { |
| MutexLocker locker(m_allocationRegisterMutex); |
| // Dump only the overhead estimation in non-detailed dumps. |
| if (levelOfDetail == WebMemoryDumpLevelOfDetail::Detailed) { |
| - for (const auto& allocSize : *m_allocationRegister) |
| - bytesByContext[allocSize.context] += allocSize.size; |
| + for (const auto& allocSize : *m_allocationRegister) { |
| + metricsByContext[allocSize.context].size += allocSize.size; |
| + metricsByContext[allocSize.context].count++; |
|
Dmitry Skiba
2016/04/14 19:07:30
Avoid second lookup.
ssid
2016/04/14 20:17:10
Done.
|
| + } |
| } |
| m_allocationRegister->EstimateTraceMemoryOverhead(&overhead); |
| } |
| - memoryDump->dumpHeapUsage(bytesByContext, overhead, "partition_alloc"); |
| + memoryDump->dumpHeapUsage(metricsByContext, overhead, "partition_alloc"); |
| } |
| PartitionStatsDumperImpl partitionStatsDumper(memoryDump, levelOfDetail); |