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 #ifndef BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ | 5 #ifndef BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ |
| 6 #define BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ | 6 #define BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/base_export.h" | 13 #include "base/base_export.h" |
| 14 #include "base/gtest_prod_util.h" | |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/trace_event/memory_allocator_dump_guid.h" | 17 #include "base/trace_event/memory_allocator_dump_guid.h" |
| 17 #include "base/values.h" | 18 #include "base/values.h" |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 namespace trace_event { | 21 namespace trace_event { |
| 21 | 22 |
| 22 class ProcessMemoryDump; | 23 class ProcessMemoryDump; |
| 23 class TracedValue; | 24 class TracedValue; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 // within the scope of a global dump. It is only required when using the | 79 // within the scope of a global dump. It is only required when using the |
| 79 // graph APIs (see TODO_method_name) to express retention / suballocation or | 80 // graph APIs (see TODO_method_name) to express retention / suballocation or |
| 80 // cross process sharing. See crbug.com/492102 for design docs. | 81 // cross process sharing. See crbug.com/492102 for design docs. |
| 81 // Subsequent MemoryAllocatorDump(s) with the same |absolute_name| are | 82 // Subsequent MemoryAllocatorDump(s) with the same |absolute_name| are |
| 82 // expected to have the same guid. | 83 // expected to have the same guid. |
| 83 const MemoryAllocatorDumpGuid& guid() const { return guid_; } | 84 const MemoryAllocatorDumpGuid& guid() const { return guid_; } |
| 84 | 85 |
| 85 TracedValue* attributes_for_testing() const { return attributes_.get(); } | 86 TracedValue* attributes_for_testing() const { return attributes_.get(); } |
| 86 | 87 |
| 87 private: | 88 private: |
| 89 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203 | |
| 90 friend class MemoryDumpManager; | |
| 91 FRIEND_TEST_ALL_PREFIXES(MemoryAllocatorDumpTest, GetSize); | |
| 92 | |
| 88 const std::string absolute_name_; | 93 const std::string absolute_name_; |
| 89 ProcessMemoryDump* const process_memory_dump_; // Not owned (PMD owns this). | 94 ProcessMemoryDump* const process_memory_dump_; // Not owned (PMD owns this). |
| 90 std::unique_ptr<TracedValue> attributes_; | 95 std::unique_ptr<TracedValue> attributes_; |
| 91 MemoryAllocatorDumpGuid guid_; | 96 MemoryAllocatorDumpGuid guid_; |
| 92 int flags_; // See enum Flags. | 97 int flags_; // See enum Flags. |
| 98 uint64_t size_; | |
| 99 | |
| 100 // Get the size for this dump. | |
| 101 // The size is the value set with AddScalar(kNameSize, kUnitsBytes, size); | |
| 102 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203 | |
| 103 uint64_t GetSize(); | |
|
Primiano Tucci (use gerrit)
2017/03/24 11:39:21
ups sorry just realized this, two small nits:
1. f
hjd
2017/03/24 11:57:16
Thanks, done!
| |
| 93 | 104 |
| 94 // A local buffer for Sprintf conversion on fastpath. Avoids allocating | 105 // A local buffer for Sprintf conversion on fastpath. Avoids allocating |
| 95 // temporary strings on each AddScalar() call. | 106 // temporary strings on each AddScalar() call. |
| 96 std::string string_conversion_buffer_; | 107 std::string string_conversion_buffer_; |
| 97 | 108 |
| 98 DISALLOW_COPY_AND_ASSIGN(MemoryAllocatorDump); | 109 DISALLOW_COPY_AND_ASSIGN(MemoryAllocatorDump); |
| 99 }; | 110 }; |
| 100 | 111 |
| 101 } // namespace trace_event | 112 } // namespace trace_event |
| 102 } // namespace base | 113 } // namespace base |
| 103 | 114 |
| 104 #endif // BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ | 115 #endif // BASE_TRACE_EVENT_MEMORY_ALLOCATOR_DUMP_H_ |
| OLD | NEW |