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

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

Issue 10388010: Decoupling backbuffer allocation suggestion from frontbuffer allocation suggestion. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updating all platforms to really decouple the two allocations by not using a shared AdjustBufferAll… 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/common/gpu/image_transport_surface_mac.cc
diff --git a/content/common/gpu/image_transport_surface_mac.cc b/content/common/gpu/image_transport_surface_mac.cc
index 5223ce14b76bae380fbff0e042efa9f443de3df1..9bdd5555e31f2a8f8f9c9bfc1c20218f57157c10 100644
--- a/content/common/gpu/image_transport_surface_mac.cc
+++ b/content/common/gpu/image_transport_surface_mac.cc
@@ -37,7 +37,8 @@ class IOSurfaceImageTransportSurface : public gfx::NoOpGLSurfaceCGL,
virtual gfx::Size GetSize() OVERRIDE;
virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
- virtual void SetBufferAllocation(BufferAllocationState state) OVERRIDE;
+ virtual void SetBackbufferAllocation(bool allocated) OVERRIDE;
+ virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE;
protected:
// ImageTransportSurface implementation
@@ -54,7 +55,9 @@ class IOSurfaceImageTransportSurface : public gfx::NoOpGLSurfaceCGL,
void UnrefIOSurface();
void CreateIOSurface();
- BufferAllocationState buffer_allocation_state_;
+ // Tracks the current buffer allocation state.
+ bool backbuffer_suggested_allocation_;
+ bool frontbuffer_suggested_allocation_;
uint32 fbo_id_;
GLuint texture_id_;
@@ -97,7 +100,8 @@ IOSurfaceImageTransportSurface::IOSurfaceImageTransportSurface(
GpuCommandBufferStub* stub,
gfx::PluginWindowHandle handle)
: gfx::NoOpGLSurfaceCGL(gfx::Size(1, 1)),
- buffer_allocation_state_(BUFFER_ALLOCATION_FRONT_AND_BACK),
+ backbuffer_suggested_allocation_(true),
+ frontbuffer_suggested_allocation_(true),
fbo_id_(0),
texture_id_(0),
io_surface_handle_(0),
@@ -158,28 +162,26 @@ unsigned int IOSurfaceImageTransportSurface::GetBackingFrameBufferObject() {
return fbo_id_;
}
-void IOSurfaceImageTransportSurface::SetBufferAllocation(
- BufferAllocationState state) {
- if (buffer_allocation_state_ == state)
+void IOSurfaceImageTransportSurface::SetBackbufferAllocation(bool allocation) {
+ if (backbuffer_suggested_allocation_ == allocation)
return;
- buffer_allocation_state_ = state;
+ backbuffer_suggested_allocation_ = allocation;
- switch (state) {
- case BUFFER_ALLOCATION_FRONT_AND_BACK:
- CreateIOSurface();
- break;
-
- case BUFFER_ALLOCATION_FRONT_ONLY:
- break;
+ if (backbuffer_suggested_allocation_)
+ CreateIOSurface();
+ else
+ UnrefIOSurface();
+}
- case BUFFER_ALLOCATION_NONE:
- UnrefIOSurface();
- helper_->Suspend();
- break;
+void IOSurfaceImageTransportSurface::SetFrontbufferAllocation(bool allocation) {
+ if (frontbuffer_suggested_allocation_ == allocation)
+ return;
+ frontbuffer_suggested_allocation_ = allocation;
- default:
- NOTREACHED();
- }
+ // We recreate frontbuffer by recreating backbuffer and swapping.
+ // But we release frontbuffer by telling UI to release its handle on it.
+ if (!frontbuffer_suggested_allocation_)
+ helper_->Suspend();
}
bool IOSurfaceImageTransportSurface::SwapBuffers() {

Powered by Google App Engine
This is Rietveld 408576698