Index: content/browser/renderer_host/render_widget_host_view_aura.cc |
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc |
index e0e3c52ffd6abf3a5120f14f4b4c6dd605dff45a..0934218d07a583e0960db43efdda40899a1f6cc4 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
@@ -552,7 +552,7 @@ void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( |
if (!compositor) { |
// We have no compositor, so we have no way to display the surface. |
// Must still send the ACK. |
- InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id); |
+ InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id, compositor); |
piman
2012/07/09 22:40:01
compositor is NULL here. I don't think this works
jonathan.backer
2012/07/11 21:02:03
Good catch. The right thing to do here is to retur
|
} else { |
gfx::Size surface_size_in_pixel = |
image_transport_clients_[params_in_pixel.surface_handle]->size(); |
@@ -562,12 +562,14 @@ void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( |
if (!resize_locks_.empty()) { |
// If we are waiting for the resize, fast-track the ACK. |
- InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id); |
+ compositor->AddDidCommitCallback( |
+ base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK, |
+ params_in_pixel.route_id, |
+ gpu_host_id)); |
} else { |
// Add sending an ACK to the list of things to do OnCompositingWillStart |
on_compositing_will_start_callbacks_.push_back( |
base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK, |
- base::Unretained(this), |
params_in_pixel.route_id, |
gpu_host_id)); |
if (!compositor->HasObserver(this)) |
@@ -586,7 +588,7 @@ void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( |
if (!compositor) { |
// We have no compositor, so we have no way to display the surface |
// Must still send the ACK |
- InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id); |
+ InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id, compositor); |
} else { |
gfx::Size surface_size_in_pixel = |
image_transport_clients_[params_in_pixel.surface_handle]->size(); |
@@ -603,12 +605,14 @@ void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( |
if (!resize_locks_.empty()) { |
// If we are waiting for the resize, fast-track the ACK. |
- InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id); |
+ compositor->AddDidCommitCallback( |
+ base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK, |
+ params_in_pixel.route_id, |
+ gpu_host_id)); |
} else { |
// Add sending an ACK to the list of things to do OnCompositingWillStart |
on_compositing_will_start_callbacks_.push_back( |
base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK, |
- base::Unretained(this), |
params_in_pixel.route_id, |
gpu_host_id)); |
if (!compositor->HasObserver(this)) |
@@ -1216,7 +1220,7 @@ void RenderWidgetHostViewAura::OnLostActive() { |
void RenderWidgetHostViewAura::OnCompositingWillStart( |
ui::Compositor* compositor) { |
- RunCompositingCallbacks(); |
+ RunCompositingCallbacks(compositor); |
} |
void RenderWidgetHostViewAura::OnCompositingStarted( |
@@ -1364,20 +1368,22 @@ bool RenderWidgetHostViewAura::ShouldMoveToCenter() { |
global_mouse_position_.y() > rect.bottom() - border_y; |
} |
-void RenderWidgetHostViewAura::RunCompositingCallbacks() { |
- for (std::vector< base::Callback<void(void)> >::const_iterator |
+void RenderWidgetHostViewAura::RunCompositingCallbacks( |
+ ui::Compositor* compositor) { |
+ for (std::vector< base::Callback<void(ui::Compositor*)> >::const_iterator |
it = on_compositing_will_start_callbacks_.begin(); |
it != on_compositing_will_start_callbacks_.end(); ++it) { |
- it->Run(); |
+ it->Run(compositor); |
} |
on_compositing_will_start_callbacks_.clear(); |
} |
-void RenderWidgetHostViewAura::InsertSyncPointAndACK(int32 route_id, |
- int gpu_host_id) { |
+// static |
+void RenderWidgetHostViewAura::InsertSyncPointAndACK( |
+ int32 route_id, int gpu_host_id, ui::Compositor* compositor) { |
ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
RenderWidgetHostImpl::AcknowledgeBufferPresent( |
- route_id, gpu_host_id, factory->InsertSyncPoint(GetCompositor())); |
+ route_id, gpu_host_id, factory->InsertSyncPoint(compositor)); |
} |
void RenderWidgetHostViewAura::RemovingFromRootWindow() { |
@@ -1387,9 +1393,9 @@ void RenderWidgetHostViewAura::RemovingFromRootWindow() { |
// drawing to the buffer we haven't yet displayed. This will only show for 1 |
// frame though, because we will reissue a new frame right away without that |
// composited data. |
- RunCompositingCallbacks(); |
- locks_pending_draw_.clear(); |
ui::Compositor* compositor = GetCompositor(); |
+ RunCompositingCallbacks(compositor); |
+ locks_pending_draw_.clear(); |
if (compositor && compositor->HasObserver(this)) |
compositor->RemoveObserver(this); |
DetachFromInputMethod(); |