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

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

Issue 10984004: Use a singleton 1x1 offscreen surface for all TextureImageTransportSurface instances. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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
« no previous file with comments | « content/common/gpu/texture_image_transport_surface.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « content/common/gpu/texture_image_transport_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698