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 "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" | 5 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/numerics/safe_math.h" | 12 #include "base/numerics/safe_math.h" |
13 #include "base/process/memory.h" | 13 #include "base/process/memory.h" |
14 #include "ui/gfx/buffer_format_util.h" | 14 #include "ui/gfx/buffer_format_util.h" |
| 15 #include "ui/gfx/gpu_memory_buffer_tracing.h" |
15 #include "ui/gl/gl_bindings.h" | 16 #include "ui/gl/gl_bindings.h" |
16 | 17 |
17 namespace gpu { | 18 namespace gpu { |
18 | 19 |
19 GpuMemoryBufferImplSharedMemory::GpuMemoryBufferImplSharedMemory( | 20 GpuMemoryBufferImplSharedMemory::GpuMemoryBufferImplSharedMemory( |
20 gfx::GpuMemoryBufferId id, | 21 gfx::GpuMemoryBufferId id, |
21 const gfx::Size& size, | 22 const gfx::Size& size, |
22 gfx::BufferFormat format, | 23 gfx::BufferFormat format, |
23 const DestructionCallback& callback, | 24 const DestructionCallback& callback, |
24 std::unique_ptr<base::SharedMemory> shared_memory, | 25 std::unique_ptr<base::SharedMemory> shared_memory, |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSharedMemory::GetHandle() const { | 205 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSharedMemory::GetHandle() const { |
205 gfx::GpuMemoryBufferHandle handle; | 206 gfx::GpuMemoryBufferHandle handle; |
206 handle.type = gfx::SHARED_MEMORY_BUFFER; | 207 handle.type = gfx::SHARED_MEMORY_BUFFER; |
207 handle.id = id_; | 208 handle.id = id_; |
208 handle.offset = offset_; | 209 handle.offset = offset_; |
209 handle.stride = stride_; | 210 handle.stride = stride_; |
210 handle.handle = shared_memory_->handle(); | 211 handle.handle = shared_memory_->handle(); |
211 return handle; | 212 return handle; |
212 } | 213 } |
213 | 214 |
| 215 base::trace_event::MemoryAllocatorDumpGuid |
| 216 GpuMemoryBufferImplSharedMemory::GetGUIDForTracing( |
| 217 uint64_t tracing_process_id) const { |
| 218 return gfx::GetSharedMemoryGUIDForTracing(tracing_process_id, id_); |
| 219 } |
| 220 |
214 } // namespace gpu | 221 } // namespace gpu |
OLD | NEW |