Chromium Code Reviews| 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 c6d28e09004edc0673978e1aedc434bd9f414c49..8c09e16cb2227d31ed622bc6bded192854e650a2 100644 |
| --- a/content/common/gpu/texture_image_transport_surface.cc |
| +++ b/content/common/gpu/texture_image_transport_surface.cc |
| @@ -22,6 +22,8 @@ using gpu::gles2::ContextGroup; |
| using gpu::gles2::TextureManager; |
| typedef TextureManager::TextureInfo TextureInfo; |
| +scoped_refptr<gfx::GLSurface> TextureImageTransportSurface::surface_; |
|
piman
2012/09/24 21:18:36
We don't allow non-POD globals.
hshi1
2012/09/24 21:38:40
In Patch Set #2 I've moved the global singleton to
|
| + |
| TextureImageTransportSurface::Texture::Texture() |
| : client_id(0), |
| sent_to_client(false) { |
| @@ -88,7 +90,11 @@ bool TextureImageTransportSurface::Initialize() { |
| texture.info, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| } |
| - surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, gfx::Size(1, 1)); |
| + if (!surface_.get()) |
| + surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, gfx::Size(1, 1)); |
| + else |
| + surface_->AddRef(); |
| + |
| if (!surface_.get()) |
| return false; |
| @@ -109,8 +115,12 @@ void TextureImageTransportSurface::Destroy() { |
| } |
| if (surface_.get()) { |
| - surface_->Destroy(); |
| - surface_ = NULL; |
| + if (surface_->HasOneRef()) { |
| + surface_->Destroy(); |
| + surface_ = NULL; |
| + } else { |
| + surface_->Release(); |
| + } |
| } |
| helper_->Destroy(); |