| OLD | NEW |
| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 base::StringPrintf("gpu/mapped_memory/manager_%d", tracing_id_); | 167 base::StringPrintf("gpu/mapped_memory/manager_%d", tracing_id_); |
| 168 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); | 168 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); |
| 169 dump->AddScalar(MemoryAllocatorDump::kNameSize, | 169 dump->AddScalar(MemoryAllocatorDump::kNameSize, |
| 170 MemoryAllocatorDump::kUnitsBytes, allocated_memory_); | 170 MemoryAllocatorDump::kUnitsBytes, allocated_memory_); |
| 171 | 171 |
| 172 // Early out, no need for more detail in a BACKGROUND dump. | 172 // Early out, no need for more detail in a BACKGROUND dump. |
| 173 return true; | 173 return true; |
| 174 } | 174 } |
| 175 | 175 |
| 176 const uint64_t tracing_process_id = | 176 const uint64_t tracing_process_id = |
| 177 base::trace_event::MemoryDumpManager::GetInstance() | 177 base::trace_event::MemoryDumpManager::GetInstance()->tracing_process_id(); |
| 178 ->GetTracingProcessId(); | |
| 179 for (const auto& chunk : chunks_) { | 178 for (const auto& chunk : chunks_) { |
| 180 std::string dump_name = base::StringPrintf( | 179 std::string dump_name = base::StringPrintf( |
| 181 "gpu/mapped_memory/manager_%d/chunk_%d", tracing_id_, chunk->shm_id()); | 180 "gpu/mapped_memory/manager_%d/chunk_%d", tracing_id_, chunk->shm_id()); |
| 182 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); | 181 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); |
| 183 | 182 |
| 184 dump->AddScalar(MemoryAllocatorDump::kNameSize, | 183 dump->AddScalar(MemoryAllocatorDump::kNameSize, |
| 185 MemoryAllocatorDump::kUnitsBytes, chunk->GetSize()); | 184 MemoryAllocatorDump::kUnitsBytes, chunk->GetSize()); |
| 186 dump->AddScalar("free_size", MemoryAllocatorDump::kUnitsBytes, | 185 dump->AddScalar("free_size", MemoryAllocatorDump::kUnitsBytes, |
| 187 chunk->GetFreeSize()); | 186 chunk->GetFreeSize()); |
| 188 | 187 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 212 void ScopedMappedMemoryPtr::Reset(uint32_t new_size) { | 211 void ScopedMappedMemoryPtr::Reset(uint32_t new_size) { |
| 213 Release(); | 212 Release(); |
| 214 | 213 |
| 215 if (new_size) { | 214 if (new_size) { |
| 216 buffer_ = mapped_memory_manager_->Alloc(new_size, &shm_id_, &shm_offset_); | 215 buffer_ = mapped_memory_manager_->Alloc(new_size, &shm_id_, &shm_offset_); |
| 217 size_ = buffer_ ? new_size : 0; | 216 size_ = buffer_ ? new_size : 0; |
| 218 } | 217 } |
| 219 } | 218 } |
| 220 | 219 |
| 221 } // namespace gpu | 220 } // namespace gpu |
| OLD | NEW |