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/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
| 9 #include "base/memory/shared_memory_tracker.h" |
9 #include "base/numerics/safe_math.h" | 10 #include "base/numerics/safe_math.h" |
10 #include "base/process/process_handle.h" | 11 #include "base/process/process_handle.h" |
11 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
12 #include "base/trace_event/memory_allocator_dump.h" | 13 #include "base/trace_event/memory_allocator_dump.h" |
13 #include "base/trace_event/memory_dump_manager.h" | 14 #include "base/trace_event/memory_dump_manager.h" |
14 #include "base/trace_event/process_memory_dump.h" | 15 #include "base/trace_event/process_memory_dump.h" |
15 #include "ui/gfx/buffer_format_util.h" | 16 #include "ui/gfx/buffer_format_util.h" |
16 | 17 |
17 namespace gl { | 18 namespace gl { |
18 | 19 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 size_in_bytes = stride() * GetSize().height(); | 81 size_in_bytes = stride() * GetSize().height(); |
81 | 82 |
82 // Dump under "/shared_memory", as the base class may also dump to | 83 // Dump under "/shared_memory", as the base class may also dump to |
83 // "/texture_memory". | 84 // "/texture_memory". |
84 base::trace_event::MemoryAllocatorDump* dump = | 85 base::trace_event::MemoryAllocatorDump* dump = |
85 pmd->CreateAllocatorDump(dump_name + "/shared_memory"); | 86 pmd->CreateAllocatorDump(dump_name + "/shared_memory"); |
86 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 87 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
87 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 88 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
88 static_cast<uint64_t>(size_in_bytes)); | 89 static_cast<uint64_t>(size_in_bytes)); |
89 | 90 |
90 auto guid = GetGenericSharedMemoryGUIDForTracing(process_tracing_id, | 91 if (shared_memory_) { |
91 shared_memory_id_); | 92 auto guid = GetGenericSharedMemoryGUIDForTracing(process_tracing_id, |
92 pmd->CreateSharedGlobalAllocatorDump(guid); | 93 shared_memory_id_); |
93 pmd->AddOwnershipEdge(dump->guid(), guid); | 94 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 95 pmd->AddOwnershipEdge(dump->guid(), guid); |
| 96 base::SharedMemoryTracker::AddOwnershipEdgeToSharedGlobalDump( |
| 97 pmd, guid, shared_memory_->handle(), shared_memory_->mapped_size()); |
| 98 } |
94 } | 99 } |
95 | 100 |
96 } // namespace gl | 101 } // namespace gl |
OLD | NEW |