Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6505)

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 10689108: Aura: Have ui::Layer implement WebKit::WebExternalTextureLayerClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Wait for commit before fast ACKing on resize. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698