| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // This file contains the command parser class. | 5 // This file contains the command parser class. |
| 6 | 6 |
| 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_ | 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_ |
| 8 #define GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_ | 8 #define GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_ |
| 9 | 9 |
| 10 #include "gpu/command_buffer/common/constants.h" | 10 #include "gpu/command_buffer/common/constants.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 CommandBufferOffset start_get, | 25 CommandBufferOffset start_get, |
| 26 AsyncAPIInterface *handler); | 26 AsyncAPIInterface *handler); |
| 27 | 27 |
| 28 // Gets the "get" pointer. The get pointer is an index into the command | 28 // Gets the "get" pointer. The get pointer is an index into the command |
| 29 // buffer considered as an array of CommandBufferEntry. | 29 // buffer considered as an array of CommandBufferEntry. |
| 30 CommandBufferOffset get() const { return get_; } | 30 CommandBufferOffset get() const { return get_; } |
| 31 | 31 |
| 32 // Sets the "get" pointer. The get pointer is an index into the command buffer | 32 // Sets the "get" pointer. The get pointer is an index into the command buffer |
| 33 // considered as an array of CommandBufferEntry. | 33 // considered as an array of CommandBufferEntry. |
| 34 bool set_get(CommandBufferOffset get) { | 34 bool set_get(CommandBufferOffset get) { |
| 35 if (get < entry_count_) { | 35 if (get >= 0 && get < entry_count_) { |
| 36 get_ = get; | 36 get_ = get; |
| 37 return true; | 37 return true; |
| 38 } | 38 } |
| 39 return false; | 39 return false; |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Sets the "put" pointer. The put pointer is an index into the command | 42 // Sets the "put" pointer. The put pointer is an index into the command |
| 43 // buffer considered as an array of CommandBufferEntry. | 43 // buffer considered as an array of CommandBufferEntry. |
| 44 void set_put(CommandBufferOffset put) { put_ = put; } | 44 void set_put(CommandBufferOffset put) { put_ = put; } |
| 45 | 45 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 unsigned int arg_count, | 88 unsigned int arg_count, |
| 89 const void* cmd_data) = 0; | 89 const void* cmd_data) = 0; |
| 90 | 90 |
| 91 // Returns a name for a command. Useful for logging / debuging. | 91 // Returns a name for a command. Useful for logging / debuging. |
| 92 virtual const char* GetCommandName(unsigned int command_id) const = 0; | 92 virtual const char* GetCommandName(unsigned int command_id) const = 0; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 } // namespace gpu | 95 } // namespace gpu |
| 96 | 96 |
| 97 #endif // GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_ | 97 #endif // GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_ |
| OLD | NEW |