Chromium Code Reviews| Index: base/trace_event/memory_allocator_dump.cc |
| diff --git a/base/trace_event/memory_allocator_dump.cc b/base/trace_event/memory_allocator_dump.cc |
| index 7583763889ef8b975840d0bcadd12feb359be9a6..e6502e92eb61ff834c65b602ac4085589f6c0ee8 100644 |
| --- a/base/trace_event/memory_allocator_dump.cc |
| +++ b/base/trace_event/memory_allocator_dump.cc |
| @@ -29,7 +29,8 @@ MemoryAllocatorDump::MemoryAllocatorDump(const std::string& absolute_name, |
| process_memory_dump_(process_memory_dump), |
| attributes_(new TracedValue), |
| guid_(guid), |
| - flags_(Flags::DEFAULT) { |
| + flags_(Flags::DEFAULT), |
| + size_(0) { |
| // The |absolute_name| cannot be empty. |
| DCHECK(!absolute_name.empty()); |
| @@ -56,9 +57,16 @@ MemoryAllocatorDump::MemoryAllocatorDump(const std::string& absolute_name, |
| MemoryAllocatorDump::~MemoryAllocatorDump() { |
| } |
| +uint64_t MemoryAllocatorDump::GetSize() { |
| + return size_; |
| +} |
| + |
| void MemoryAllocatorDump::AddScalar(const char* name, |
| const char* units, |
| uint64_t value) { |
| + if (strcmp(kNameSize, name) == 0 && strcmp(kUnitsBytes, units) == 0) { |
|
Primiano Tucci (use gerrit)
2017/03/22 17:19:52
I like your paranoy, but purely for sake of perf,
hjd
2017/03/22 19:24:20
sounds good to me :)
|
| + size_ = value; |
| + } |
| SStringPrintf(&string_conversion_buffer_, "%" PRIx64, value); |
| attributes_->BeginDictionary(name); |
| attributes_->SetString("type", kTypeScalar); |