OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_COMMON_COMMAND_BUFFER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
6 #define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ | 6 #define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
7 | 7 |
8 #include "../common/buffer.h" | 8 #include "../common/buffer.h" |
9 #include "../common/constants.h" | 9 #include "../common/constants.h" |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 // Allows the reader to update the current token value. | 116 // Allows the reader to update the current token value. |
117 virtual void SetToken(int32 token) = 0; | 117 virtual void SetToken(int32 token) = 0; |
118 | 118 |
119 // Allows the reader to set the current parse error. | 119 // Allows the reader to set the current parse error. |
120 virtual void SetParseError(error::Error) = 0; | 120 virtual void SetParseError(error::Error) = 0; |
121 | 121 |
122 private: | 122 private: |
123 DISALLOW_COPY_AND_ASSIGN(CommandBuffer); | 123 DISALLOW_COPY_AND_ASSIGN(CommandBuffer); |
124 }; | 124 }; |
125 | 125 |
126 // Synchronizing other mechanisms (such as IPC) with the CommandBuffer requires | |
127 // inserting (writing) a token into the buffer and knowing what the last token | |
128 // read at that point was. ReadWriteTokens is a convenience struct for passing | |
129 // these pairs around. Expected usage is to compare a current token to | |
130 // [last_token_read,last_token_written). | |
131 struct ReadWriteTokens { | |
132 ReadWriteTokens(int32 read, int32 written); | |
133 // Required to support pickling. Use by anything else will DCHECK in InRange. | |
134 ReadWriteTokens(); | |
135 | |
136 // Return true iff |value| is in the range described by |tokens|, accounting | |
137 // for (up to) one wrap-around. | |
138 bool InRange(int32 token) const; | |
139 | |
140 // This want to be private (and const) but can't in order to support pickling. | |
piman
2011/06/28 21:24:41
No need for this comment... coding style says that
Ami GONE FROM CHROMIUM
2011/06/28 21:27:38
My reason for the comment is that this isn't used
| |
141 int32 last_token_read; | |
142 int32 last_token_written; | |
143 }; | |
144 | |
126 } // namespace gpu | 145 } // namespace gpu |
127 | 146 |
128 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ | 147 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
OLD | NEW |