OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ |
| 6 #define BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ |
| 7 |
| 8 #include "base/base_export.h" |
| 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" |
| 11 #include "base/trace_event/memory_allocator_attributes.h" |
| 12 #include "base/values.h" |
| 13 |
| 14 namespace base { |
| 15 namespace trace_event { |
| 16 |
| 17 class MemoryDumpManager; |
| 18 class TracedValue; |
| 19 |
| 20 // Data model for user-land memory allocator dumps. |
| 21 class BASE_EXPORT MemoryAllocatorDump { |
| 22 public: |
| 23 MemoryAllocatorDump(const std::string& name, MemoryAllocatorDump* parent); |
| 24 ~MemoryAllocatorDump(); |
| 25 |
| 26 const std::string& name() const { return name_; } |
| 27 const MemoryAllocatorDump* parent() const { return parent_; } |
| 28 |
| 29 void set_physical_size_in_bytes(uint64 value) { |
| 30 physical_size_in_bytes_ = value; |
| 31 } |
| 32 uint64 physical_size_in_bytes() const { return physical_size_in_bytes_; } |
| 33 |
| 34 void set_allocated_objects_count(uint64 value) { |
| 35 allocated_objects_count_ = value; |
| 36 } |
| 37 uint64 allocated_objects_count() const { return allocated_objects_count_; } |
| 38 |
| 39 void set_allocated_objects_size_in_bytes(uint64 value) { |
| 40 allocated_objects_size_in_bytes_ = value; |
| 41 } |
| 42 uint64 allocated_objects_size_in_bytes() const { |
| 43 return allocated_objects_size_in_bytes_; |
| 44 } |
| 45 |
| 46 void SetExtraAttribute(const std::string& name, int value); |
| 47 int GetExtraIntegerAttribute(const std::string& name) const; |
| 48 |
| 49 // Called at trace generation time to populate the TracedValue. |
| 50 void AsValueInto(TracedValue* value) const; |
| 51 |
| 52 private: |
| 53 const std::string name_; |
| 54 MemoryAllocatorDump* const parent_; // Not owned. |
| 55 uint64 physical_size_in_bytes_; |
| 56 uint64 allocated_objects_count_; |
| 57 uint64 allocated_objects_size_in_bytes_; |
| 58 DictionaryValue extra_attributes_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(MemoryAllocatorDump); |
| 61 }; |
| 62 |
| 63 } // namespace trace_event |
| 64 } // namespace base |
| 65 |
| 66 #endif // BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ |
OLD | NEW |