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

Unified Diff: content/common/gpu/texture_image_transport_surface.cc

Issue 10974008: Aura: Keep scheduling in line with other platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 3 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/common/gpu/texture_image_transport_surface.cc
diff --git a/content/common/gpu/texture_image_transport_surface.cc b/content/common/gpu/texture_image_transport_surface.cc
index 86f5ebcdd75617071fba129ca971a942354fb8ac..7078a3e972b41d247b976f96347942b6f2becab5 100644
--- a/content/common/gpu/texture_image_transport_surface.cc
+++ b/content/common/gpu/texture_image_transport_surface.cc
@@ -42,7 +42,9 @@ TextureImageTransportSurface::TextureImageTransportSurface(
frontbuffer_is_protected_(true),
protection_state_id_(0),
handle_(handle),
- parent_stub_(NULL) {
+ parent_stub_(NULL),
+ is_swap_buffers_pending_(false),
+ did_unschedule_(false) {
helper_.reset(new ImageTransportHelper(this,
manager,
stub,
@@ -114,6 +116,20 @@ void TextureImageTransportSurface::Destroy() {
helper_->Destroy();
}
+bool TextureImageTransportSurface::DeferDraws() {
+ // The command buffer hit a draw/clear command that could clobber the
+ // texture in use by the UI compositor. If a Swap is pending, abort
+ // processing of the command by returning true and unschedule until the Swap
+ // Ack arrives.
+ DCHECK(!did_unschedule_);
+ if (is_swap_buffers_pending_) {
+ did_unschedule_ = true;
+ helper_->SetScheduled(false);
+ return true;
+ }
+ return false;
+}
+
bool TextureImageTransportSurface::Resize(const gfx::Size&) {
return true;
}
@@ -252,7 +268,9 @@ bool TextureImageTransportSurface::SwapBuffers() {
params.protection_state_id = protection_state_id_;
params.skip_ack = false;
helper_->SendAcceleratedSurfaceBuffersSwapped(params);
- helper_->SetScheduled(false);
+
+ DCHECK(!is_swap_buffers_pending_);
+ is_swap_buffers_pending_ = true;
return true;
}
@@ -321,7 +339,9 @@ bool TextureImageTransportSurface::PostSubBuffer(
params.height = height;
params.protection_state_id = protection_state_id_;
helper_->SendAcceleratedSurfacePostSubBuffer(params);
- helper_->SetScheduled(false);
+
+ DCHECK(!is_swap_buffers_pending_);
+ is_swap_buffers_pending_ = true;
return true;
}
@@ -381,6 +401,9 @@ void TextureImageTransportSurface::OnBufferPresented(uint32 sync_point) {
}
void TextureImageTransportSurface::BufferPresentedImpl() {
+ DCHECK(is_swap_buffers_pending_);
+ is_swap_buffers_pending_ = false;
+
// We're relying on the fact that the parent context is
// finished with it's context when it inserts the sync point that
// triggers this callback.
@@ -399,7 +422,10 @@ void TextureImageTransportSurface::BufferPresentedImpl() {
// Even if MakeCurrent fails, schedule anyway, to trigger the lost context
// logic.
- helper_->SetScheduled(true);
+ if (did_unschedule_) {
+ did_unschedule_ = false;
+ helper_->SetScheduled(true);
+ }
}
void TextureImageTransportSurface::OnResizeViewACK() {
« no previous file with comments | « content/common/gpu/texture_image_transport_surface.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698