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..d0326e838f717b445ebd969a8b1c3cee1fa1168f 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,11 +384,15 @@ 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); |
| context_->bindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0); |
| - cc::SyncPointHelper::SignalSyncPoint( |
| + cc::SyncPointHelper::SignalQuery( |
| context_, |
| - context_->insertSyncPoint(), |
| + request->query, |
| base::Bind(&CopyTextureToImpl::ReadbackDone, AsWeakPtr(), request)); |
|
piman
2013/06/17 19:55:06
It is weird that you call signalQuery between begi
hubbe
2013/06/25 20:02:51
Done.
|
| + context_->endQueryEXT(GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM); |
| } |
| @@ -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; |