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/numerics/safe_math.h" | 9 #include "base/numerics/safe_math.h" |
10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
11 #include "base/sys_info.h" | 11 #include "base/sys_info.h" |
12 #include "base/trace_event/memory_allocator_dump.h" | 12 #include "base/trace_event/memory_allocator_dump.h" |
13 #include "base/trace_event/memory_dump_manager.h" | 13 #include "base/trace_event/memory_dump_manager.h" |
14 #include "base/trace_event/process_memory_dump.h" | 14 #include "base/trace_event/process_memory_dump.h" |
15 #include "ui/gfx/buffer_format_util.h" | 15 #include "ui/gfx/buffer_format_util.h" |
| 16 #include "ui/gfx/gpu_memory_buffer_tracing.h" |
16 | 17 |
17 namespace gl { | 18 namespace gl { |
18 | 19 |
19 GLImageSharedMemory::GLImageSharedMemory(const gfx::Size& size, | 20 GLImageSharedMemory::GLImageSharedMemory(const gfx::Size& size, |
20 unsigned internalformat) | 21 unsigned internalformat) |
21 : GLImageMemory(size, internalformat) {} | 22 : GLImageMemory(size, internalformat) {} |
22 | 23 |
23 GLImageSharedMemory::~GLImageSharedMemory() {} | 24 GLImageSharedMemory::~GLImageSharedMemory() {} |
24 | 25 |
25 bool GLImageSharedMemory::Initialize( | 26 bool GLImageSharedMemory::Initialize( |
(...skipping 54 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 auto guid = |
91 shared_memory_id_); | 92 gfx::GetSharedMemoryGUIDForTracing(process_tracing_id, shared_memory_id_); |
92 pmd->CreateSharedGlobalAllocatorDump(guid); | 93 pmd->CreateSharedGlobalAllocatorDump(guid); |
93 pmd->AddOwnershipEdge(dump->guid(), guid); | 94 pmd->AddOwnershipEdge(dump->guid(), guid); |
94 } | 95 } |
95 | 96 |
96 } // namespace gl | 97 } // namespace gl |
OLD | NEW |