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

Side by Side Diff: gpu/command_buffer/client/transfer_buffer.h

Issue 2910093004: Add TransferBufferInterface::shared_memory_handle() (Closed)
Patch Set: (rebase) 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_CLIENT_TRANSFER_BUFFER_H_ 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_TRANSFER_BUFFER_H_
6 #define GPU_COMMAND_BUFFER_CLIENT_TRANSFER_BUFFER_H_ 6 #define GPU_COMMAND_BUFFER_CLIENT_TRANSFER_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/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "gpu/command_buffer/client/ring_buffer.h" 15 #include "gpu/command_buffer/client/ring_buffer.h"
16 #include "gpu/command_buffer/common/buffer.h" 16 #include "gpu/command_buffer/common/buffer.h"
17 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 17 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
18 #include "gpu/gpu_export.h" 18 #include "gpu/gpu_export.h"
19 19
20 namespace base {
21
22 class SharedMemoryHandle;
23
24 } // namespace base
25
20 namespace gpu { 26 namespace gpu {
21 27
22 class CommandBufferHelper; 28 class CommandBufferHelper;
23 29
24 // Interface for managing the transfer buffer. 30 // Interface for managing the transfer buffer.
25 class GPU_EXPORT TransferBufferInterface { 31 class GPU_EXPORT TransferBufferInterface {
26 public: 32 public:
27 TransferBufferInterface() { } 33 TransferBufferInterface() { }
28 virtual ~TransferBufferInterface() { } 34 virtual ~TransferBufferInterface() { }
29 35
36 // Returns the shared memory's handle when the back end is base::SharedMemory.
37 // Otherwise, this returns an invalid handle.
38 virtual base::SharedMemoryHandle shared_memory_handle() const = 0;
39
30 virtual bool Initialize( 40 virtual bool Initialize(
31 unsigned int buffer_size, 41 unsigned int buffer_size,
32 unsigned int result_size, 42 unsigned int result_size,
33 unsigned int min_buffer_size, 43 unsigned int min_buffer_size,
34 unsigned int max_buffer_size, 44 unsigned int max_buffer_size,
35 unsigned int alignment, 45 unsigned int alignment,
36 unsigned int size_to_flush) = 0; 46 unsigned int size_to_flush) = 0;
37 47
38 virtual int GetShmId() = 0; 48 virtual int GetShmId() = 0;
39 virtual void* GetResultBuffer() = 0; 49 virtual void* GetResultBuffer() = 0;
(...skipping 21 matching lines...) Expand all
61 virtual unsigned int GetFreeSize() const = 0; 71 virtual unsigned int GetFreeSize() const = 0;
62 }; 72 };
63 73
64 // Class that manages the transfer buffer. 74 // Class that manages the transfer buffer.
65 class GPU_EXPORT TransferBuffer : public TransferBufferInterface { 75 class GPU_EXPORT TransferBuffer : public TransferBufferInterface {
66 public: 76 public:
67 TransferBuffer(CommandBufferHelper* helper); 77 TransferBuffer(CommandBufferHelper* helper);
68 ~TransferBuffer() override; 78 ~TransferBuffer() override;
69 79
70 // Overridden from TransferBufferInterface. 80 // Overridden from TransferBufferInterface.
81 base::SharedMemoryHandle shared_memory_handle() const override;
71 bool Initialize(unsigned int default_buffer_size, 82 bool Initialize(unsigned int default_buffer_size,
72 unsigned int result_size, 83 unsigned int result_size,
73 unsigned int min_buffer_size, 84 unsigned int min_buffer_size,
74 unsigned int max_buffer_size, 85 unsigned int max_buffer_size,
75 unsigned int alignment, 86 unsigned int alignment,
76 unsigned int size_to_flush) override; 87 unsigned int size_to_flush) override;
77 int GetShmId() override; 88 int GetShmId() override;
78 void* GetResultBuffer() override; 89 void* GetResultBuffer() override;
79 int GetResultOffset() override; 90 int GetResultOffset() override;
80 void Free() override; 91 void Free() override;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 223 }
213 224
214 unsigned int num_elements() const { 225 unsigned int num_elements() const {
215 return size() / sizeof(T); 226 return size() / sizeof(T);
216 } 227 }
217 }; 228 };
218 229
219 } // namespace gpu 230 } // namespace gpu
220 231
221 #endif // GPU_COMMAND_BUFFER_CLIENT_TRANSFER_BUFFER_H_ 232 #endif // GPU_COMMAND_BUFFER_CLIENT_TRANSFER_BUFFER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation_unittest.cc ('k') | gpu/command_buffer/client/transfer_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698