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

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

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
« no previous file with comments | « gpu/command_buffer/client/mapped_memory.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "gpu/command_buffer/client/mapped_memory.h" 5 #include "gpu/command_buffer/client/mapped_memory.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 29 matching lines...) Expand all
40 MemoryChunk::~MemoryChunk() {} 40 MemoryChunk::~MemoryChunk() {}
41 41
42 MappedMemoryManager::MappedMemoryManager(CommandBufferHelper* helper, 42 MappedMemoryManager::MappedMemoryManager(CommandBufferHelper* helper,
43 size_t unused_memory_reclaim_limit) 43 size_t unused_memory_reclaim_limit)
44 : chunk_size_multiple_(FencedAllocator::kAllocAlignment), 44 : chunk_size_multiple_(FencedAllocator::kAllocAlignment),
45 helper_(helper), 45 helper_(helper),
46 allocated_memory_(0), 46 allocated_memory_(0),
47 max_free_bytes_(unused_memory_reclaim_limit), 47 max_free_bytes_(unused_memory_reclaim_limit),
48 max_allocated_bytes_(SharedMemoryLimits::kNoLimit), 48 max_allocated_bytes_(SharedMemoryLimits::kNoLimit),
49 tracing_id_(g_next_mapped_memory_manager_tracing_id.GetNext()) { 49 tracing_id_(g_next_mapped_memory_manager_tracing_id.GetNext()) {
50 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview).
51 // Don't register a dump provider in these cases.
52 // TODO(ericrk): Get this working in Android Webview. crbug.com/517156
53 if (base::ThreadTaskRunnerHandle::IsSet()) {
54 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
55 this, "gpu::MappedMemoryManager", base::ThreadTaskRunnerHandle::Get());
56 }
57 } 50 }
58 51
59 MappedMemoryManager::~MappedMemoryManager() { 52 MappedMemoryManager::~MappedMemoryManager() {
60 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
61 this);
62
63 CommandBuffer* cmd_buf = helper_->command_buffer(); 53 CommandBuffer* cmd_buf = helper_->command_buffer();
64 for (auto& chunk : chunks_) { 54 for (auto& chunk : chunks_) {
65 cmd_buf->DestroyTransferBuffer(chunk->shm_id()); 55 cmd_buf->DestroyTransferBuffer(chunk->shm_id());
66 } 56 }
67 } 57 }
68 58
69 void* MappedMemoryManager::Alloc(unsigned int size, 59 void* MappedMemoryManager::Alloc(unsigned int size,
70 int32_t* shm_id, 60 int32_t* shm_id,
71 unsigned int* shm_offset) { 61 unsigned int* shm_offset) {
72 DCHECK(shm_id); 62 DCHECK(shm_id);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 void ScopedMappedMemoryPtr::Reset(uint32_t new_size) { 212 void ScopedMappedMemoryPtr::Reset(uint32_t new_size) {
223 Release(); 213 Release();
224 214
225 if (new_size) { 215 if (new_size) {
226 buffer_ = mapped_memory_manager_->Alloc(new_size, &shm_id_, &shm_offset_); 216 buffer_ = mapped_memory_manager_->Alloc(new_size, &shm_id_, &shm_offset_);
227 size_ = buffer_ ? new_size : 0; 217 size_ = buffer_ ? new_size : 0;
228 } 218 }
229 } 219 }
230 220
231 } // namespace gpu 221 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/mapped_memory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698