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

Unified Diff: content/browser/renderer_host/image_transport_client_linux.cc

Issue 10386206: RefCounted types should not have public destructors, chromeos edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to r143931 Created 8 years, 6 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
Index: content/browser/renderer_host/image_transport_client_linux.cc
diff --git a/content/browser/renderer_host/image_transport_client_linux.cc b/content/browser/renderer_host/image_transport_client_linux.cc
index a3425f28774be422050b37f2070f1420c8ef03c3..dd6aeb9b0e12728dbf961e02d80e1186dfad1976 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_;
« no previous file with comments | « content/browser/renderer_host/image_transport_client.h ('k') | content/browser/renderer_host/image_transport_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698