OLD | NEW |
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_SERVICE_COMMON_DECODER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 unsigned int offset, | 140 unsigned int offset, |
141 unsigned int size); | 141 unsigned int size); |
142 | 142 |
143 // Typed version of GetAddressAndCheckSize. | 143 // Typed version of GetAddressAndCheckSize. |
144 template <typename T> | 144 template <typename T> |
145 T GetSharedMemoryAs(unsigned int shm_id, unsigned int offset, | 145 T GetSharedMemoryAs(unsigned int shm_id, unsigned int offset, |
146 unsigned int size) { | 146 unsigned int size) { |
147 return static_cast<T>(GetAddressAndCheckSize(shm_id, offset, size)); | 147 return static_cast<T>(GetAddressAndCheckSize(shm_id, offset, size)); |
148 } | 148 } |
149 | 149 |
| 150 void* GetAddressAndSize(unsigned int shm_id, |
| 151 unsigned int offset, |
| 152 unsigned int* size); |
| 153 |
| 154 template <typename T> |
| 155 T GetSharedMemoryAndSizeAs(unsigned int shm_id, |
| 156 unsigned int offset, |
| 157 unsigned int* size) { |
| 158 return static_cast<T>(GetAddressAndSize(shm_id, offset, size)); |
| 159 } |
| 160 |
| 161 unsigned int GetSharedMemorySize(unsigned int shm_id, unsigned int offset); |
| 162 |
150 // Get the actual shared memory buffer. | 163 // Get the actual shared memory buffer. |
151 scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(unsigned int shm_id); | 164 scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(unsigned int shm_id); |
152 | 165 |
153 protected: | 166 protected: |
154 // Executes a common command. | 167 // Executes a common command. |
155 // Parameters: | 168 // Parameters: |
156 // command: the command index. | 169 // command: the command index. |
157 // arg_count: the number of CommandBufferEntry arguments. | 170 // arg_count: the number of CommandBufferEntry arguments. |
158 // cmd_data: the command data. | 171 // cmd_data: the command data. |
159 // Returns: | 172 // Returns: |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 208 |
196 // A table of CommandInfo for all the commands. | 209 // A table of CommandInfo for all the commands. |
197 static const CommandInfo command_info[]; | 210 static const CommandInfo command_info[]; |
198 | 211 |
199 }; | 212 }; |
200 | 213 |
201 } // namespace gpu | 214 } // namespace gpu |
202 | 215 |
203 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ | 216 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ |
204 | 217 |
OLD | NEW |