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/command_buffer/common/buffer.h" | 5 #include "gpu/command_buffer/common/buffer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/numerics/safe_math.h" | 12 #include "base/numerics/safe_math.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 | 14 |
15 namespace gpu { | 15 namespace gpu { |
16 | 16 |
17 bool BufferBacking::is_shared() const { | |
18 return false; | |
19 } | |
20 | |
21 base::SharedMemoryHandle BufferBacking::shared_memory_handle() const { | 17 base::SharedMemoryHandle BufferBacking::shared_memory_handle() const { |
22 return base::SharedMemoryHandle(); | 18 return base::SharedMemoryHandle(); |
23 } | 19 } |
24 | 20 |
25 SharedMemoryBufferBacking::SharedMemoryBufferBacking( | 21 SharedMemoryBufferBacking::SharedMemoryBufferBacking( |
26 std::unique_ptr<base::SharedMemory> shared_memory, | 22 std::unique_ptr<base::SharedMemory> shared_memory, |
27 size_t size) | 23 size_t size) |
28 : shared_memory_(std::move(shared_memory)), size_(size) {} | 24 : shared_memory_(std::move(shared_memory)), size_(size) {} |
29 | 25 |
30 SharedMemoryBufferBacking::~SharedMemoryBufferBacking() {} | 26 SharedMemoryBufferBacking::~SharedMemoryBufferBacking() {} |
31 | 27 |
32 bool SharedMemoryBufferBacking::is_shared() const { | |
33 return true; | |
34 } | |
35 | |
36 base::SharedMemoryHandle SharedMemoryBufferBacking::shared_memory_handle() | 28 base::SharedMemoryHandle SharedMemoryBufferBacking::shared_memory_handle() |
37 const { | 29 const { |
38 return shared_memory_->handle(); | 30 return shared_memory_->handle(); |
39 } | 31 } |
40 | 32 |
41 void* SharedMemoryBufferBacking::GetMemory() const { | 33 void* SharedMemoryBufferBacking::GetMemory() const { |
42 return shared_memory_->memory(); | 34 return shared_memory_->memory(); |
43 } | 35 } |
44 | 36 |
45 size_t SharedMemoryBufferBacking::GetSize() const { return size_; } | 37 size_t SharedMemoryBufferBacking::GetSize() const { return size_; } |
(...skipping 30 matching lines...) Expand all Loading... |
76 } | 68 } |
77 | 69 |
78 base::trace_event::MemoryAllocatorDumpGuid GetBufferGUIDForTracing( | 70 base::trace_event::MemoryAllocatorDumpGuid GetBufferGUIDForTracing( |
79 uint64_t tracing_process_id, | 71 uint64_t tracing_process_id, |
80 int32_t buffer_id) { | 72 int32_t buffer_id) { |
81 return base::trace_event::MemoryAllocatorDumpGuid(base::StringPrintf( | 73 return base::trace_event::MemoryAllocatorDumpGuid(base::StringPrintf( |
82 "gpu-buffer-x-process/%" PRIx64 "/%d", tracing_process_id, buffer_id)); | 74 "gpu-buffer-x-process/%" PRIx64 "/%d", tracing_process_id, buffer_id)); |
83 } | 75 } |
84 | 76 |
85 } // namespace gpu | 77 } // namespace gpu |
OLD | NEW |