| 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 #include "gpu/command_buffer/service/query_manager.h" | 5 #include "gpu/command_buffer/service/query_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
| (...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 DCHECK(active_it != active_queries_.end()); | 1111 DCHECK(active_it != active_queries_.end()); |
| 1112 DCHECK(query == active_it->second.get()); | 1112 DCHECK(query == active_it->second.get()); |
| 1113 active_queries_.erase(active_it); | 1113 active_queries_.erase(active_it); |
| 1114 | 1114 |
| 1115 return query->End(submit_count); | 1115 return query->End(submit_count); |
| 1116 } | 1116 } |
| 1117 | 1117 |
| 1118 bool QueryManager::QueryCounter( | 1118 bool QueryManager::QueryCounter( |
| 1119 Query* query, base::subtle::Atomic32 submit_count) { | 1119 Query* query, base::subtle::Atomic32 submit_count) { |
| 1120 DCHECK(query); | 1120 DCHECK(query); |
| 1121 if (!RemovePendingQuery(query)) { |
| 1122 return false; |
| 1123 } |
| 1121 return query->QueryCounter(submit_count); | 1124 return query->QueryCounter(submit_count); |
| 1122 } | 1125 } |
| 1123 | 1126 |
| 1124 void QueryManager::PauseQueries() { | 1127 void QueryManager::PauseQueries() { |
| 1125 for (std::pair<const GLenum, scoped_refptr<Query> >& it : active_queries_) { | 1128 for (std::pair<const GLenum, scoped_refptr<Query> >& it : active_queries_) { |
| 1126 if (it.second->IsActive()) { | 1129 if (it.second->IsActive()) { |
| 1127 it.second->Pause(); | 1130 it.second->Pause(); |
| 1128 DCHECK(it.second->IsPaused()); | 1131 DCHECK(it.second->IsPaused()); |
| 1129 } | 1132 } |
| 1130 } | 1133 } |
| 1131 } | 1134 } |
| 1132 | 1135 |
| 1133 void QueryManager::ResumeQueries() { | 1136 void QueryManager::ResumeQueries() { |
| 1134 for (std::pair<const GLenum, scoped_refptr<Query> >& it : active_queries_) { | 1137 for (std::pair<const GLenum, scoped_refptr<Query> >& it : active_queries_) { |
| 1135 if (it.second->IsPaused()) { | 1138 if (it.second->IsPaused()) { |
| 1136 it.second->Resume(); | 1139 it.second->Resume(); |
| 1137 DCHECK(it.second->IsActive()); | 1140 DCHECK(it.second->IsActive()); |
| 1138 } | 1141 } |
| 1139 } | 1142 } |
| 1140 } | 1143 } |
| 1141 | 1144 |
| 1142 } // namespace gles2 | 1145 } // namespace gles2 |
| 1143 } // namespace gpu | 1146 } // namespace gpu |
| OLD | NEW |