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 |
11 #include <map> | 11 #include <map> |
12 #include <memory> | 12 #include <memory> |
13 #include <stack> | |
14 #include <string> | 13 #include <string> |
15 | 14 |
16 #include "base/macros.h" | 15 #include "base/macros.h" |
17 #include "base/memory/linked_ptr.h" | |
18 #include "gpu/command_buffer/common/buffer.h" | 16 #include "gpu/command_buffer/common/buffer.h" |
19 #include "gpu/command_buffer/service/cmd_parser.h" | 17 #include "gpu/command_buffer/service/cmd_parser.h" |
20 #include "gpu/gpu_export.h" | 18 #include "gpu/gpu_export.h" |
21 | 19 |
22 // Forwardly declare a few GL types to avoid including GL header files. | 20 // Forwardly declare a few GL types to avoid including GL header files. |
23 typedef int GLsizei; | 21 typedef int GLsizei; |
24 typedef int GLint; | 22 typedef int GLint; |
25 | 23 |
26 namespace gpu { | 24 namespace gpu { |
27 | 25 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 #define COMMON_COMMAND_BUFFER_CMD_OP(name) \ | 189 #define COMMON_COMMAND_BUFFER_CMD_OP(name) \ |
192 error::Error Handle##name(uint32_t immediate_data_size, const void* data); | 190 error::Error Handle##name(uint32_t immediate_data_size, const void* data); |
193 | 191 |
194 COMMON_COMMAND_BUFFER_CMDS(COMMON_COMMAND_BUFFER_CMD_OP) | 192 COMMON_COMMAND_BUFFER_CMDS(COMMON_COMMAND_BUFFER_CMD_OP) |
195 | 193 |
196 #undef COMMON_COMMAND_BUFFER_CMD_OP | 194 #undef COMMON_COMMAND_BUFFER_CMD_OP |
197 | 195 |
198 CommandBufferEngine* engine_; | 196 CommandBufferEngine* engine_; |
199 size_t max_bucket_size_; | 197 size_t max_bucket_size_; |
200 | 198 |
201 typedef std::map<uint32_t, linked_ptr<Bucket>> BucketMap; | 199 typedef std::map<uint32_t, std::unique_ptr<Bucket>> BucketMap; |
202 BucketMap buckets_; | 200 BucketMap buckets_; |
203 | 201 |
204 typedef Error (CommonDecoder::*CmdHandler)(uint32_t immediate_data_size, | 202 typedef Error (CommonDecoder::*CmdHandler)(uint32_t immediate_data_size, |
205 const void* data); | 203 const void* data); |
206 | 204 |
207 // A struct to hold info about each command. | 205 // A struct to hold info about each command. |
208 struct CommandInfo { | 206 struct CommandInfo { |
209 CmdHandler cmd_handler; | 207 CmdHandler cmd_handler; |
210 uint8_t arg_flags; // How to handle the arguments for this command | 208 uint8_t arg_flags; // How to handle the arguments for this command |
211 uint8_t cmd_flags; // How to handle this command | 209 uint8_t cmd_flags; // How to handle this command |
212 uint16_t arg_count; // How many arguments are expected for this command. | 210 uint16_t arg_count; // How many arguments are expected for this command. |
213 }; | 211 }; |
214 | 212 |
215 // A table of CommandInfo for all the commands. | 213 // A table of CommandInfo for all the commands. |
216 static const CommandInfo command_info[]; | 214 static const CommandInfo command_info[]; |
217 | 215 |
| 216 DISALLOW_COPY_AND_ASSIGN(CommonDecoder); |
218 }; | 217 }; |
219 | 218 |
220 } // namespace gpu | 219 } // namespace gpu |
221 | 220 |
222 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ | 221 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ |
223 | 222 |
OLD | NEW |