diff options
| author | jbates@chromium.org <jbates@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-09 23:13:00 +0000 |
|---|---|---|
| committer | jbates@chromium.org <jbates@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-09 23:13:00 +0000 |
| commit | c1c8ce33f81f41de6a03ae614a695b628d0a95aa (patch) | |
| tree | c2143b57f1c6d358ce967cadf3d5c6b9ddadd258 | |
| parent | f7a925a2f6525c2612ad4ab35cb855239dcaedc1 (diff) | |
| download | chromium_src-c1c8ce33f81f41de6a03ae614a695b628d0a95aa.zip chromium_src-c1c8ce33f81f41de6a03ae614a695b628d0a95aa.tar.gz chromium_src-c1c8ce33f81f41de6a03ae614a695b628d0a95aa.tar.bz2 | |
Merge 142054 - Make discarding Frontbuffer on mac actually drop resources without a discarded backbuffer.
BUG=132444,132813
TEST=Manual
Review URL: https://chromiumcodereview.appspot.com/10535147
TBR=mmocny@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10763016
git-svn-id: svn://svn.chromium.org/chrome/branches/1180/src@145778 0039d316-1c4b-4281-b951-d872f2087c98
| -rw-r--r-- | content/common/gpu/image_transport_surface_mac.cc | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/content/common/gpu/image_transport_surface_mac.cc b/content/common/gpu/image_transport_surface_mac.cc index 3c710f0..466a9c2 100644 --- a/content/common/gpu/image_transport_surface_mac.cc +++ b/content/common/gpu/image_transport_surface_mac.cc @@ -52,6 +52,7 @@ class IOSurfaceImageTransportSurface : public gfx::NoOpGLSurfaceCGL, private: virtual ~IOSurfaceImageTransportSurface() OVERRIDE; + void AdjustBufferAllocation(); void UnrefIOSurface(); void CreateIOSurface(); @@ -166,22 +167,27 @@ void IOSurfaceImageTransportSurface::SetBackbufferAllocation(bool allocation) { if (backbuffer_suggested_allocation_ == allocation) return; backbuffer_suggested_allocation_ = allocation; - - if (backbuffer_suggested_allocation_) - CreateIOSurface(); - else - UnrefIOSurface(); + AdjustBufferAllocation(); } void IOSurfaceImageTransportSurface::SetFrontbufferAllocation(bool allocation) { if (frontbuffer_suggested_allocation_ == allocation) return; frontbuffer_suggested_allocation_ = allocation; + AdjustBufferAllocation(); +} - // 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_) +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(); helper_->Suspend(); + } else if (backbuffer_suggested_allocation_ && !io_surface_.get()) { + CreateIOSurface(); + } } bool IOSurfaceImageTransportSurface::SwapBuffers() { |
