| 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 "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace gles2 { | 22 namespace gles2 { |
| 23 | 23 |
| 24 class FeatureInfo; | 24 class FeatureInfo; |
| 25 | 25 |
| 26 // This class keeps track of the queries and their state | 26 // This class keeps track of the queries and their state |
| 27 // As Queries are not shared there is one QueryManager per context. | 27 // As Queries are not shared there is one QueryManager per context. |
| 28 class GPU_EXPORT QueryManager { | 28 class GPU_EXPORT QueryManager { |
| 29 public: | 29 public: |
| 30 class GPU_EXPORT Query : public base::RefCounted<Query> { | 30 class GPU_EXPORT Query : public base::RefCounted<Query> { |
| 31 public: | 31 public: |
| 32 typedef scoped_refptr<Query> Ref; | |
| 33 | |
| 34 Query( | 32 Query( |
| 35 QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset); | 33 QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset); |
| 36 | 34 |
| 37 GLenum target() const { | 35 GLenum target() const { |
| 38 return target_; | 36 return target_; |
| 39 } | 37 } |
| 40 | 38 |
| 41 bool IsDeleted() const { | 39 bool IsDeleted() const { |
| 42 return deleted_; | 40 return deleted_; |
| 43 } | 41 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 GLES2Decoder* decoder_; | 210 GLES2Decoder* decoder_; |
| 213 | 211 |
| 214 bool use_arb_occlusion_query2_for_occlusion_query_boolean_; | 212 bool use_arb_occlusion_query2_for_occlusion_query_boolean_; |
| 215 bool use_arb_occlusion_query_for_occlusion_query_boolean_; | 213 bool use_arb_occlusion_query_for_occlusion_query_boolean_; |
| 216 | 214 |
| 217 // Counts the number of Queries allocated with 'this' as their manager. | 215 // Counts the number of Queries allocated with 'this' as their manager. |
| 218 // Allows checking no Query will outlive this. | 216 // Allows checking no Query will outlive this. |
| 219 unsigned query_count_; | 217 unsigned query_count_; |
| 220 | 218 |
| 221 // Info for each query in the system. | 219 // Info for each query in the system. |
| 222 typedef base::hash_map<GLuint, Query::Ref> QueryMap; | 220 typedef base::hash_map<GLuint, scoped_refptr<Query> > QueryMap; |
| 223 QueryMap queries_; | 221 QueryMap queries_; |
| 224 | 222 |
| 225 // Queries waiting for completion. | 223 // Queries waiting for completion. |
| 226 typedef std::deque<Query::Ref> QueryQueue; | 224 typedef std::deque<scoped_refptr<Query> > QueryQueue; |
| 227 QueryQueue pending_queries_; | 225 QueryQueue pending_queries_; |
| 228 | 226 |
| 229 // Async pixel transfer queries waiting for completion. | 227 // Async pixel transfer queries waiting for completion. |
| 230 QueryQueue pending_transfer_queries_; | 228 QueryQueue pending_transfer_queries_; |
| 231 | 229 |
| 232 DISALLOW_COPY_AND_ASSIGN(QueryManager); | 230 DISALLOW_COPY_AND_ASSIGN(QueryManager); |
| 233 }; | 231 }; |
| 234 | 232 |
| 235 } // namespace gles2 | 233 } // namespace gles2 |
| 236 } // namespace gpu | 234 } // namespace gpu |
| 237 | 235 |
| 238 #endif // GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ | 236 #endif // GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ |
| OLD | NEW |