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

Side by Side Diff: gpu/command_buffer/service/common_decoder.h

Issue 2764403002: Make sure buffers are large enough to hold the Result structure. (Closed)
Patch Set: Created 3 years, 9 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_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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 // Typed version of GetAddressAndCheckSize. 146 // Typed version of GetAddressAndCheckSize.
147 template <typename T> 147 template <typename T>
148 T GetSharedMemoryAs(unsigned int shm_id, unsigned int offset, 148 T GetSharedMemoryAs(unsigned int shm_id, unsigned int offset,
149 unsigned int size) { 149 unsigned int size) {
150 return static_cast<T>(GetAddressAndCheckSize(shm_id, offset, size)); 150 return static_cast<T>(GetAddressAndCheckSize(shm_id, offset, size));
151 } 151 }
152 152
153 void* GetAddressAndSize(unsigned int shm_id, 153 void* GetAddressAndSize(unsigned int shm_id,
154 unsigned int offset, 154 unsigned int offset,
155 unsigned int minimum_size,
155 unsigned int* size); 156 unsigned int* size);
156 157
157 template <typename T> 158 template <typename T>
158 T GetSharedMemoryAndSizeAs(unsigned int shm_id, 159 T GetSharedMemoryAndSizeAs(unsigned int shm_id,
159 unsigned int offset, 160 unsigned int offset,
161 unsigned int minimum_size,
160 unsigned int* size) { 162 unsigned int* size) {
161 return static_cast<T>(GetAddressAndSize(shm_id, offset, size)); 163 return static_cast<T>(
164 GetAddressAndSize(shm_id, offset, minimum_size, size));
162 } 165 }
163 166
164 unsigned int GetSharedMemorySize(unsigned int shm_id, unsigned int offset); 167 unsigned int GetSharedMemorySize(unsigned int shm_id, unsigned int offset);
165 168
166 // Get the actual shared memory buffer. 169 // Get the actual shared memory buffer.
167 scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(unsigned int shm_id); 170 scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(unsigned int shm_id);
168 171
169 protected: 172 protected:
170 // Executes a common command. 173 // Executes a common command.
171 // Parameters: 174 // Parameters:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // A table of CommandInfo for all the commands. 216 // A table of CommandInfo for all the commands.
214 static const CommandInfo command_info[]; 217 static const CommandInfo command_info[];
215 218
216 DISALLOW_COPY_AND_ASSIGN(CommonDecoder); 219 DISALLOW_COPY_AND_ASSIGN(CommonDecoder);
217 }; 220 };
218 221
219 } // namespace gpu 222 } // namespace gpu
220 223
221 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ 224 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_
222 225
OLDNEW
« no previous file with comments | « gpu/command_buffer/build_gles2_cmd_buffer.py ('k') | gpu/command_buffer/service/common_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698