Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(723)

Side by Side Diff: gpu/command_buffer/common/buffer.cc

Issue 2909003002: Add gpu::BufferBacking::shared_memory_handle() (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/common/buffer.h ('k') | gpu/command_buffer/common/buffer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 { 17 bool BufferBacking::is_shared() const {
18 return false; 18 return false;
19 } 19 }
20 20
21 base::SharedMemoryHandle BufferBacking::shared_memory_handle() const {
22 return base::SharedMemoryHandle();
23 }
24
21 SharedMemoryBufferBacking::SharedMemoryBufferBacking( 25 SharedMemoryBufferBacking::SharedMemoryBufferBacking(
22 std::unique_ptr<base::SharedMemory> shared_memory, 26 std::unique_ptr<base::SharedMemory> shared_memory,
23 size_t size) 27 size_t size)
24 : shared_memory_(std::move(shared_memory)), size_(size) {} 28 : shared_memory_(std::move(shared_memory)), size_(size) {}
25 29
26 SharedMemoryBufferBacking::~SharedMemoryBufferBacking() {} 30 SharedMemoryBufferBacking::~SharedMemoryBufferBacking() {}
27 31
28 bool SharedMemoryBufferBacking::is_shared() const { 32 bool SharedMemoryBufferBacking::is_shared() const {
29 return true; 33 return true;
30 } 34 }
31 35
36 base::SharedMemoryHandle SharedMemoryBufferBacking::shared_memory_handle()
37 const {
38 return shared_memory_->handle();
39 }
40
32 void* SharedMemoryBufferBacking::GetMemory() const { 41 void* SharedMemoryBufferBacking::GetMemory() const {
33 return shared_memory_->memory(); 42 return shared_memory_->memory();
34 } 43 }
35 44
36 size_t SharedMemoryBufferBacking::GetSize() const { return size_; } 45 size_t SharedMemoryBufferBacking::GetSize() const { return size_; }
37 46
38 Buffer::Buffer(std::unique_ptr<BufferBacking> backing) 47 Buffer::Buffer(std::unique_ptr<BufferBacking> backing)
39 : backing_(std::move(backing)), 48 : backing_(std::move(backing)),
40 memory_(backing_->GetMemory()), 49 memory_(backing_->GetMemory()),
41 size_(backing_->GetSize()) { 50 size_(backing_->GetSize()) {
(...skipping 25 matching lines...) Expand all
67 } 76 }
68 77
69 base::trace_event::MemoryAllocatorDumpGuid GetBufferGUIDForTracing( 78 base::trace_event::MemoryAllocatorDumpGuid GetBufferGUIDForTracing(
70 uint64_t tracing_process_id, 79 uint64_t tracing_process_id,
71 int32_t buffer_id) { 80 int32_t buffer_id) {
72 return base::trace_event::MemoryAllocatorDumpGuid(base::StringPrintf( 81 return base::trace_event::MemoryAllocatorDumpGuid(base::StringPrintf(
73 "gpu-buffer-x-process/%" PRIx64 "/%d", tracing_process_id, buffer_id)); 82 "gpu-buffer-x-process/%" PRIx64 "/%d", tracing_process_id, buffer_id));
74 } 83 }
75 84
76 } // namespace gpu 85 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/buffer.h ('k') | gpu/command_buffer/common/buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698