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

Side by Side Diff: gpu/command_buffer/client/mapped_memory.h

Issue 2592803002: Dump MappedMemoryManager memory via GLES2Implementation (Closed)
Patch Set: fix build Created 4 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_
6 #define GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ 6 #define GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 private: 115 private:
116 int32_t shm_id_; 116 int32_t shm_id_;
117 scoped_refptr<gpu::Buffer> shm_; 117 scoped_refptr<gpu::Buffer> shm_;
118 FencedAllocatorWrapper allocator_; 118 FencedAllocatorWrapper allocator_;
119 119
120 DISALLOW_COPY_AND_ASSIGN(MemoryChunk); 120 DISALLOW_COPY_AND_ASSIGN(MemoryChunk);
121 }; 121 };
122 122
123 // Manages MemoryChunks. 123 // Manages MemoryChunks.
124 class GPU_EXPORT MappedMemoryManager 124 class GPU_EXPORT MappedMemoryManager {
125 : public base::trace_event::MemoryDumpProvider {
126 public: 125 public:
127 enum MemoryLimit { 126 enum MemoryLimit {
128 kNoLimit = 0, 127 kNoLimit = 0,
129 }; 128 };
130 129
131 // |unused_memory_reclaim_limit|: When exceeded this causes pending memory 130 // |unused_memory_reclaim_limit|: When exceeded this causes pending memory
132 // to be reclaimed before allocating more memory. 131 // to be reclaimed before allocating more memory.
133 MappedMemoryManager(CommandBufferHelper* helper, 132 MappedMemoryManager(CommandBufferHelper* helper,
134 size_t unused_memory_reclaim_limit); 133 size_t unused_memory_reclaim_limit);
135 134
136 ~MappedMemoryManager() override; 135 ~MappedMemoryManager();
137 136
138 unsigned int chunk_size_multiple() const { 137 unsigned int chunk_size_multiple() const {
139 return chunk_size_multiple_; 138 return chunk_size_multiple_;
140 } 139 }
141 140
142 void set_chunk_size_multiple(unsigned int multiple) { 141 void set_chunk_size_multiple(unsigned int multiple) {
143 DCHECK(multiple % FencedAllocator::kAllocAlignment == 0); 142 DCHECK(multiple % FencedAllocator::kAllocAlignment == 0);
144 chunk_size_multiple_ = multiple; 143 chunk_size_multiple_ = multiple;
145 } 144 }
146 145
(...skipping 25 matching lines...) Expand all
172 // be re-allocated until the token has passed through the command stream. 171 // be re-allocated until the token has passed through the command stream.
173 // 172 //
174 // Parameters: 173 // Parameters:
175 // pointer: the pointer to the memory block to free. 174 // pointer: the pointer to the memory block to free.
176 // token: the token value to wait for before re-using the memory. 175 // token: the token value to wait for before re-using the memory.
177 void FreePendingToken(void* pointer, int32_t token); 176 void FreePendingToken(void* pointer, int32_t token);
178 177
179 // Free Any Shared memory that is not in use. 178 // Free Any Shared memory that is not in use.
180 void FreeUnused(); 179 void FreeUnused();
181 180
182 // Overridden from base::trace_event::MemoryDumpProvider: 181 // Dump memory usage - called from GLES2Implementation.
183 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 182 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
184 base::trace_event::ProcessMemoryDump* pmd) override; 183 base::trace_event::ProcessMemoryDump* pmd);
185 184
186 // Used for testing 185 // Used for testing
187 size_t num_chunks() const { 186 size_t num_chunks() const {
188 return chunks_.size(); 187 return chunks_.size();
189 } 188 }
190 189
191 size_t bytes_in_use() const { 190 size_t bytes_in_use() const {
192 size_t bytes_in_use = 0; 191 size_t bytes_in_use = 0;
193 for (size_t ii = 0; ii < chunks_.size(); ++ii) { 192 for (size_t ii = 0; ii < chunks_.size(); ++ii) {
194 bytes_in_use += chunks_[ii]->bytes_in_use(); 193 bytes_in_use += chunks_[ii]->bytes_in_use();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 uint32_t shm_offset_; 273 uint32_t shm_offset_;
275 bool flush_after_release_; 274 bool flush_after_release_;
276 CommandBufferHelper* helper_; 275 CommandBufferHelper* helper_;
277 MappedMemoryManager* mapped_memory_manager_; 276 MappedMemoryManager* mapped_memory_manager_;
278 DISALLOW_COPY_AND_ASSIGN(ScopedMappedMemoryPtr); 277 DISALLOW_COPY_AND_ASSIGN(ScopedMappedMemoryPtr);
279 }; 278 };
280 279
281 } // namespace gpu 280 } // namespace gpu
282 281
283 #endif // GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ 282 #endif // GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.cc ('k') | gpu/command_buffer/client/mapped_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698