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

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

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/BUILD.gn ('k') | gpu/command_buffer/common/buffer.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 (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef GPU_COMMAND_BUFFER_COMMON_BUFFER_H_ 5 #ifndef GPU_COMMAND_BUFFER_COMMON_BUFFER_H_
6 #define GPU_COMMAND_BUFFER_COMMON_BUFFER_H_ 6 #define GPU_COMMAND_BUFFER_COMMON_BUFFER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/shared_memory.h" 15 #include "base/memory/shared_memory.h"
16 #include "base/trace_event/memory_allocator_dump.h" 16 #include "base/trace_event/memory_allocator_dump.h"
17 #include "gpu/gpu_export.h" 17 #include "gpu/gpu_export.h"
18 18
19 namespace base { 19 namespace base {
20 class SharedMemory; 20
21 } 21 class SharedMemory;
22 class SharedMemoryHandle;
23
24 } // namespace base
22 25
23 namespace gpu { 26 namespace gpu {
24 27
25 class GPU_EXPORT BufferBacking { 28 class GPU_EXPORT BufferBacking {
26 public: 29 public:
27 virtual ~BufferBacking() {} 30 virtual ~BufferBacking() {}
28 virtual bool is_shared() const; 31 virtual bool is_shared() const;
32 virtual base::SharedMemoryHandle shared_memory_handle() const;
29 virtual void* GetMemory() const = 0; 33 virtual void* GetMemory() const = 0;
30 virtual size_t GetSize() const = 0; 34 virtual size_t GetSize() const = 0;
31 }; 35 };
32 36
33 class GPU_EXPORT SharedMemoryBufferBacking : public BufferBacking { 37 class GPU_EXPORT SharedMemoryBufferBacking : public BufferBacking {
34 public: 38 public:
35 SharedMemoryBufferBacking(std::unique_ptr<base::SharedMemory> shared_memory, 39 SharedMemoryBufferBacking(std::unique_ptr<base::SharedMemory> shared_memory,
36 size_t size); 40 size_t size);
37 ~SharedMemoryBufferBacking() override; 41 ~SharedMemoryBufferBacking() override;
38 bool is_shared() const override; 42 bool is_shared() const override;
43 base::SharedMemoryHandle shared_memory_handle() const override;
39 void* GetMemory() const override; 44 void* GetMemory() const override;
40 size_t GetSize() const override; 45 size_t GetSize() const override;
41 base::SharedMemory* shared_memory() { return shared_memory_.get(); } 46 base::SharedMemory* shared_memory() { return shared_memory_.get(); }
42 47
43 private: 48 private:
44 std::unique_ptr<base::SharedMemory> shared_memory_; 49 std::unique_ptr<base::SharedMemory> shared_memory_;
45 size_t size_; 50 size_t size_;
46 DISALLOW_COPY_AND_ASSIGN(SharedMemoryBufferBacking); 51 DISALLOW_COPY_AND_ASSIGN(SharedMemoryBufferBacking);
47 }; 52 };
48 53
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 95 }
91 96
92 // Generates GUID which can be used to trace buffer using an Id. 97 // Generates GUID which can be used to trace buffer using an Id.
93 GPU_EXPORT base::trace_event::MemoryAllocatorDumpGuid GetBufferGUIDForTracing( 98 GPU_EXPORT base::trace_event::MemoryAllocatorDumpGuid GetBufferGUIDForTracing(
94 uint64_t tracing_process_id, 99 uint64_t tracing_process_id,
95 int32_t buffer_id); 100 int32_t buffer_id);
96 101
97 } // namespace gpu 102 } // namespace gpu
98 103
99 #endif // GPU_COMMAND_BUFFER_COMMON_BUFFER_H_ 104 #endif // GPU_COMMAND_BUFFER_COMMON_BUFFER_H_
OLDNEW
« no previous file with comments | « gpu/BUILD.gn ('k') | gpu/command_buffer/common/buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698