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