Chromium Code Reviews| Index: content/common/gpu/client/gl_helper.cc |
| diff --git a/content/common/gpu/client/gl_helper.cc b/content/common/gpu/client/gl_helper.cc |
| index 2ce57d9170115575ee0303764637d9aec07998b6..52c39d6d0de32acaad617599cdc1892708106316 100644 |
| --- a/content/common/gpu/client/gl_helper.cc |
| +++ b/content/common/gpu/client/gl_helper.cc |
| @@ -193,7 +193,8 @@ class GLHelper::CopyTextureToImpl : |
| row_stride_bytes(row_stride_bytes_), |
| pixels(pixels_), |
| callback(callback_), |
| - buffer(0) { |
| + buffer(0), |
| + query(0) { |
| } |
| gfx::Size size; |
| @@ -202,6 +203,7 @@ class GLHelper::CopyTextureToImpl : |
| unsigned char* pixels; |
| base::Callback<void(bool)> callback; |
| GLuint buffer; |
| + WebKit::WebGLId query; |
| }; |
| // A readback pipeline that also converts the data to YUV before |
| @@ -382,10 +384,14 @@ void GLHelper::CopyTextureToImpl::ReadbackAsync( |
| context_->readPixels(0, 0, dst_size.width(), dst_size.height(), |
| GL_RGBA, GL_UNSIGNED_BYTE, NULL); |
| + request->query = context_->createQueryEXT(); |
| + context_->beginQueryEXT(GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM, |
| + request->query); |
|
piman
2013/06/26 22:17:08
Don't you want to beginQuery before readPixels?
hubbe
2013/06/28 22:17:49
Done.
|
| context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0); |
| - cc::SyncPointHelper::SignalSyncPoint( |
| + context_->endQueryEXT(GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM); |
| + cc::SyncPointHelper::SignalQuery( |
| context_, |
| - context_->insertSyncPoint(), |
| + request->query, |
| base::Bind(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(), request)); |
| } |
| @@ -498,10 +504,15 @@ void GLHelper::CopyTextureToImpl::ReadbackDone(Request* request) { |
| void GLHelper::CopyTextureToImpl::FinishRequest(Request* request, |
| bool result) { |
| + TRACE_EVENT0("mirror", "GLHelper::CopyTextureToImpl::FinishRequest"); |
| DCHECK(request_queue_.front() == request); |
| request_queue_.pop(); |
| request->callback.Run(result); |
| ScopedFlush flush(context_); |
| + if (request->query != 0) { |
| + context_->deleteQueryEXT(request->query); |
| + request->query = 0; |
| + } |
| if (request->buffer != 0) { |
| context_->deleteBuffer(request->buffer); |
| request->buffer = 0; |