| Index: gpu/command_buffer/service/query_manager.cc
|
| diff --git a/gpu/command_buffer/service/query_manager.cc b/gpu/command_buffer/service/query_manager.cc
|
| index 5b06630db7dd71a4822adbb36ca622b272f88f42..f1c43d56b68694965288ca6005eec2c4d13a812c 100644
|
| --- a/gpu/command_buffer/service/query_manager.cc
|
| +++ b/gpu/command_buffer/service/query_manager.cc
|
| @@ -179,9 +179,6 @@ class AsyncPixelTransfersCompletedQuery
|
| virtual bool Process() OVERRIDE;
|
| virtual void Destroy(bool have_context) OVERRIDE;
|
|
|
| - protected:
|
| - virtual ~AsyncPixelTransfersCompletedQuery();
|
| -
|
| static void MarkAsCompletedThreadSafe(
|
| uint32 submit_count, const AsyncMemoryParams& mem_params) {
|
| DCHECK(mem_params.shared_memory);
|
| @@ -195,6 +192,10 @@ class AsyncPixelTransfersCompletedQuery
|
| base::subtle::MemoryBarrier();
|
| sync->process_count = submit_count;
|
| }
|
| +
|
| + protected:
|
| + virtual ~AsyncPixelTransfersCompletedQuery();
|
| +
|
| };
|
|
|
| AsyncPixelTransfersCompletedQuery::AsyncPixelTransfersCompletedQuery(
|
| @@ -223,9 +224,8 @@ bool AsyncPixelTransfersCompletedQuery::End(uint32 submit_count) {
|
| // on the current thread.
|
| manager()->decoder()->GetAsyncPixelTransferManager()->AsyncNotifyCompletion(
|
| mem_params,
|
| - base::Bind(AsyncPixelTransfersCompletedQuery::MarkAsCompletedThreadSafe,
|
| + base::Bind(&AsyncPixelTransfersCompletedQuery::MarkAsCompletedThreadSafe,
|
| submit_count));
|
| -
|
| return AddToPendingTransferQueue(submit_count);
|
| }
|
|
|
| @@ -254,6 +254,59 @@ void AsyncPixelTransfersCompletedQuery::Destroy(bool /* have_context */) {
|
| AsyncPixelTransfersCompletedQuery::~AsyncPixelTransfersCompletedQuery() {
|
| }
|
|
|
| +///////////////////
|
| +class AsyncReadPixelsCompletedQuery
|
| + : public QueryManager::Query
|
| + , public base::SupportsWeakPtr<AsyncReadPixelsCompletedQuery> {
|
| + public:
|
| + AsyncReadPixelsCompletedQuery(
|
| + QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset);
|
| +
|
| + virtual bool Begin() OVERRIDE;
|
| + virtual bool End(uint32 submit_count) OVERRIDE;
|
| + virtual bool Process() OVERRIDE;
|
| + virtual void Destroy(bool have_context) OVERRIDE;
|
| +
|
| + protected:
|
| + void Complete();
|
| + virtual ~AsyncReadPixelsCompletedQuery();
|
| +};
|
| +
|
| +AsyncReadPixelsCompletedQuery::AsyncReadPixelsCompletedQuery(
|
| + QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset)
|
| + : Query(manager, target, shm_id, shm_offset) {
|
| +}
|
| +
|
| +bool AsyncReadPixelsCompletedQuery::Begin() {
|
| + return true;
|
| +}
|
| +
|
| +bool AsyncReadPixelsCompletedQuery::End(uint32 submit_count) {
|
| + manager()->decoder()->WaitForReadPixels(
|
| + base::Bind(&AsyncReadPixelsCompletedQuery::Complete,
|
| + AsWeakPtr()));
|
| +
|
| + return AddToPendingTransferQueue(submit_count);
|
| +}
|
| +
|
| +void AsyncReadPixelsCompletedQuery::Complete() {
|
| + MarkAsCompleted(1);
|
| +}
|
| +
|
| +bool AsyncReadPixelsCompletedQuery::Process() {
|
| + return !pending();
|
| +}
|
| +
|
| +void AsyncReadPixelsCompletedQuery::Destroy(bool /* have_context */) {
|
| + if (!IsDeleted()) {
|
| + MarkAsDeleted();
|
| + }
|
| +}
|
| +
|
| +AsyncReadPixelsCompletedQuery::~AsyncReadPixelsCompletedQuery() {
|
| +}
|
| +
|
| +
|
| class GetErrorQuery : public QueryManager::Query {
|
| public:
|
| GetErrorQuery(
|
| @@ -345,6 +398,10 @@ QueryManager::Query* QueryManager::CreateQuery(
|
| query = new AsyncPixelTransfersCompletedQuery(
|
| this, target, shm_id, shm_offset);
|
| break;
|
| + case GL_ASYNC_READ_PIXELS_COMPLETED_CHROMIUM:
|
| + query = new AsyncReadPixelsCompletedQuery(
|
| + this, target, shm_id, shm_offset);
|
| + break;
|
| case GL_GET_ERROR_QUERY_CHROMIUM:
|
| query = new GetErrorQuery(this, target, shm_id, shm_offset);
|
| break;
|
|
|