| 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..2972c32beb33d290d2b0060efe7446b035b75b7e 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
|
| @@ -380,12 +382,16 @@ void GLHelper::CopyTextureToImpl::ReadbackAsync(
|
| NULL,
|
| GL_STREAM_READ);
|
|
|
| + request->query = context_->createQueryEXT();
|
| + context_->beginQueryEXT(GL_ASYNC_READ_PIXELS_COMPLETED_CHROMIUM,
|
| + request->query);
|
| context_->readPixels(0, 0, dst_size.width(), dst_size.height(),
|
| GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
| + context_->endQueryEXT(GL_ASYNC_READ_PIXELS_COMPLETED_CHROMIUM);
|
| 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));
|
| }
|
|
|
| @@ -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;
|
|
|