Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: base/trace_event/memory_allocator_dump.h

Issue 2760253005: memory-infra: Fill the memory dump callback result (1/2) (Closed)
Patch Set: fix nits Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/trace_event/memory_allocator_dump.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
93 // Get the size for this dump.
94 // The size is the value set with AddScalar(kNameSize, kUnitsBytes, size);
95 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203
96 uint64_t GetSize() const { return size_; };
97
88 const std::string absolute_name_; 98 const std::string absolute_name_;
89 ProcessMemoryDump* const process_memory_dump_; // Not owned (PMD owns this). 99 ProcessMemoryDump* const process_memory_dump_; // Not owned (PMD owns this).
90 std::unique_ptr<TracedValue> attributes_; 100 std::unique_ptr<TracedValue> attributes_;
91 MemoryAllocatorDumpGuid guid_; 101 MemoryAllocatorDumpGuid guid_;
92 int flags_; // See enum Flags. 102 int flags_; // See enum Flags.
103 uint64_t size_;
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_
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/memory_allocator_dump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698