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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 318 |
319 // If this triggers, that means something is keeping a reference to | 319 // If this triggers, that means something is keeping a reference to |
320 // a Query belonging to this. | 320 // a Query belonging to this. |
321 CHECK_EQ(query_count_, 0u); | 321 CHECK_EQ(query_count_, 0u); |
322 } | 322 } |
323 | 323 |
324 void QueryManager::Destroy(bool have_context) { | 324 void QueryManager::Destroy(bool have_context) { |
325 pending_queries_.clear(); | 325 pending_queries_.clear(); |
326 pending_transfer_queries_.clear(); | 326 pending_transfer_queries_.clear(); |
327 while (!queries_.empty()) { | 327 while (!queries_.empty()) { |
328 Query* query = queries_.begin()->second; | 328 Query* query = queries_.begin()->second.get(); |
329 query->Destroy(have_context); | 329 query->Destroy(have_context); |
330 queries_.erase(queries_.begin()); | 330 queries_.erase(queries_.begin()); |
331 } | 331 } |
332 } | 332 } |
333 | 333 |
334 QueryManager::Query* QueryManager::CreateQuery( | 334 QueryManager::Query* QueryManager::CreateQuery( |
335 GLenum target, GLuint client_id, int32 shm_id, uint32 shm_offset) { | 335 GLenum target, GLuint client_id, int32 shm_id, uint32 shm_offset) { |
336 scoped_refptr<Query> query; | 336 scoped_refptr<Query> query; |
337 switch (target) { | 337 switch (target) { |
338 case GL_COMMANDS_ISSUED_CHROMIUM: | 338 case GL_COMMANDS_ISSUED_CHROMIUM: |
(...skipping 26 matching lines...) Expand all Loading... |
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 : 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; | 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 } |
380 } | 380 } |
381 | 381 |
382 void QueryManager::StartTracking(QueryManager::Query* /* query */) { | 382 void QueryManager::StartTracking(QueryManager::Query* /* query */) { |
383 ++query_count_; | 383 ++query_count_; |
384 } | 384 } |
385 | 385 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 if (!RemovePendingQuery(query)) { | 557 if (!RemovePendingQuery(query)) { |
558 return false; | 558 return false; |
559 } | 559 } |
560 return query->End(submit_count); | 560 return query->End(submit_count); |
561 } | 561 } |
562 | 562 |
563 } // namespace gles2 | 563 } // namespace gles2 |
564 } // namespace gpu | 564 } // namespace gpu |
565 | 565 |
566 | 566 |
OLD | NEW |