| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/gl/gl_image_shared_memory.h" | 5 #include "ui/gl/gl_image_shared_memory.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/numerics/safe_math.h" | 8 #include "base/numerics/safe_math.h" |
| 9 #include "base/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 base::trace_event::ProcessMemoryDump* pmd, | 86 base::trace_event::ProcessMemoryDump* pmd, |
| 87 uint64_t process_tracing_id, | 87 uint64_t process_tracing_id, |
| 88 const std::string& dump_name) { | 88 const std::string& dump_name) { |
| 89 size_t size_in_bytes = 0; | 89 size_t size_in_bytes = 0; |
| 90 | 90 |
| 91 if (shared_memory_) { | 91 if (shared_memory_) { |
| 92 bool result = SizeInBytes(GetSize(), format(), &size_in_bytes); | 92 bool result = SizeInBytes(GetSize(), format(), &size_in_bytes); |
| 93 DCHECK(result); | 93 DCHECK(result); |
| 94 } | 94 } |
| 95 | 95 |
| 96 // Dump under "/shared_memory", as the base class may also dump to |
| 97 // "/texture_memory". |
| 96 base::trace_event::MemoryAllocatorDump* dump = | 98 base::trace_event::MemoryAllocatorDump* dump = |
| 97 pmd->CreateAllocatorDump(dump_name); | 99 pmd->CreateAllocatorDump(dump_name + "/private_memory"); |
| 98 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 100 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
| 99 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 101 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 100 static_cast<uint64_t>(size_in_bytes)); | 102 static_cast<uint64_t>(size_in_bytes)); |
| 101 | 103 |
| 102 auto guid = gfx::GetGenericSharedMemoryGUIDForTracing(process_tracing_id, | 104 auto guid = gfx::GetGenericSharedMemoryGUIDForTracing(process_tracing_id, |
| 103 shared_memory_id_); | 105 shared_memory_id_); |
| 104 pmd->CreateSharedGlobalAllocatorDump(guid); | 106 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 105 pmd->AddOwnershipEdge(dump->guid(), guid); | 107 pmd->AddOwnershipEdge(dump->guid(), guid); |
| 108 |
| 109 // Also dump the base class's texture memory. |
| 110 GLImageMemory::OnMemoryDump(pmd, process_tracing_id, dump_name); |
| 106 } | 111 } |
| 107 | 112 |
| 108 } // namespace gfx | 113 } // namespace gfx |
| OLD | NEW |