| 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 61a8d7f55c68794ff38eccdd011005c3cef5f54c..51055e2034a46fa5012ad2cc9c046903bfa24010 100644
|
| --- a/gpu/command_buffer/service/query_manager.cc
|
| +++ b/gpu/command_buffer/service/query_manager.cc
|
| @@ -4,11 +4,13 @@
|
|
|
| #include "gpu/command_buffer/service/query_manager.h"
|
| #include "base/atomicops.h"
|
| +#include "base/bind.h"
|
| #include "base/logging.h"
|
| #include "base/time.h"
|
| #include "gpu/command_buffer/common/gles2_cmd_format.h"
|
| #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
|
| #include "gpu/command_buffer/service/feature_info.h"
|
| +#include "ui/gl/async_pixel_transfer_delegate.h"
|
|
|
| namespace gpu {
|
| namespace gles2 {
|
| @@ -162,7 +164,9 @@ void CommandLatencyQuery::Destroy(bool /* have_context */) {
|
| CommandLatencyQuery::~CommandLatencyQuery() {
|
| }
|
|
|
| -class AsyncPixelTransfersCompletedQuery : public QueryManager::Query {
|
| +class AsyncPixelTransfersCompletedQuery
|
| + : public QueryManager::Query
|
| + , public base::SupportsWeakPtr<AsyncPixelTransfersCompletedQuery> {
|
| public:
|
| AsyncPixelTransfersCompletedQuery(
|
| QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset);
|
| @@ -172,6 +176,8 @@ class AsyncPixelTransfersCompletedQuery : public QueryManager::Query {
|
| virtual bool Process() OVERRIDE;
|
| virtual void Destroy(bool have_context) OVERRIDE;
|
|
|
| + void MarkAsCompletedCallback() { MarkAsCompleted(1); }
|
| +
|
| protected:
|
| virtual ~AsyncPixelTransfersCompletedQuery();
|
| };
|
| @@ -186,12 +192,24 @@ bool AsyncPixelTransfersCompletedQuery::Begin() {
|
| }
|
|
|
| bool AsyncPixelTransfersCompletedQuery::End(uint32 submit_count) {
|
| - // TODO(epenner): Mark completion via an async task.
|
| - // TODO(epenner): This will be a boolean to start, indicating
|
| - // completion of all tasks in the query. We could change this
|
| - // to return a count of tasks completed instead.
|
| MarkAsPending(submit_count);
|
| - return MarkAsCompleted(1);
|
| +
|
| + // This will call MarkAsCompleted(1) as a reply to a task on
|
| + // the async upload thread, such that it occurs after all previous
|
| + // async transfers have completed.
|
| + manager()->decoder()->GetAsyncPixelTransferDelegate()->AsyncNotifyCompletion(
|
| + base::Bind(
|
| + &AsyncPixelTransfersCompletedQuery::MarkAsCompletedCallback,
|
| + AsWeakPtr()));
|
| +
|
| + // TODO(epenner): The async task occurs outside the normal
|
| + // flow, via a callback on this thread. Is there anything
|
| + // missing or wrong with that?
|
| +
|
| + // TODO(epenner): Could we possibly trigger the completion on
|
| + // the upload thread by writing to the query shared memory
|
| + // directly?
|
| + return true;
|
| }
|
|
|
| bool AsyncPixelTransfersCompletedQuery::Process() {
|
|
|