OLD | NEW |
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 #include "gpu/command_buffer/service/renderbuffer_manager.h" | 5 #include "gpu/command_buffer/service/renderbuffer_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 if (impl_format == GL_DEPTH_COMPONENT16 && | 243 if (impl_format == GL_DEPTH_COMPONENT16 && |
244 feature_info_->feature_flags().oes_depth24) | 244 feature_info_->feature_flags().oes_depth24) |
245 return GL_DEPTH_COMPONENT24; | 245 return GL_DEPTH_COMPONENT24; |
246 } | 246 } |
247 return impl_format; | 247 return impl_format; |
248 } | 248 } |
249 | 249 |
250 bool RenderbufferManager::OnMemoryDump( | 250 bool RenderbufferManager::OnMemoryDump( |
251 const base::trace_event::MemoryDumpArgs& args, | 251 const base::trace_event::MemoryDumpArgs& args, |
252 base::trace_event::ProcessMemoryDump* pmd) { | 252 base::trace_event::ProcessMemoryDump* pmd) { |
253 int client_id = memory_tracker_->ClientId(); | 253 using base::trace_event::MemoryAllocatorDump; |
254 for (const auto& renderbuffer_entry : renderbuffers_) { | 254 using base::trace_event::MemoryDumpLevelOfDetail; |
255 const auto& client_renderbuffer_id = renderbuffer_entry.first; | |
256 const auto& renderbuffer = renderbuffer_entry.second; | |
257 | 255 |
258 std::string dump_name = | 256 if (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) { |
259 base::StringPrintf("gpu/gl/renderbuffers/client_%d/renderbuffer_%d", | 257 std::string dump_name = base::StringPrintf( |
260 client_id, client_renderbuffer_id); | 258 "gpu/gl/renderbuffers/client_%d/" PRIu64, memory_tracker_->ClientId()); |
261 base::trace_event::MemoryAllocatorDump* dump = | 259 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); |
262 pmd->CreateAllocatorDump(dump_name); | 260 dump->AddScalar(MemoryAllocatorDump::kNameSize, |
263 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 261 MemoryAllocatorDump::kUnitsBytes, mem_represented()); |
264 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 262 } else { |
265 static_cast<uint64_t>(renderbuffer->EstimatedSize())); | 263 int client_id = memory_tracker_->ClientId(); |
| 264 for (const auto& renderbuffer_entry : renderbuffers_) { |
| 265 const auto& client_renderbuffer_id = renderbuffer_entry.first; |
| 266 const auto& renderbuffer = renderbuffer_entry.second; |
266 | 267 |
267 auto guid = gl::GetGLRenderbufferGUIDForTracing( | 268 std::string dump_name = |
268 memory_tracker_->ShareGroupTracingGUID(), client_renderbuffer_id); | 269 base::StringPrintf("gpu/gl/renderbuffers/client_%d/renderbuffer_%d", |
269 pmd->CreateSharedGlobalAllocatorDump(guid); | 270 client_id, client_renderbuffer_id); |
270 pmd->AddOwnershipEdge(dump->guid(), guid); | 271 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); |
| 272 dump->AddScalar(MemoryAllocatorDump::kNameSize, |
| 273 MemoryAllocatorDump::kUnitsBytes, |
| 274 static_cast<uint64_t>(renderbuffer->EstimatedSize())); |
| 275 |
| 276 auto guid = gl::GetGLRenderbufferGUIDForTracing( |
| 277 memory_tracker_->ShareGroupTracingGUID(), client_renderbuffer_id); |
| 278 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 279 pmd->AddOwnershipEdge(dump->guid(), guid); |
| 280 } |
271 } | 281 } |
272 return true; | 282 return true; |
273 } | 283 } |
274 | 284 |
275 } // namespace gles2 | 285 } // namespace gles2 |
276 } // namespace gpu | 286 } // namespace gpu |
OLD | NEW |