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

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

Issue 10453117: Tighter sync and faster ACK on SwapBuffers/PostSubBuffers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 7 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 453e5d7f0873312705fe0864de8b16a04d16217d..63ac454c1f9b99309decc86131352862354beda2 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -576,9 +576,10 @@ void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped(
params_in_pixel.route_id, gpu_host_id);
} else {
// Add sending an ACK to the list of things to do OnCompositingEnded
- on_compositing_ended_callbacks_.push_back(
+ on_compositing_will_end_callbacks_.push_back(CallbackAndCompositeNumber(
piman 2012/06/04 18:20:39 A possible gotcha for the future, is that this rel
jonathan.backer 2012/06/05 13:35:58 Just to reiterate what I think you are saying: Cur
base::Bind(&RenderWidgetHostImpl::AcknowledgeSwapBuffers,
- params_in_pixel.route_id, gpu_host_id));
+ params_in_pixel.route_id, gpu_host_id),
+ compositor->last_started_id() + 1));
if (!compositor->HasObserver(this))
compositor->AddObserver(this);
}
@@ -620,9 +621,10 @@ void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer(
params_in_pixel.route_id, gpu_host_id);
} else {
// Add sending an ACK to the list of things to do OnCompositingEnded
- on_compositing_ended_callbacks_.push_back(
+ on_compositing_will_end_callbacks_.push_back(CallbackAndCompositeNumber(
base::Bind(&RenderWidgetHostImpl::AcknowledgePostSubBuffer,
- params_in_pixel.route_id, gpu_host_id));
+ params_in_pixel.route_id, gpu_host_id),
+ compositor->last_started_id() + 1));
if (!compositor->HasObserver(this))
compositor->AddObserver(this);
}
@@ -1186,9 +1188,15 @@ void RenderWidgetHostViewAura::OnCompositingStarted(
locks_pending_draw_.clear();
}
-void RenderWidgetHostViewAura::OnCompositingEnded(ui::Compositor* compositor) {
- RunCompositingCallbacks();
- compositor->RemoveObserver(this);
+void RenderWidgetHostViewAura::OnCompositingWillEnd(
+ ui::Compositor* compositor) {
+ RunCompositingCallbacks(compositor);
+ if (on_compositing_will_end_callbacks_.empty())
+ compositor->RemoveObserver(this);
+}
+
+void RenderWidgetHostViewAura::OnCompositingEnded(
+ ui::Compositor* compositor) {
}
////////////////////////////////////////////////////////////////////////////////
@@ -1301,13 +1309,19 @@ bool RenderWidgetHostViewAura::ShouldMoveToCenter() {
global_mouse_position_.y() > rect.bottom() - border_y;
}
-void RenderWidgetHostViewAura::RunCompositingCallbacks() {
- for (std::vector< base::Callback<void(void)> >::const_iterator
- it = on_compositing_ended_callbacks_.begin();
- it != on_compositing_ended_callbacks_.end(); ++it) {
- it->Run();
+void RenderWidgetHostViewAura::RunCompositingCallbacks(
+ ui::Compositor* compositor) {
+ std::vector<CallbackAndCompositeNumber>::iterator it =
+ on_compositing_will_end_callbacks_.begin();
+ while (it != on_compositing_will_end_callbacks_.end()) {
+ if (compositor == NULL ||
+ it->second <= compositor->last_will_end_id()) {
+ it->first.Run();
+ it = on_compositing_will_end_callbacks_.erase(it);
+ } else {
+ it++;
+ }
}
- on_compositing_ended_callbacks_.clear();
}
void RenderWidgetHostViewAura::RemovingFromRootWindow() {
@@ -1317,7 +1331,7 @@ 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();
+ RunCompositingCallbacks(NULL);
locks_pending_draw_.clear();
ui::Compositor* compositor = GetCompositor();
if (compositor && compositor->HasObserver(this))

Powered by Google App Engine
This is Rietveld 408576698