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

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

Issue 2150803003: Introduce gpu_fuzzer to fuzz the GPU command buffers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fuzzer_land_base
Patch Set: Fix check, zero-out padding Created 4 years, 5 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 CommonDecoder(); 113 CommonDecoder();
114 ~CommonDecoder() override; 114 ~CommonDecoder() override;
115 115
116 // Sets the engine, to get shared memory buffers from, and to set the token 116 // Sets the engine, to get shared memory buffers from, and to set the token
117 // to. 117 // to.
118 void set_engine(CommandBufferEngine* engine) { 118 void set_engine(CommandBufferEngine* engine) {
119 engine_ = engine; 119 engine_ = engine;
120 } 120 }
121 CommandBufferEngine* engine() const { return engine_; } 121 CommandBufferEngine* engine() const { return engine_; }
122 122
123 // Sets the maximum size for buckets.
124 void set_max_bucket_size(size_t max_bucket_size) {
125 max_bucket_size_ = max_bucket_size;
126 }
127
123 // Creates a bucket. If the bucket already exists returns that bucket. 128 // Creates a bucket. If the bucket already exists returns that bucket.
124 Bucket* CreateBucket(uint32_t bucket_id); 129 Bucket* CreateBucket(uint32_t bucket_id);
125 130
126 // Gets a bucket. Returns NULL if the bucket does not exist. 131 // Gets a bucket. Returns NULL if the bucket does not exist.
127 Bucket* GetBucket(uint32_t bucket_id) const; 132 Bucket* GetBucket(uint32_t bucket_id) const;
128 133
129 // Gets the address of shared memory data, given a shared memory ID and an 134 // Gets the address of shared memory data, given a shared memory ID and an
130 // offset. Also checks that the size is consistent with the shared memory 135 // offset. Also checks that the size is consistent with the shared memory
131 // size. 136 // size.
132 // Parameters: 137 // Parameters:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // Generate a member function prototype for each command in an automated and 189 // Generate a member function prototype for each command in an automated and
185 // typesafe way. 190 // typesafe way.
186 #define COMMON_COMMAND_BUFFER_CMD_OP(name) \ 191 #define COMMON_COMMAND_BUFFER_CMD_OP(name) \
187 error::Error Handle##name(uint32_t immediate_data_size, const void* data); 192 error::Error Handle##name(uint32_t immediate_data_size, const void* data);
188 193
189 COMMON_COMMAND_BUFFER_CMDS(COMMON_COMMAND_BUFFER_CMD_OP) 194 COMMON_COMMAND_BUFFER_CMDS(COMMON_COMMAND_BUFFER_CMD_OP)
190 195
191 #undef COMMON_COMMAND_BUFFER_CMD_OP 196 #undef COMMON_COMMAND_BUFFER_CMD_OP
192 197
193 CommandBufferEngine* engine_; 198 CommandBufferEngine* engine_;
199 size_t max_bucket_size_;
194 200
195 typedef std::map<uint32_t, linked_ptr<Bucket>> BucketMap; 201 typedef std::map<uint32_t, linked_ptr<Bucket>> BucketMap;
196 BucketMap buckets_; 202 BucketMap buckets_;
197 203
198 typedef Error (CommonDecoder::*CmdHandler)(uint32_t immediate_data_size, 204 typedef Error (CommonDecoder::*CmdHandler)(uint32_t immediate_data_size,
199 const void* data); 205 const void* data);
200 206
201 // A struct to hold info about each command. 207 // A struct to hold info about each command.
202 struct CommandInfo { 208 struct CommandInfo {
203 CmdHandler cmd_handler; 209 CmdHandler cmd_handler;
204 uint8_t arg_flags; // How to handle the arguments for this command 210 uint8_t arg_flags; // How to handle the arguments for this command
205 uint8_t cmd_flags; // How to handle this command 211 uint8_t cmd_flags; // How to handle this command
206 uint16_t arg_count; // How many arguments are expected for this command. 212 uint16_t arg_count; // How many arguments are expected for this command.
207 }; 213 };
208 214
209 // A table of CommandInfo for all the commands. 215 // A table of CommandInfo for all the commands.
210 static const CommandInfo command_info[]; 216 static const CommandInfo command_info[];
211 217
212 }; 218 };
213 219
214 } // namespace gpu 220 } // namespace gpu
215 221
216 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ 222 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_
217 223
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/command_buffer_service.cc ('k') | gpu/command_buffer/service/common_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698