diff options
author | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-25 19:59:41 +0000 |
---|---|---|
committer | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-25 19:59:41 +0000 |
commit | 886d3721640dd202ac15c4944e4686bd1cf7f16d (patch) | |
tree | f7837588365e131342619d68b3934924c70d0f7a /content | |
parent | e59f00ea94e2642034881cd3d94d9ac1afa02df8 (diff) | |
download | chromium_src-886d3721640dd202ac15c4944e4686bd1cf7f16d.zip chromium_src-886d3721640dd202ac15c4944e4686bd1cf7f16d.tar.gz chromium_src-886d3721640dd202ac15c4944e4686bd1cf7f16d.tar.bz2 |
RefCounted types should not have public destructors, chromeos edition
BUG=123295
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10386206
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143987 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
3 files changed, 54 insertions, 48 deletions
diff --git a/content/browser/renderer_host/image_transport_client.h b/content/browser/renderer_host/image_transport_client.h index b18ea2f..7abeb3a 100644 --- a/content/browser/renderer_host/image_transport_client.h +++ b/content/browser/renderer_host/image_transport_client.h @@ -21,8 +21,6 @@ class ImageTransportFactory; // data is only valid after the first Update(). class ImageTransportClient : public ui::Texture { public: - virtual ~ImageTransportClient() {} - // Initializes the client with the surface id. virtual bool Initialize(uint64* surface_handle) = 0; @@ -39,6 +37,7 @@ class ImageTransportClient : public ui::Texture { protected: ImageTransportClient(bool flipped, const gfx::Size& size); + virtual ~ImageTransportClient() {} private: DISALLOW_COPY_AND_ASSIGN(ImageTransportClient); diff --git a/content/browser/renderer_host/image_transport_client_linux.cc b/content/browser/renderer_host/image_transport_client_linux.cc index a3425f2..dd6aeb9 100644 --- a/content/browser/renderer_host/image_transport_client_linux.cc +++ b/content/browser/renderer_host/image_transport_client_linux.cc @@ -49,17 +49,7 @@ class ImageTransportClientEGL : public ImageTransportClient { image_(NULL) { } - virtual ~ImageTransportClientEGL() { - scoped_ptr<gfx::ScopedMakeCurrent> bind(factory_->GetScopedMakeCurrent()); - if (image_) - eglDestroyImageKHR(gfx::GLSurfaceEGL::GetHardwareDisplay(), image_); - unsigned int texture = texture_id(); - if (texture) - glDeleteTextures(1, &texture); - glFlush(); - } - - virtual bool Initialize(uint64* surface_handle) { + virtual bool Initialize(uint64* surface_handle) OVERRIDE { scoped_ptr<gfx::ScopedMakeCurrent> bind(factory_->GetScopedMakeCurrent()); image_ = eglCreateImageKHR( gfx::GLSurfaceEGL::GetHardwareDisplay(), EGL_NO_CONTEXT, @@ -73,11 +63,22 @@ class ImageTransportClientEGL : public ImageTransportClient { return true; } - virtual void Update() { } - virtual TransportDIB::Handle Handle() const { + virtual void Update() OVERRIDE {} + virtual TransportDIB::Handle Handle() const OVERRIDE { return TransportDIB::DefaultHandleValue(); } + protected: + virtual ~ImageTransportClientEGL() { + scoped_ptr<gfx::ScopedMakeCurrent> bind(factory_->GetScopedMakeCurrent()); + if (image_) + eglDestroyImageKHR(gfx::GLSurfaceEGL::GetHardwareDisplay(), image_); + unsigned int texture = texture_id(); + if (texture) + glDeleteTextures(1, &texture); + glFlush(); + } + private: ImageTransportFactory* factory_; EGLImageKHR image_; @@ -93,23 +94,7 @@ class ImageTransportClientGLX : public ImageTransportClient { acquired_(false) { } - virtual ~ImageTransportClientGLX() { - scoped_ptr<gfx::ScopedMakeCurrent> bind(factory_->GetScopedMakeCurrent()); - Display* dpy = base::MessagePumpForUI::GetDefaultXDisplay(); - if (glx_pixmap_) { - if (acquired_) - glXReleaseTexImageEXT(dpy, glx_pixmap_, GLX_FRONT_LEFT_EXT); - glXDestroyGLXPixmap(dpy, glx_pixmap_); - } - if (pixmap_) - XFreePixmap(dpy, pixmap_); - unsigned int texture = texture_id(); - if (texture) - glDeleteTextures(1, &texture); - glFlush(); - } - - virtual bool Initialize(uint64* surface_handle) { + virtual bool Initialize(uint64* surface_handle) OVERRIDE { TRACE_EVENT0("renderer_host", "ImageTransportClientGLX::Initialize"); Display* dpy = base::MessagePumpForUI::GetDefaultXDisplay(); @@ -136,7 +121,7 @@ class ImageTransportClientGLX : public ImageTransportClient { return true; } - virtual void Update() { + virtual void Update() OVERRIDE { TRACE_EVENT0("renderer_host", "ImageTransportClientGLX::Update"); Display* dpy = base::MessagePumpForUI::GetDefaultXDisplay(); scoped_ptr<gfx::ScopedMakeCurrent> bind(factory_->GetScopedMakeCurrent()); @@ -148,10 +133,27 @@ class ImageTransportClientGLX : public ImageTransportClient { glFlush(); } - virtual TransportDIB::Handle Handle() const { + virtual TransportDIB::Handle Handle() const OVERRIDE { return TransportDIB::DefaultHandleValue(); } + protected: + virtual ~ImageTransportClientGLX() { + scoped_ptr<gfx::ScopedMakeCurrent> bind(factory_->GetScopedMakeCurrent()); + Display* dpy = base::MessagePumpForUI::GetDefaultXDisplay(); + if (glx_pixmap_) { + if (acquired_) + glXReleaseTexImageEXT(dpy, glx_pixmap_, GLX_FRONT_LEFT_EXT); + glXDestroyGLXPixmap(dpy, glx_pixmap_); + } + if (pixmap_) + XFreePixmap(dpy, pixmap_); + unsigned int texture = texture_id(); + if (texture) + glDeleteTextures(1, &texture); + glFlush(); + } + private: static bool InitializeOneOff(Display* dpy) { static bool initialized = false; @@ -237,17 +239,7 @@ class ImageTransportClientOSMesa : public ImageTransportClient { factory_(factory) { } - virtual ~ImageTransportClientOSMesa() { - unsigned int texture = texture_id(); - if (texture) { - scoped_ptr<gfx::ScopedMakeCurrent> bind( - factory_->GetScopedMakeCurrent()); - glDeleteTextures(1, &texture); - glFlush(); - } - } - - virtual bool Initialize(uint64* surface_handle) { + virtual bool Initialize(uint64* surface_handle) OVERRIDE { // We expect to make the handle here, so don't want the other end giving us // one. DCHECK_EQ(*surface_handle, static_cast<uint64>(0)); @@ -270,7 +262,7 @@ class ImageTransportClientOSMesa : public ImageTransportClient { return true; } - virtual void Update() { + virtual void Update() OVERRIDE { glBindTexture(GL_TEXTURE_2D, texture_id()); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size().width(), size().height(), 0, @@ -278,7 +270,20 @@ class ImageTransportClientOSMesa : public ImageTransportClient { glFlush(); } - virtual TransportDIB::Handle Handle() const { return shared_mem_->handle(); } + virtual TransportDIB::Handle Handle() const OVERRIDE { + return shared_mem_->handle(); + } + + protected: + virtual ~ImageTransportClientOSMesa() { + unsigned int texture = texture_id(); + if (texture) { + scoped_ptr<gfx::ScopedMakeCurrent> bind( + factory_->GetScopedMakeCurrent()); + glDeleteTextures(1, &texture); + glFlush(); + } + } private: ImageTransportFactory* factory_; diff --git a/content/browser/renderer_host/image_transport_factory.cc b/content/browser/renderer_host/image_transport_factory.cc index 1b9801e..31885b9 100644 --- a/content/browser/renderer_host/image_transport_factory.cc +++ b/content/browser/renderer_host/image_transport_factory.cc @@ -122,12 +122,14 @@ class ImageTransportClientTexture : public ImageTransportClient { return true; } - virtual ~ImageTransportClientTexture() {} virtual void Update() OVERRIDE {} virtual TransportDIB::Handle Handle() const OVERRIDE { return TransportDIB::DefaultHandleValue(); } + protected: + virtual ~ImageTransportClientTexture() {} + private: DISALLOW_COPY_AND_ASSIGN(ImageTransportClientTexture); }; |