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_CLIENT_QUERY_TRACKER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_QUERY_TRACKER_H_ |
6 #define GPU_COMMAND_BUFFER_CLIENT_QUERY_TRACKER_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_QUERY_TRACKER_H_ |
7 | 7 |
8 #include <GLES2/gl2.h> | 8 #include <GLES2/gl2.h> |
9 | 9 |
10 #include <deque> | 10 #include <deque> |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 void MarkAsActive() { | 106 void MarkAsActive() { |
107 state_ = kActive; | 107 state_ = kActive; |
108 ++submit_count_; | 108 ++submit_count_; |
109 if (submit_count_ == INT_MAX) | 109 if (submit_count_ == INT_MAX) |
110 submit_count_ = 1; | 110 submit_count_ = 1; |
111 } | 111 } |
112 | 112 |
113 void MarkAsPending(int32 token) { | 113 void MarkAsPending(int32 token) { |
114 token_ = token; | 114 token_ = token; |
115 state_ = kPending; | 115 state_ = kPending; |
116 flushed_ = false; | |
117 } | 116 } |
118 | 117 |
119 base::subtle::Atomic32 submit_count() const { return submit_count_; } | 118 base::subtle::Atomic32 submit_count() const { return submit_count_; } |
120 | 119 |
121 int32 token() const { | 120 int32 token() const { |
122 return token_; | 121 return token_; |
123 } | 122 } |
124 | 123 |
125 bool NeverUsed() const { | 124 bool NeverUsed() const { |
126 return state_ == kUninitialized; | 125 return state_ == kUninitialized; |
(...skipping 13 matching lines...) Expand all Loading... |
140 private: | 139 private: |
141 friend class QueryTracker; | 140 friend class QueryTracker; |
142 friend class QueryTrackerTest; | 141 friend class QueryTrackerTest; |
143 | 142 |
144 GLuint id_; | 143 GLuint id_; |
145 GLenum target_; | 144 GLenum target_; |
146 QuerySyncManager::QueryInfo info_; | 145 QuerySyncManager::QueryInfo info_; |
147 State state_; | 146 State state_; |
148 base::subtle::Atomic32 submit_count_; | 147 base::subtle::Atomic32 submit_count_; |
149 int32 token_; | 148 int32 token_; |
150 bool flushed_; | 149 uint32 flush_count_; |
151 uint64 client_begin_time_us_; // Only used for latency query target. | 150 uint64 client_begin_time_us_; // Only used for latency query target. |
152 uint32 result_; | 151 uint32 result_; |
153 }; | 152 }; |
154 | 153 |
155 QueryTracker(MappedMemoryManager* manager); | 154 QueryTracker(MappedMemoryManager* manager); |
156 ~QueryTracker(); | 155 ~QueryTracker(); |
157 | 156 |
158 Query* CreateQuery(GLuint id, GLenum target); | 157 Query* CreateQuery(GLuint id, GLenum target); |
159 Query* GetQuery(GLuint id); | 158 Query* GetQuery(GLuint id); |
160 void RemoveQuery(GLuint id); | 159 void RemoveQuery(GLuint id); |
161 void Shrink(); | 160 void Shrink(); |
162 void FreeCompletedQueries(); | 161 void FreeCompletedQueries(); |
163 | 162 |
164 private: | 163 private: |
165 typedef base::hash_map<GLuint, Query*> QueryMap; | 164 typedef base::hash_map<GLuint, Query*> QueryMap; |
166 typedef std::list<Query*> QueryList; | 165 typedef std::list<Query*> QueryList; |
167 | 166 |
168 QueryMap queries_; | 167 QueryMap queries_; |
169 QueryList removed_queries_; | 168 QueryList removed_queries_; |
170 QuerySyncManager query_sync_manager_; | 169 QuerySyncManager query_sync_manager_; |
171 | 170 |
172 DISALLOW_COPY_AND_ASSIGN(QueryTracker); | 171 DISALLOW_COPY_AND_ASSIGN(QueryTracker); |
173 }; | 172 }; |
174 | 173 |
175 } // namespace gles2 | 174 } // namespace gles2 |
176 } // namespace gpu | 175 } // namespace gpu |
177 | 176 |
178 #endif // GPU_COMMAND_BUFFER_CLIENT_QUERY_TRACKER_H_ | 177 #endif // GPU_COMMAND_BUFFER_CLIENT_QUERY_TRACKER_H_ |
OLD | NEW |