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 "base/atomicops.h" | 7 #include "base/atomicops.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 } | 359 } |
360 std::pair<QueryMap::iterator, bool> result = | 360 std::pair<QueryMap::iterator, bool> result = |
361 queries_.insert(std::make_pair(client_id, query)); | 361 queries_.insert(std::make_pair(client_id, query)); |
362 DCHECK(result.second); | 362 DCHECK(result.second); |
363 return query.get(); | 363 return query.get(); |
364 } | 364 } |
365 | 365 |
366 QueryManager::Query* QueryManager::GetQuery( | 366 QueryManager::Query* QueryManager::GetQuery( |
367 GLuint client_id) { | 367 GLuint client_id) { |
368 QueryMap::iterator it = queries_.find(client_id); | 368 QueryMap::iterator it = queries_.find(client_id); |
369 return it != queries_.end() ? it->second : NULL; | 369 return it != queries_.end() ? it->second.get() : NULL; |
370 } | 370 } |
371 | 371 |
372 void QueryManager::RemoveQuery(GLuint client_id) { | 372 void QueryManager::RemoveQuery(GLuint client_id) { |
373 QueryMap::iterator it = queries_.find(client_id); | 373 QueryMap::iterator it = queries_.find(client_id); |
374 if (it != queries_.end()) { | 374 if (it != queries_.end()) { |
375 Query* query = it->second.get(); | 375 Query* query = it->second.get(); |
376 RemovePendingQuery(query); | 376 RemovePendingQuery(query); |
377 query->MarkAsDeleted(); | 377 query->MarkAsDeleted(); |
378 queries_.erase(it); | 378 queries_.erase(it); |
379 } | 379 } |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 bool QueryManager::EndQuery(Query* query, uint32 submit_count) { | 576 bool QueryManager::EndQuery(Query* query, uint32 submit_count) { |
577 DCHECK(query); | 577 DCHECK(query); |
578 if (!RemovePendingQuery(query)) { | 578 if (!RemovePendingQuery(query)) { |
579 return false; | 579 return false; |
580 } | 580 } |
581 return query->End(submit_count); | 581 return query->End(submit_count); |
582 } | 582 } |
583 | 583 |
584 } // namespace gles2 | 584 } // namespace gles2 |
585 } // namespace gpu | 585 } // namespace gpu |
OLD | NEW |