| 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 bool QueryCounter(base::subtle::Atomic32 submit_count) override; | 472 bool QueryCounter(base::subtle::Atomic32 submit_count) override; |
| 473 void Pause() override; | 473 void Pause() override; |
| 474 void Resume() override; | 474 void Resume() override; |
| 475 bool Process(bool did_finish) override; | 475 bool Process(bool did_finish) override; |
| 476 void Destroy(bool have_context) override; | 476 void Destroy(bool have_context) override; |
| 477 | 477 |
| 478 protected: | 478 protected: |
| 479 ~CommandsCompletedQuery() override; | 479 ~CommandsCompletedQuery() override; |
| 480 | 480 |
| 481 private: | 481 private: |
| 482 scoped_ptr<gfx::GLFence> fence_; | 482 std::unique_ptr<gfx::GLFence> fence_; |
| 483 base::TimeTicks begin_time_; | 483 base::TimeTicks begin_time_; |
| 484 }; | 484 }; |
| 485 | 485 |
| 486 CommandsCompletedQuery::CommandsCompletedQuery(QueryManager* manager, | 486 CommandsCompletedQuery::CommandsCompletedQuery(QueryManager* manager, |
| 487 GLenum target, | 487 GLenum target, |
| 488 int32_t shm_id, | 488 int32_t shm_id, |
| 489 uint32_t shm_offset) | 489 uint32_t shm_offset) |
| 490 : Query(manager, target, shm_id, shm_offset) {} | 490 : Query(manager, target, shm_id, shm_offset) {} |
| 491 | 491 |
| 492 bool CommandsCompletedQuery::Begin() { | 492 bool CommandsCompletedQuery::Begin() { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 bool QueryCounter(base::subtle::Atomic32 submit_count) override; | 552 bool QueryCounter(base::subtle::Atomic32 submit_count) override; |
| 553 void Pause() override; | 553 void Pause() override; |
| 554 void Resume() override; | 554 void Resume() override; |
| 555 bool Process(bool did_finish) override; | 555 bool Process(bool did_finish) override; |
| 556 void Destroy(bool have_context) override; | 556 void Destroy(bool have_context) override; |
| 557 | 557 |
| 558 protected: | 558 protected: |
| 559 ~TimeElapsedQuery() override; | 559 ~TimeElapsedQuery() override; |
| 560 | 560 |
| 561 private: | 561 private: |
| 562 scoped_ptr<gfx::GPUTimer> gpu_timer_; | 562 std::unique_ptr<gfx::GPUTimer> gpu_timer_; |
| 563 }; | 563 }; |
| 564 | 564 |
| 565 TimeElapsedQuery::TimeElapsedQuery(QueryManager* manager, | 565 TimeElapsedQuery::TimeElapsedQuery(QueryManager* manager, |
| 566 GLenum target, | 566 GLenum target, |
| 567 int32_t shm_id, | 567 int32_t shm_id, |
| 568 uint32_t shm_offset) | 568 uint32_t shm_offset) |
| 569 : Query(manager, target, shm_id, shm_offset), | 569 : Query(manager, target, shm_id, shm_offset), |
| 570 gpu_timer_(manager->CreateGPUTimer(true)) {} | 570 gpu_timer_(manager->CreateGPUTimer(true)) {} |
| 571 | 571 |
| 572 bool TimeElapsedQuery::Begin() { | 572 bool TimeElapsedQuery::Begin() { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 bool QueryCounter(base::subtle::Atomic32 submit_count) override; | 629 bool QueryCounter(base::subtle::Atomic32 submit_count) override; |
| 630 void Pause() override; | 630 void Pause() override; |
| 631 void Resume() override; | 631 void Resume() override; |
| 632 bool Process(bool did_finish) override; | 632 bool Process(bool did_finish) override; |
| 633 void Destroy(bool have_context) override; | 633 void Destroy(bool have_context) override; |
| 634 | 634 |
| 635 protected: | 635 protected: |
| 636 ~TimeStampQuery() override; | 636 ~TimeStampQuery() override; |
| 637 | 637 |
| 638 private: | 638 private: |
| 639 scoped_ptr<gfx::GPUTimer> gpu_timer_; | 639 std::unique_ptr<gfx::GPUTimer> gpu_timer_; |
| 640 }; | 640 }; |
| 641 | 641 |
| 642 TimeStampQuery::TimeStampQuery(QueryManager* manager, | 642 TimeStampQuery::TimeStampQuery(QueryManager* manager, |
| 643 GLenum target, | 643 GLenum target, |
| 644 int32_t shm_id, | 644 int32_t shm_id, |
| 645 uint32_t shm_offset) | 645 uint32_t shm_offset) |
| 646 : Query(manager, target, shm_id, shm_offset), | 646 : Query(manager, target, shm_id, shm_offset), |
| 647 gpu_timer_(manager->CreateGPUTimer(false)) {} | 647 gpu_timer_(manager->CreateGPUTimer(false)) {} |
| 648 | 648 |
| 649 bool TimeStampQuery::Begin() { | 649 bool TimeStampQuery::Begin() { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 default: { | 802 default: { |
| 803 NOTREACHED(); | 803 NOTREACHED(); |
| 804 } | 804 } |
| 805 } | 805 } |
| 806 std::pair<QueryMap::iterator, bool> result = | 806 std::pair<QueryMap::iterator, bool> result = |
| 807 queries_.insert(std::make_pair(client_id, query)); | 807 queries_.insert(std::make_pair(client_id, query)); |
| 808 DCHECK(result.second); | 808 DCHECK(result.second); |
| 809 return query.get(); | 809 return query.get(); |
| 810 } | 810 } |
| 811 | 811 |
| 812 scoped_ptr<gfx::GPUTimer> QueryManager::CreateGPUTimer(bool elapsed_time) { | 812 std::unique_ptr<gfx::GPUTimer> QueryManager::CreateGPUTimer(bool elapsed_time) { |
| 813 return gpu_timing_client_->CreateGPUTimer(elapsed_time); | 813 return gpu_timing_client_->CreateGPUTimer(elapsed_time); |
| 814 } | 814 } |
| 815 | 815 |
| 816 bool QueryManager::GPUTimingAvailable() { | 816 bool QueryManager::GPUTimingAvailable() { |
| 817 return gpu_timing_client_->IsAvailable(); | 817 return gpu_timing_client_->IsAvailable(); |
| 818 } | 818 } |
| 819 | 819 |
| 820 void QueryManager::GenQueries(GLsizei n, const GLuint* queries) { | 820 void QueryManager::GenQueries(GLsizei n, const GLuint* queries) { |
| 821 DCHECK_GE(n, 0); | 821 DCHECK_GE(n, 0); |
| 822 for (GLsizei i = 0; i < n; ++i) { | 822 for (GLsizei i = 0; i < n; ++i) { |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 for (std::pair<const GLenum, scoped_refptr<Query> >& it : active_queries_) { | 1128 for (std::pair<const GLenum, scoped_refptr<Query> >& it : active_queries_) { |
| 1129 if (it.second->IsPaused()) { | 1129 if (it.second->IsPaused()) { |
| 1130 it.second->Resume(); | 1130 it.second->Resume(); |
| 1131 DCHECK(it.second->IsActive()); | 1131 DCHECK(it.second->IsActive()); |
| 1132 } | 1132 } |
| 1133 } | 1133 } |
| 1134 } | 1134 } |
| 1135 | 1135 |
| 1136 } // namespace gles2 | 1136 } // namespace gles2 |
| 1137 } // namespace gpu | 1137 } // namespace gpu |
| OLD | NEW |