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 using base::trace_event::MemoryAllocatorDump; |
| 254 using base::trace_event::MemoryDumpLevelOfDetail; |
| 255 |
| 256 if (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) { |
| 257 std::string dump_name = base::StringPrintf( |
| 258 "gpu/gl/renderbuffers/client_%d/", memory_tracker_->ClientId()); |
| 259 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); |
| 260 dump->AddScalar(MemoryAllocatorDump::kNameSize, |
| 261 MemoryAllocatorDump::kUnitsBytes, mem_represented()); |
| 262 |
| 263 // Early out, no need for more detail in a BACKGROUND dump. |
| 264 return true; |
| 265 } |
| 266 |
253 int client_id = memory_tracker_->ClientId(); | 267 int client_id = memory_tracker_->ClientId(); |
254 for (const auto& renderbuffer_entry : renderbuffers_) { | 268 for (const auto& renderbuffer_entry : renderbuffers_) { |
255 const auto& client_renderbuffer_id = renderbuffer_entry.first; | 269 const auto& client_renderbuffer_id = renderbuffer_entry.first; |
256 const auto& renderbuffer = renderbuffer_entry.second; | 270 const auto& renderbuffer = renderbuffer_entry.second; |
257 | 271 |
258 std::string dump_name = | 272 std::string dump_name = |
259 base::StringPrintf("gpu/gl/renderbuffers/client_%d/renderbuffer_%d", | 273 base::StringPrintf("gpu/gl/renderbuffers/client_%d/renderbuffer_%d", |
260 client_id, client_renderbuffer_id); | 274 client_id, client_renderbuffer_id); |
261 base::trace_event::MemoryAllocatorDump* dump = | 275 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); |
262 pmd->CreateAllocatorDump(dump_name); | 276 dump->AddScalar(MemoryAllocatorDump::kNameSize, |
263 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 277 MemoryAllocatorDump::kUnitsBytes, |
264 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | |
265 static_cast<uint64_t>(renderbuffer->EstimatedSize())); | 278 static_cast<uint64_t>(renderbuffer->EstimatedSize())); |
266 | 279 |
267 auto guid = gl::GetGLRenderbufferGUIDForTracing( | 280 auto guid = gl::GetGLRenderbufferGUIDForTracing( |
268 memory_tracker_->ShareGroupTracingGUID(), client_renderbuffer_id); | 281 memory_tracker_->ShareGroupTracingGUID(), client_renderbuffer_id); |
269 pmd->CreateSharedGlobalAllocatorDump(guid); | 282 pmd->CreateSharedGlobalAllocatorDump(guid); |
270 pmd->AddOwnershipEdge(dump->guid(), guid); | 283 pmd->AddOwnershipEdge(dump->guid(), guid); |
271 } | 284 } |
| 285 |
272 return true; | 286 return true; |
273 } | 287 } |
274 | 288 |
275 } // namespace gles2 | 289 } // namespace gles2 |
276 } // namespace gpu | 290 } // namespace gpu |
OLD | NEW |