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 <map> | 8 #include <map> |
9 #include <stack> | 9 #include <stack> |
10 #include <string> | 10 #include <string> |
11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "gpu/command_buffer/common/buffer.h" | 13 #include "gpu/command_buffer/common/buffer.h" |
14 #include "gpu/command_buffer/service/cmd_parser.h" | 14 #include "gpu/command_buffer/service/cmd_parser.h" |
15 #include "gpu/gpu_export.h" | 15 #include "gpu/gpu_export.h" |
16 | 16 |
| 17 // Forwardly declare a few GL types to avoid including GL header files. |
| 18 typedef int GLsizei; |
| 19 typedef int GLint; |
| 20 |
17 namespace gpu { | 21 namespace gpu { |
18 | 22 |
19 class CommandBufferEngine; | 23 class CommandBufferEngine; |
20 | 24 |
21 // This class is a helper base class for implementing the common parts of the | 25 // This class is a helper base class for implementing the common parts of the |
22 // o3d/gl2 command buffer decoder. | 26 // o3d/gl2 command buffer decoder. |
23 class GPU_EXPORT CommonDecoder : NON_EXPORTED_BASE(public AsyncAPIInterface) { | 27 class GPU_EXPORT CommonDecoder : NON_EXPORTED_BASE(public AsyncAPIInterface) { |
24 public: | 28 public: |
25 typedef error::Error Error; | 29 typedef error::Error Error; |
26 | 30 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 79 |
76 // Sets the bucket data from a string. Strings are passed NULL terminated to | 80 // Sets the bucket data from a string. Strings are passed NULL terminated to |
77 // distinguish between empty string and no string. | 81 // distinguish between empty string and no string. |
78 void SetFromString(const char* str); | 82 void SetFromString(const char* str); |
79 | 83 |
80 // Gets the bucket data as a string. Strings are passed NULL terminated to | 84 // Gets the bucket data as a string. Strings are passed NULL terminated to |
81 // distrinquish between empty string and no string. Returns False if there | 85 // distrinquish between empty string and no string. Returns False if there |
82 // is no string. | 86 // is no string. |
83 bool GetAsString(std::string* str); | 87 bool GetAsString(std::string* str); |
84 | 88 |
| 89 // Gets the bucket data as strings. |
| 90 // On success, the number of strings are in |_count|, the string data are |
| 91 // in |_string|, and string sizes are in |_length|.. |
| 92 bool GetAsStrings(GLsizei* _count, |
| 93 std::vector<char*>* _string, |
| 94 std::vector<GLint>* _length); |
| 95 |
85 private: | 96 private: |
86 bool OffsetSizeValid(size_t offset, size_t size) const { | 97 bool OffsetSizeValid(size_t offset, size_t size) const { |
87 size_t temp = offset + size; | 98 size_t temp = offset + size; |
88 return temp <= size_ && temp >= offset; | 99 return temp <= size_ && temp >= offset; |
89 } | 100 } |
90 | 101 |
91 size_t size_; | 102 size_t size_; |
92 ::scoped_ptr<int8[]> data_; | 103 ::scoped_ptr<int8[]> data_; |
93 | 104 |
94 DISALLOW_COPY_AND_ASSIGN(Bucket); | 105 DISALLOW_COPY_AND_ASSIGN(Bucket); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 191 |
181 // A table of CommandInfo for all the commands. | 192 // A table of CommandInfo for all the commands. |
182 static const CommandInfo command_info[]; | 193 static const CommandInfo command_info[]; |
183 | 194 |
184 }; | 195 }; |
185 | 196 |
186 } // namespace gpu | 197 } // namespace gpu |
187 | 198 |
188 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ | 199 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ |
189 | 200 |
OLD | NEW |