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_QUERY_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
| 9 #include <vector> |
9 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
10 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "gpu/command_buffer/service/feature_info.h" | 15 #include "gpu/command_buffer/service/feature_info.h" |
15 #include "gpu/command_buffer/service/gl_utils.h" | 16 #include "gpu/command_buffer/service/gl_utils.h" |
16 #include "gpu/gpu_export.h" | 17 #include "gpu/gpu_export.h" |
17 | 18 |
18 namespace gpu { | 19 namespace gpu { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 virtual bool Begin() = 0; | 61 virtual bool Begin() = 0; |
61 | 62 |
62 // Returns false if shared memory for sync is invalid. | 63 // Returns false if shared memory for sync is invalid. |
63 virtual bool End(uint32 submit_count) = 0; | 64 virtual bool End(uint32 submit_count) = 0; |
64 | 65 |
65 // Returns false if shared memory for sync is invalid. | 66 // Returns false if shared memory for sync is invalid. |
66 virtual bool Process() = 0; | 67 virtual bool Process() = 0; |
67 | 68 |
68 virtual void Destroy(bool have_context) = 0; | 69 virtual void Destroy(bool have_context) = 0; |
69 | 70 |
| 71 void AddCallback(base::Closure callback); |
| 72 |
70 protected: | 73 protected: |
71 virtual ~Query(); | 74 virtual ~Query(); |
72 | 75 |
73 QueryManager* manager() const { | 76 QueryManager* manager() const { |
74 return manager_; | 77 return manager_; |
75 } | 78 } |
76 | 79 |
77 void MarkAsDeleted() { | 80 void MarkAsDeleted() { |
78 deleted_ = true; | 81 deleted_ = true; |
79 } | 82 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 115 |
113 uint32 submit_count() const { | 116 uint32 submit_count() const { |
114 return submit_count_; | 117 return submit_count_; |
115 } | 118 } |
116 | 119 |
117 private: | 120 private: |
118 friend class QueryManager; | 121 friend class QueryManager; |
119 friend class QueryManagerTest; | 122 friend class QueryManagerTest; |
120 friend class base::RefCounted<Query>; | 123 friend class base::RefCounted<Query>; |
121 | 124 |
| 125 void RunCallbacks(); |
| 126 |
122 // The manager that owns this Query. | 127 // The manager that owns this Query. |
123 QueryManager* manager_; | 128 QueryManager* manager_; |
124 | 129 |
125 // The type of query. | 130 // The type of query. |
126 GLenum target_; | 131 GLenum target_; |
127 | 132 |
128 // The shared memory used with this Query. | 133 // The shared memory used with this Query. |
129 int32 shm_id_; | 134 int32 shm_id_; |
130 uint32 shm_offset_; | 135 uint32 shm_offset_; |
131 | 136 |
132 // Count to set process count do when completed. | 137 // Count to set process count do when completed. |
133 uint32 submit_count_; | 138 uint32 submit_count_; |
134 | 139 |
135 // True if in the queue. | 140 // True if in the queue. |
136 bool pending_; | 141 bool pending_; |
137 | 142 |
138 // True if deleted. | 143 // True if deleted. |
139 bool deleted_; | 144 bool deleted_; |
| 145 |
| 146 // List of callbacks to run when result is available. |
| 147 std::vector<base::Closure> callbacks_; |
140 }; | 148 }; |
141 | 149 |
142 QueryManager( | 150 QueryManager( |
143 GLES2Decoder* decoder, | 151 GLES2Decoder* decoder, |
144 FeatureInfo* feature_info); | 152 FeatureInfo* feature_info); |
145 ~QueryManager(); | 153 ~QueryManager(); |
146 | 154 |
147 // Must call before destruction. | 155 // Must call before destruction. |
148 void Destroy(bool have_context); | 156 void Destroy(bool have_context); |
149 | 157 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // Async pixel transfer queries waiting for completion. | 235 // Async pixel transfer queries waiting for completion. |
228 QueryQueue pending_transfer_queries_; | 236 QueryQueue pending_transfer_queries_; |
229 | 237 |
230 DISALLOW_COPY_AND_ASSIGN(QueryManager); | 238 DISALLOW_COPY_AND_ASSIGN(QueryManager); |
231 }; | 239 }; |
232 | 240 |
233 } // namespace gles2 | 241 } // namespace gles2 |
234 } // namespace gpu | 242 } // namespace gpu |
235 | 243 |
236 #endif // GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ | 244 #endif // GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ |
OLD | NEW |