| 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 <vector> |
| 10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 return shm_offset_; | 62 return shm_offset_; |
| 63 } | 63 } |
| 64 | 64 |
| 65 // Returns false if shared memory for sync is invalid. | 65 // Returns false if shared memory for sync is invalid. |
| 66 virtual bool Begin() = 0; | 66 virtual bool Begin() = 0; |
| 67 | 67 |
| 68 // Returns false if shared memory for sync is invalid. | 68 // Returns false if shared memory for sync is invalid. |
| 69 virtual bool End(base::subtle::Atomic32 submit_count) = 0; | 69 virtual bool End(base::subtle::Atomic32 submit_count) = 0; |
| 70 | 70 |
| 71 // Returns false if shared memory for sync is invalid. | 71 // Returns false if shared memory for sync is invalid. |
| 72 virtual bool QueryCounter(base::subtle::Atomic32 submit_count) = 0; |
| 73 |
| 74 // Returns false if shared memory for sync is invalid. |
| 72 virtual bool Process(bool did_finish) = 0; | 75 virtual bool Process(bool did_finish) = 0; |
| 73 | 76 |
| 74 virtual void Destroy(bool have_context) = 0; | 77 virtual void Destroy(bool have_context) = 0; |
| 75 | 78 |
| 76 void AddCallback(base::Closure callback); | 79 void AddCallback(base::Closure callback); |
| 77 | 80 |
| 78 protected: | 81 protected: |
| 79 virtual ~Query(); | 82 virtual ~Query(); |
| 80 | 83 |
| 81 QueryManager* manager() const { | 84 QueryManager* manager() const { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 170 |
| 168 // Removes a query info for the given query. | 171 // Removes a query info for the given query. |
| 169 void RemoveQuery(GLuint client_id); | 172 void RemoveQuery(GLuint client_id); |
| 170 | 173 |
| 171 // Returns false if any query is pointing to invalid shared memory. | 174 // Returns false if any query is pointing to invalid shared memory. |
| 172 bool BeginQuery(Query* query); | 175 bool BeginQuery(Query* query); |
| 173 | 176 |
| 174 // Returns false if any query is pointing to invalid shared memory. | 177 // Returns false if any query is pointing to invalid shared memory. |
| 175 bool EndQuery(Query* query, base::subtle::Atomic32 submit_count); | 178 bool EndQuery(Query* query, base::subtle::Atomic32 submit_count); |
| 176 | 179 |
| 180 // Returns false if any query is pointing to invalid shared memory. |
| 181 bool QueryCounter(Query* query, base::subtle::Atomic32 submit_count); |
| 182 |
| 177 // Processes pending queries. Returns false if any queries are pointing | 183 // Processes pending queries. Returns false if any queries are pointing |
| 178 // to invalid shared memory. |did_finish| is true if this is called as | 184 // to invalid shared memory. |did_finish| is true if this is called as |
| 179 // a result of calling glFinish(). | 185 // a result of calling glFinish(). |
| 180 bool ProcessPendingQueries(bool did_finish); | 186 bool ProcessPendingQueries(bool did_finish); |
| 181 | 187 |
| 182 // True if there are pending queries. | 188 // True if there are pending queries. |
| 183 bool HavePendingQueries(); | 189 bool HavePendingQueries(); |
| 184 | 190 |
| 185 // Processes pending transfer queries. Returns false if any queries are | 191 // Processes pending transfer queries. Returns false if any queries are |
| 186 // pointing to invalid shared memory. | 192 // pointing to invalid shared memory. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 typedef base::hash_set<GLuint> GeneratedQueryIds; | 248 typedef base::hash_set<GLuint> GeneratedQueryIds; |
| 243 GeneratedQueryIds generated_query_ids_; | 249 GeneratedQueryIds generated_query_ids_; |
| 244 | 250 |
| 245 // Queries waiting for completion. | 251 // Queries waiting for completion. |
| 246 typedef std::deque<scoped_refptr<Query> > QueryQueue; | 252 typedef std::deque<scoped_refptr<Query> > QueryQueue; |
| 247 QueryQueue pending_queries_; | 253 QueryQueue pending_queries_; |
| 248 | 254 |
| 249 // Async pixel transfer queries waiting for completion. | 255 // Async pixel transfer queries waiting for completion. |
| 250 QueryQueue pending_transfer_queries_; | 256 QueryQueue pending_transfer_queries_; |
| 251 | 257 |
| 252 // Used for timer queries. | |
| 253 scoped_refptr<gfx::GPUTimingClient> gpu_timing_client_; | 258 scoped_refptr<gfx::GPUTimingClient> gpu_timing_client_; |
| 254 | 259 |
| 255 DISALLOW_COPY_AND_ASSIGN(QueryManager); | 260 DISALLOW_COPY_AND_ASSIGN(QueryManager); |
| 256 }; | 261 }; |
| 257 | 262 |
| 258 } // namespace gles2 | 263 } // namespace gles2 |
| 259 } // namespace gpu | 264 } // namespace gpu |
| 260 | 265 |
| 261 #endif // GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ | 266 #endif // GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ |
| OLD | NEW |