Index: cc/output/gl_renderer.cc |
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc |
index d9729d33ce41e7e517e27e9928a9f1d8577789dd..80d2ea63b432c05743a39b9370c3142ac2a3737d 100644 |
--- a/cc/output/gl_renderer.cc |
+++ b/cc/output/gl_renderer.cc |
@@ -296,7 +296,8 @@ void GLRenderer::ClearFramebuffer(DrawingFrame* frame) { |
} |
void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) { |
- // FIXME: Remove this once backbuffer is automatically recreated on first use |
+ // TODO(hubbe): Remove this once backbuffer is automatically recreated |
+ // on first use. |
EnsureBackbuffer(); |
if (client_->DeviceViewport().IsEmpty()) |
@@ -586,22 +587,22 @@ scoped_ptr<ScopedResource> GLRenderer::DrawBackgroundFilters( |
// |
// Pixel copies in this algorithm occur at steps 2, 3, 4, and 5. |
- // FIXME: When this algorithm changes, update |
+ // TODO(hubbe): When this algorithm changes, update |
// LayerTreeHost::PrioritizeTextures() accordingly. |
FilterOperations filters = |
RenderSurfaceFilters::Optimize(quad->background_filters); |
DCHECK(!filters.IsEmpty()); |
- // FIXME: We only allow background filters on an opaque render surface because |
- // other surfaces may contain translucent pixels, and the contents behind |
- // those translucent pixels wouldn't have the filter applied. |
+ // TODO(hubbe): We only allow background filters on an opaque render surface |
+ // because other surfaces may contain translucent pixels, and the contents |
+ // behind those translucent pixels wouldn't have the filter applied. |
if (frame->current_render_pass->has_transparent_background) |
return scoped_ptr<ScopedResource>(); |
DCHECK(!frame->current_texture); |
- // FIXME: Do a single readback for both the surface and replica and cache the |
- // filtered results (once filter textures are not reused). |
+ // TODO(hubbe): Do a single readback for both the surface and replica and |
+ // cache the filtered results (once filter textures are not reused). |
gfx::Rect window_rect = gfx::ToEnclosingRect(MathUtil::MapClippedRect( |
contents_device_transform, SharedGeometryQuad().BoundingBox())); |
@@ -722,8 +723,8 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, |
SetBlendEnabled(true); |
} |
- // FIXME: Cache this value so that we don't have to do it for both the surface |
- // and its replica. Apply filters to the contents texture. |
+ // TODO(hubbe): Cache this value so that we don't have to do it for both the |
+ // surface and its replica. Apply filters to the contents texture. |
SkBitmap filter_bitmap; |
SkScalar color_matrix[20]; |
bool use_color_matrix = false; |
@@ -794,8 +795,9 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, |
mask_texture_id = mask_resource_lock->texture_id(); |
} |
- // FIXME: use the background_texture and blend the background in with this |
- // draw instead of having a separate copy of the background texture. |
+ // TODO(hubbe): use the background_texture and blend the background |
+ // in with this draw instead of having a separate copy of the background |
+ // texture. |
scoped_ptr<ResourceProvider::ScopedReadLockGL> contents_resource_lock; |
if (filter_bitmap.getTexture()) { |
@@ -2310,6 +2312,14 @@ void GLRenderer::DoGetFramebufferPixels( |
NULL, |
GL_STREAM_READ)); |
+ WebKit::WebGLId query = 0; |
+ if (is_async) { |
+ query = context_->createQueryEXT(); |
+ GLC(context_, context_->beginQueryEXT( |
+ GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM, |
+ query)); |
+ } |
+ |
GLC(context_, |
context_->readPixels(window_rect.x(), |
window_rect.y(), |
@@ -2335,6 +2345,7 @@ void GLRenderer::DoGetFramebufferPixels( |
base::Unretained(this), |
cleanup_callback, |
buffer, |
+ query, |
dest_pixels, |
window_rect.size()); |
// Save the finished_callback so it can be cancelled. |
@@ -2345,10 +2356,11 @@ void GLRenderer::DoGetFramebufferPixels( |
pending_async_read_pixels_.front()->buffer = buffer; |
if (is_async) { |
- unsigned sync_point = context_->insertSyncPoint(); |
- SyncPointHelper::SignalSyncPoint( |
+ GLC(context_, context_->endQueryEXT( |
+ GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM)); |
+ SyncPointHelper::SignalQuery( |
context_, |
- sync_point, |
+ query, |
finished_callback); |
} else { |
resource_provider_->Finish(); |
@@ -2361,10 +2373,15 @@ void GLRenderer::DoGetFramebufferPixels( |
void GLRenderer::FinishedReadback( |
const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback, |
unsigned source_buffer, |
+ unsigned query, |
uint8* dest_pixels, |
gfx::Size size) { |
DCHECK(!pending_async_read_pixels_.empty()); |
+ if (query != 0) { |
+ GLC(context_, context_->deleteQueryEXT(query)); |
+ } |
+ |
PendingAsyncReadPixels* current_read = pending_async_read_pixels_.back(); |
// Make sure we service the readbacks in order. |
DCHECK_EQ(source_buffer, current_read->buffer); |