diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-19 18:13:18 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-19 18:13:18 +0000 |
commit | 30c600bd611d7dd59b8f09d0ef0638f1b17bb308 (patch) | |
tree | ee09859a34ad4e0a8711f9ddacc9f7fa4d4a06a0 /content/common | |
parent | 137cec3e53aae9b3a43b9e39d49a5226311fe271 (diff) | |
download | chromium_src-30c600bd611d7dd59b8f09d0ef0638f1b17bb308.zip chromium_src-30c600bd611d7dd59b8f09d0ef0638f1b17bb308.tar.gz chromium_src-30c600bd611d7dd59b8f09d0ef0638f1b17bb308.tar.bz2 |
aura: Add flush() to make sure delete operations make it through when we intend.
Resource deletion doesn't force a flush, so for textures that are deleted on a
little-used shared context, the delete command may sit in the command buffer for
arbitrary long.
This fixes it.
BUG=123933
TEST=chrome/aura, open many tabs, close all of them, check that GPU memory is reclaimed.
Review URL: http://codereview.chromium.org/10078002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133017 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r-- | content/common/gpu/client/gl_helper.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/content/common/gpu/client/gl_helper.cc b/content/common/gpu/client/gl_helper.cc index ca91b84..3c4c889 100644 --- a/content/common/gpu/client/gl_helper.cc +++ b/content/common/gpu/client/gl_helper.cc @@ -191,6 +191,22 @@ class ScopedTextureBinder : ScopedBinder<target> { &WebKit::WebGraphicsContext3D::bindTexture) {} }; +class ScopedFlush { + public: + ScopedFlush(WebKit::WebGraphicsContext3D* context) + : context_(context) { + } + + virtual ~ScopedFlush() { + context_->flush(); + } + + private: + WebKit::WebGraphicsContext3D* context_; + + DISALLOW_COPY_AND_ASSIGN(ScopedFlush); +}; + void ReadBackFramebuffer( WebKit::WebGraphicsContext3D* context, unsigned char* pixels, @@ -202,6 +218,7 @@ void ReadBackFramebuffer( return; if (context->isContextLost()) return; + ScopedFlush flush(context); ScopedFramebuffer dst_framebuffer(context, context->createFramebuffer()); { ScopedFramebufferBinder<GL_DRAW_FRAMEBUFFER> framebuffer_binder( @@ -220,7 +237,6 @@ void ReadBackFramebuffer( static_cast<WebKit::WebGLId>(dst_framebuffer), size.width(), size.height()); - context->flush(); } void ReadBackFramebufferComplete(WebKit::WebGraphicsContext3D* context, @@ -230,6 +246,7 @@ void ReadBackFramebufferComplete(WebKit::WebGraphicsContext3D* context, callback.Run(*result); if (*dst_texture != 0) { context->deleteTexture(*dst_texture); + context->flush(); *dst_texture = 0; } } @@ -454,6 +471,7 @@ bool GLHelper::CopyTextureToImpl::CopyTextureTo( const gfx::Size& src_size, const gfx::Size& dst_size, unsigned char* out) { + ScopedFlush flush(context_); ScopedTexture dst_texture(context_, ScaleTexture(src_texture, src_size, dst_size)); ScopedFramebuffer dst_framebuffer(context_, context_->createFramebuffer()); |