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 #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> |
(...skipping 30 matching lines...) Expand all Loading... |
41 // If you are designing an API from scratch you can avoid this need for | 41 // If you are designing an API from scratch you can avoid this need for |
42 // Buckets by making your API always take an offset and a size | 42 // Buckets by making your API always take an offset and a size |
43 // similar to glBufferSubData. | 43 // similar to glBufferSubData. |
44 // | 44 // |
45 // Buckets also help pass strings to/from the service. To return a string of | 45 // Buckets also help pass strings to/from the service. To return a string of |
46 // arbitary size, the service puts the string in a bucket. The client can | 46 // arbitary size, the service puts the string in a bucket. The client can |
47 // then query the size of a bucket and request sections of the bucket to | 47 // then query the size of a bucket and request sections of the bucket to |
48 // be passed across shared memory. | 48 // be passed across shared memory. |
49 class Bucket { | 49 class Bucket { |
50 public: | 50 public: |
51 Bucket() : size_(0) { | 51 Bucket(); |
52 } | 52 ~Bucket(); |
53 | 53 |
54 size_t size() const { | 54 size_t size() const { |
55 return size_; | 55 return size_; |
56 } | 56 } |
57 | 57 |
58 // Gets a pointer to a section the bucket. Returns NULL if offset or size is | 58 // Gets a pointer to a section the bucket. Returns NULL if offset or size is |
59 // out of range. | 59 // out of range. |
60 void* GetData(size_t offset, size_t size) const; | 60 void* GetData(size_t offset, size_t size) const; |
61 | 61 |
62 template <typename T> | 62 template <typename T> |
(...skipping 22 matching lines...) Expand all Loading... |
85 size_t temp = offset + size; | 85 size_t temp = offset + size; |
86 return temp <= size_ && temp >= offset; | 86 return temp <= size_ && temp >= offset; |
87 } | 87 } |
88 | 88 |
89 size_t size_; | 89 size_t size_; |
90 scoped_array<int8> data_; | 90 scoped_array<int8> data_; |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(Bucket); | 92 DISALLOW_COPY_AND_ASSIGN(Bucket); |
93 }; | 93 }; |
94 | 94 |
95 CommonDecoder() : engine_(NULL) { | 95 CommonDecoder(); |
96 } | 96 virtual ~CommonDecoder(); |
97 virtual ~CommonDecoder() { | |
98 } | |
99 | 97 |
100 // Sets the engine, to get shared memory buffers from, and to set the token | 98 // Sets the engine, to get shared memory buffers from, and to set the token |
101 // to. | 99 // to. |
102 void set_engine(CommandBufferEngine* engine) { | 100 void set_engine(CommandBufferEngine* engine) { |
103 engine_ = engine; | 101 engine_ = engine; |
104 } | 102 } |
105 | 103 |
106 // Gets a bucket. Returns NULL if the bucket does not exist. | 104 // Gets a bucket. Returns NULL if the bucket does not exist. |
107 Bucket* GetBucket(uint32 bucket_id) const; | 105 Bucket* GetBucket(uint32 bucket_id) const; |
108 | 106 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 173 |
176 uint32 offset; | 174 uint32 offset; |
177 }; | 175 }; |
178 std::stack<CommandAddress> call_stack_; | 176 std::stack<CommandAddress> call_stack_; |
179 }; | 177 }; |
180 | 178 |
181 } // namespace gpu | 179 } // namespace gpu |
182 | 180 |
183 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ | 181 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ |
184 | 182 |
OLD | NEW |