Skip to content

Commit

Permalink
Revert 142054 (apparently caused http://crbug.com/132813)
Browse files Browse the repository at this point in the history
- Make discarding Frontbuffer on mac actually drop resources without a discarded backbuffer.


BUG=132444
TEST=Manual


Review URL: https://chromiumcodereview.appspot.com/10535147

TBR=mmocny@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10580010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142880 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
thakis@chromium.org committed Jun 19, 2012
1 parent 3f00df9 commit 2650ee7
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions content/common/gpu/image_transport_surface_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class IOSurfaceImageTransportSurface : public gfx::NoOpGLSurfaceCGL,
private:
virtual ~IOSurfaceImageTransportSurface() OVERRIDE;

void AdjustBufferAllocation();
void UnrefIOSurface();
void CreateIOSurface();

Expand Down Expand Up @@ -167,27 +166,22 @@ void IOSurfaceImageTransportSurface::SetBackbufferAllocation(bool allocation) {
if (backbuffer_suggested_allocation_ == allocation)
return;
backbuffer_suggested_allocation_ = allocation;
AdjustBufferAllocation();

if (backbuffer_suggested_allocation_)
CreateIOSurface();
else
UnrefIOSurface();
}

void IOSurfaceImageTransportSurface::SetFrontbufferAllocation(bool allocation) {
if (frontbuffer_suggested_allocation_ == allocation)
return;
frontbuffer_suggested_allocation_ = allocation;
AdjustBufferAllocation();
}

void IOSurfaceImageTransportSurface::AdjustBufferAllocation() {
// On mac, the frontbuffer and backbuffer are the same buffer. The buffer is
// free'd when both the browser and gpu processes have Unref'd the IOSurface.
if (!backbuffer_suggested_allocation_ &&
!frontbuffer_suggested_allocation_ &&
io_surface_.get()) {
UnrefIOSurface();
// 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();
} else if (backbuffer_suggested_allocation_ && !io_surface_.get()) {
CreateIOSurface();
}
}

bool IOSurfaceImageTransportSurface::SwapBuffers() {
Expand Down

0 comments on commit 2650ee7

Please sign in to comment.