Chromium Code Reviews| 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 "config.h" | 5 #include "config.h" |
| 6 #include "platform/PartitionAllocMemoryDumpProvider.h" | 6 #include "platform/PartitionAllocMemoryDumpProvider.h" |
| 7 | 7 |
| 8 #include "public/platform/WebMemoryAllocatorDump.h" | 8 #include "public/platform/WebMemoryAllocatorDump.h" |
| 9 #include "public/platform/WebProcessMemoryDump.h" | 9 #include "public/platform/WebProcessMemoryDump.h" |
| 10 #include "wtf/Partitions.h" | 10 #include "wtf/Partitions.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 using namespace WTF; | 16 using namespace WTF; |
| 17 | 17 |
| 18 const char kPartitionAllocDumpName[] = "partition_alloc"; | 18 const char kPartitionAllocDumpName[] = "partition_alloc"; |
| 19 const char kPartitionsDumpName[] = "partitions"; | 19 const char kPartitionsDumpName[] = "partitions"; |
|
haraken
2015/09/30 23:56:53
Maybe do you want to move this to Partitions.h in
ssid
2015/10/01 10:24:41
Hm, actually these strings are not required to be
| |
| 20 | 20 |
| 21 String getPartitionDumpName(const char* partitionName) | 21 String getPartitionDumpName(const char* partitionName) |
| 22 { | 22 { |
| 23 return String::format("%s/%s/%s", kPartitionAllocDumpName, kPartitionsDumpNa me, partitionName); | 23 return String::format("%s/%s/%s", kPartitionAllocDumpName, kPartitionsDumpNa me, partitionName); |
| 24 } | 24 } |
| 25 | 25 |
| 26 // This class is used to invert the dependency of PartitionAlloc on the | 26 // This class is used to invert the dependency of PartitionAlloc on the |
| 27 // PartitionAllocMemoryDumpProvider. This implements an interface that will | 27 // PartitionAllocMemoryDumpProvider. This implements an interface that will |
| 28 // be called with memory statistics for each bucket in the allocator. | 28 // be called with memory statistics for each bucket in the allocator. |
| 29 class PartitionStatsDumperImpl final : public PartitionStatsDumper { | 29 class PartitionStatsDumperImpl final : public PartitionStatsDumper { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 bool PartitionAllocMemoryDumpProvider::onMemoryDump(WebMemoryDumpLevelOfDetail l evelOfDetail, WebProcessMemoryDump* memoryDump) | 93 bool PartitionAllocMemoryDumpProvider::onMemoryDump(WebMemoryDumpLevelOfDetail l evelOfDetail, WebProcessMemoryDump* memoryDump) |
| 94 { | 94 { |
| 95 PartitionStatsDumperImpl partitionStatsDumper(memoryDump, levelOfDetail); | 95 PartitionStatsDumperImpl partitionStatsDumper(memoryDump, levelOfDetail); |
| 96 | 96 |
| 97 WebMemoryAllocatorDump* partitionsDump = memoryDump->createMemoryAllocatorDu mp( | 97 WebMemoryAllocatorDump* partitionsDump = memoryDump->createMemoryAllocatorDu mp( |
| 98 String::format("%s/%s", kPartitionAllocDumpName, kPartitionsDumpName)); | 98 String::format("%s/%s", kPartitionAllocDumpName, kPartitionsDumpName)); |
| 99 | 99 |
| 100 // This method calls memoryStats.partitionsDumpBucketStats with memory stati stics. | 100 // This method calls memoryStats.partitionsDumpBucketStats with memory stati stics. |
| 101 WTF::Partitions::dumpMemoryStats(levelOfDetail == WebMemoryDumpLevelOfDetail ::Light, &partitionStatsDumper); | 101 WTF::Partitions::dumpMemoryStats(levelOfDetail == WebMemoryDumpLevelOfDetail ::Light, &partitionStatsDumper); |
| 102 | 102 |
| 103 WebMemoryAllocatorDump* allocatedObjectsDump = memoryDump->createMemoryAlloc atorDump( | 103 WebMemoryAllocatorDump* allocatedObjectsDump = memoryDump->createMemoryAlloc atorDump(String(Partitions::kAllocatedObjectPoolName)); |
| 104 String::format("%s/allocated_objects", kPartitionAllocDumpName)); | |
| 105 allocatedObjectsDump->AddScalar("size", "bytes", partitionStatsDumper.totalA ctiveBytes()); | 104 allocatedObjectsDump->AddScalar("size", "bytes", partitionStatsDumper.totalA ctiveBytes()); |
| 106 memoryDump->AddOwnershipEdge(allocatedObjectsDump->guid(), partitionsDump->g uid()); | 105 memoryDump->AddOwnershipEdge(allocatedObjectsDump->guid(), partitionsDump->g uid()); |
| 107 | 106 |
| 108 return true; | 107 return true; |
| 109 } | 108 } |
| 110 | 109 |
| 111 PartitionAllocMemoryDumpProvider::PartitionAllocMemoryDumpProvider() | 110 PartitionAllocMemoryDumpProvider::PartitionAllocMemoryDumpProvider() |
| 112 { | 111 { |
| 113 } | 112 } |
| 114 | 113 |
| 115 PartitionAllocMemoryDumpProvider::~PartitionAllocMemoryDumpProvider() | 114 PartitionAllocMemoryDumpProvider::~PartitionAllocMemoryDumpProvider() |
| 116 { | 115 { |
| 117 } | 116 } |
| 118 | 117 |
| 119 } // namespace blink | 118 } // namespace blink |
| OLD | NEW |