Commit ab9327cc authored by rsleevi@chromium.org's avatar rsleevi@chromium.org

RefCounted types should not have public destructors, printing/ and ui/

BUG=123295
TEST=none


Review URL: http://codereview.chromium.org/10067034

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134859 0039d316-1c4b-4281-b951-d872f2087c98
parent 1b29524a
......@@ -53,8 +53,6 @@ struct PRINTING_EXPORT PrinterCapsAndDefaults {
class PRINTING_EXPORT PrintBackend
: public base::RefCountedThreadSafe<PrintBackend> {
public:
virtual ~PrintBackend();
// Enumerates the list of installed local and network printers.
virtual bool EnumeratePrinters(PrinterList* printer_list) = 0;
......@@ -78,6 +76,10 @@ class PRINTING_EXPORT PrintBackend
// Return NULL if no print backend available.
static scoped_refptr<PrintBackend> CreateInstance(
const base::DictionaryValue* print_backend_settings);
protected:
friend class base::RefCountedThreadSafe<PrintBackend>;
virtual ~PrintBackend();
};
} // namespace printing
......
......@@ -12,21 +12,19 @@ namespace printing {
class PrintBackendChromeOS : public PrintBackend {
public:
PrintBackendChromeOS();
virtual ~PrintBackendChromeOS() {}
// PrintBackend implementation.
virtual bool EnumeratePrinters(PrinterList* printer_list);
virtual std::string GetDefaultPrinterName();
virtual bool GetPrinterCapsAndDefaults(const std::string& printer_name,
PrinterCapsAndDefaults* printer_info);
virtual std::string GetPrinterDriverInfo(const std::string& printer_name);
virtual bool IsValidPrinter(const std::string& printer_name);
private:
virtual bool EnumeratePrinters(PrinterList* printer_list) OVERRIDE;
virtual std::string GetDefaultPrinterName() OVERRIDE;
virtual bool GetPrinterCapsAndDefaults(
const std::string& printer_name,
PrinterCapsAndDefaults* printer_info) OVERRIDE;
virtual std::string GetPrinterDriverInfo(
const std::string& printer_name) OVERRIDE;
virtual bool IsValidPrinter(const std::string& printer_name) OVERRIDE;
protected:
virtual ~PrintBackendChromeOS() {}
};
PrintBackendChromeOS::PrintBackendChromeOS() {}
......
......@@ -103,22 +103,20 @@ static const char kCUPSPrinterMakeModelOpt[] = "printer-make-and-model";
class PrintBackendCUPS : public PrintBackend {
public:
PrintBackendCUPS(const GURL& print_server_url, bool blocking);
virtual ~PrintBackendCUPS() {}
// PrintBackend implementation.
virtual bool EnumeratePrinters(PrinterList* printer_list) OVERRIDE;
virtual std::string GetDefaultPrinterName() OVERRIDE;
virtual bool GetPrinterCapsAndDefaults(
const std::string& printer_name,
PrinterCapsAndDefaults* printer_info) OVERRIDE;
virtual std::string GetPrinterDriverInfo(
const std::string& printer_name) OVERRIDE;
virtual bool IsValidPrinter(const std::string& printer_name) OVERRIDE;
protected:
virtual ~PrintBackendCUPS() {}
private:
// Following functions are wrappers around corresponding CUPS functions.
// <functions>2() are called when print server is specified, and plain
......
......@@ -38,18 +38,19 @@ namespace printing {
class PrintBackendWin : public PrintBackend {
public:
PrintBackendWin() {}
virtual ~PrintBackendWin() {}
virtual bool EnumeratePrinters(PrinterList* printer_list);
virtual std::string GetDefaultPrinterName();
virtual bool GetPrinterCapsAndDefaults(const std::string& printer_name,
PrinterCapsAndDefaults* printer_info);
virtual std::string GetPrinterDriverInfo(const std::string& printer_name);
virtual bool IsValidPrinter(const std::string& printer_name);
// PrintBackend implementation.
virtual bool EnumeratePrinters(PrinterList* printer_list) OVERRIDE;
virtual std::string GetDefaultPrinterName() OVERRIDE;
virtual bool GetPrinterCapsAndDefaults(
const std::string& printer_name,
PrinterCapsAndDefaults* printer_info) OVERRIDE;
virtual std::string GetPrinterDriverInfo(
const std::string& printer_name) OVERRIDE;
virtual bool IsValidPrinter(const std::string& printer_name) OVERRIDE;
protected:
virtual ~PrintBackendWin() {}
};
bool PrintBackendWin::EnumeratePrinters(PrinterList* printer_list) {
......
......@@ -38,7 +38,7 @@ class Layer;
// a global object.
class COMPOSITOR_EXPORT ContextFactory {
public:
virtual ~ContextFactory() { }
virtual ~ContextFactory() {}
// Gets the global instance.
static ContextFactory* GetInstance();
......@@ -97,14 +97,18 @@ class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory {
class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> {
public:
Texture(bool flipped, const gfx::Size& size);
virtual ~Texture();
unsigned int texture_id() const { return texture_id_; }
void set_texture_id(unsigned int id) { texture_id_ = id; }
bool flipped() const { return flipped_; }
gfx::Size size() const { return size_; }
protected:
virtual ~Texture();
private:
friend class base::RefCounted<Texture>;
unsigned int texture_id_;
bool flipped_;
gfx::Size size_;
......
......@@ -21,12 +21,8 @@ GLContextCGL::GLContextCGL(GLShareGroup* share_group)
gpu_preference_(PreferIntegratedGpu) {
}
GLContextCGL::~GLContextCGL() {
Destroy();
}
bool GLContextCGL::Initialize(
GLSurface* compatible_surface, GpuPreference gpu_preference) {
bool GLContextCGL::Initialize(GLSurface* compatible_surface,
GpuPreference gpu_preference) {
DCHECK(compatible_surface);
GLContextCGL* share_context = share_group() ?
......@@ -144,6 +140,10 @@ void GLContextCGL::SetSwapInterval(int interval) {
LOG(WARNING) << "GLContex: GLContextCGL::SetSwapInterval is ignored.";
}
GLContextCGL::~GLContextCGL() {
Destroy();
}
GpuPreference GLContextCGL::GetGpuPreference() {
return gpu_preference_;
}
......
......@@ -12,11 +12,10 @@ class GLSurface;
class GLContextCGL : public GLContext {
public:
explicit GLContextCGL(GLShareGroup* share_group);
virtual ~GLContextCGL();
// Implement GLContext.
virtual bool Initialize(
GLSurface* compatible_surface, GpuPreference gpu_preference) OVERRIDE;
virtual bool Initialize(GLSurface* compatible_surface,
GpuPreference gpu_preference) OVERRIDE;
virtual void Destroy() OVERRIDE;
virtual bool MakeCurrent(GLSurface* surface) OVERRIDE;
virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE;
......@@ -24,12 +23,12 @@ class GLContextCGL : public GLContext {
virtual void* GetHandle() OVERRIDE;
virtual void SetSwapInterval(int interval) OVERRIDE;
// Expose ForceUseOfDiscreteGPU only to GLContext implementation.
friend class GLContext;
protected:
virtual ~GLContextCGL();
private:
void* context_;
GpuPreference gpu_preference_;
// Expose ForceUseOfDiscreteGPU only to GLContext implementation.
friend class GLContext;
GpuPreference GetGpuPreference();
......@@ -37,6 +36,9 @@ class GLContextCGL : public GLContext {
// for stability reasons.
static void ForceUseOfDiscreteGPU();
void* context_;
GpuPreference gpu_preference_;
DISALLOW_COPY_AND_ASSIGN(GLContextCGL);
};
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -18,12 +18,8 @@ GLContextOSMesa::GLContextOSMesa(GLShareGroup* share_group)
context_(NULL) {
}
GLContextOSMesa::~GLContextOSMesa() {
Destroy();
}
bool GLContextOSMesa::Initialize(
GLSurface* compatible_surface, GpuPreference gpu_preference) {
bool GLContextOSMesa::Initialize(GLSurface* compatible_surface,
GpuPreference gpu_preference) {
DCHECK(!context_);
OSMesaContext share_handle = static_cast<OSMesaContext>(
......@@ -127,4 +123,8 @@ void GLContextOSMesa::SetSwapInterval(int interval) {
LOG(WARNING) << "GLContextOSMesa::SetSwapInterval is ignored.";
}
GLContextOSMesa::~GLContextOSMesa() {
Destroy();
}
} // namespace gfx
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -19,11 +19,10 @@ class GLSurface;
class GLContextOSMesa : public GLContext {
public:
explicit GLContextOSMesa(GLShareGroup* share_group);
virtual ~GLContextOSMesa();
// Implement GLContext.
virtual bool Initialize(
GLSurface* compatible_surface, GpuPreference gpu_preference) OVERRIDE;
virtual bool Initialize(GLSurface* compatible_surface,
GpuPreference gpu_preference) OVERRIDE;
virtual void Destroy() OVERRIDE;
virtual bool MakeCurrent(GLSurface* surface) OVERRIDE;
virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE;
......@@ -31,6 +30,9 @@ class GLContextOSMesa : public GLContext {
virtual void* GetHandle() OVERRIDE;
virtual void SetSwapInterval(int interval) OVERRIDE;
protected:
virtual ~GLContextOSMesa();
private:
OSMesaContext context_;
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -6,19 +6,14 @@
namespace gfx {
GLContextStub::GLContextStub() : GLContext(NULL) {
}
GLContextStub::~GLContextStub() {
}
GLContextStub::GLContextStub() : GLContext(NULL) {}
bool GLContextStub::Initialize(
GLSurface* compatible_surface, GpuPreference gpu_preference) {
return true;
}
void GLContextStub::Destroy() {
}
void GLContextStub::Destroy() {}
bool GLContextStub::MakeCurrent(GLSurface* surface) {
SetCurrent(this, surface);
......@@ -43,4 +38,6 @@ std::string GLContextStub::GetExtensions() {
return std::string();
}
GLContextStub::~GLContextStub() {}
} // namespace gfx
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -14,11 +14,10 @@ namespace gfx {
class GL_EXPORT GLContextStub : public GLContext {
public:
GLContextStub();
virtual ~GLContextStub();
// Implement GLContext.
virtual bool Initialize(
GLSurface* compatible_surface, GpuPreference gpu_preference) OVERRIDE;
virtual bool Initialize(GLSurface* compatible_surface,
GpuPreference gpu_preference) OVERRIDE;
virtual void Destroy() OVERRIDE;
virtual bool MakeCurrent(GLSurface* surface) OVERRIDE;
virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE;
......@@ -27,6 +26,9 @@ class GL_EXPORT GLContextStub : public GLContext {
virtual void SetSwapInterval(int interval) OVERRIDE;
virtual std::string GetExtensions() OVERRIDE;
protected:
virtual ~GLContextStub();
private:
DISALLOW_COPY_AND_ASSIGN(GLContextStub);
};
......
......@@ -70,13 +70,7 @@ bool GLSurface::InitializeOneOff() {
return initialized;
}
GLSurface::GLSurface() {
}
GLSurface::~GLSurface() {
if (GetCurrent() == this)
SetCurrent(NULL);
}
GLSurface::GLSurface() {}
bool GLSurface::Initialize()
{
......@@ -134,15 +128,16 @@ GLSurface* GLSurface::GetCurrent() {
return current_surface_.Pointer()->Get();
}
void GLSurface::SetCurrent(GLSurface* surface) {
current_surface_.Pointer()->Set(surface);
GLSurface::~GLSurface() {
if (GetCurrent() == this)
SetCurrent(NULL);
}
GLSurfaceAdapter::GLSurfaceAdapter(GLSurface* surface) : surface_(surface) {
void GLSurface::SetCurrent(GLSurface* surface) {
current_surface_.Pointer()->Set(surface);
}
GLSurfaceAdapter::~GLSurfaceAdapter() {
}
GLSurfaceAdapter::GLSurfaceAdapter(GLSurface* surface) : surface_(surface) {}
bool GLSurfaceAdapter::Initialize() {
return surface_->Initialize();
......@@ -208,4 +203,6 @@ unsigned GLSurfaceAdapter::GetFormat() {
return surface_->GetFormat();
}
GLSurfaceAdapter::~GLSurfaceAdapter() {}
} // namespace gfx
......@@ -122,7 +122,6 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> {
class GL_EXPORT GLSurfaceAdapter : public GLSurface {
public:
explicit GLSurfaceAdapter(GLSurface* surface);
virtual ~GLSurfaceAdapter();
virtual bool Initialize() OVERRIDE;
virtual void Destroy() OVERRIDE;
......@@ -143,6 +142,9 @@ class GL_EXPORT GLSurfaceAdapter : public GLSurface {
GLSurface* surface() const { return surface_.get(); }
protected:
virtual ~GLSurfaceAdapter();
private:
scoped_refptr<GLSurface> surface_;
DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter);
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -19,11 +19,7 @@ namespace {
CGLPixelFormatObj g_pixel_format;
}
GLSurfaceCGL::GLSurfaceCGL() {
}
GLSurfaceCGL::~GLSurfaceCGL() {
}
GLSurfaceCGL::GLSurfaceCGL() {}
bool GLSurfaceCGL::InitializeOneOff() {
static bool initialized = false;
......@@ -68,14 +64,12 @@ void* GLSurfaceCGL::GetPixelFormat() {
return g_pixel_format;
}
GLSurfaceCGL::~GLSurfaceCGL() {}
NoOpGLSurfaceCGL::NoOpGLSurfaceCGL(const gfx::Size& size)
: size_(size) {
}
NoOpGLSurfaceCGL::~NoOpGLSurfaceCGL() {
Destroy();
}
bool NoOpGLSurfaceCGL::Initialize() {
return true;
}
......@@ -100,4 +94,8 @@ void* NoOpGLSurfaceCGL::GetHandle() {
return NULL;
}
NoOpGLSurfaceCGL::~NoOpGLSurfaceCGL() {
Destroy();
}
} // namespace gfx
......@@ -14,11 +14,13 @@ namespace gfx {
class GLSurfaceCGL : public GLSurface {
public:
GLSurfaceCGL();
virtual ~GLSurfaceCGL();
static bool InitializeOneOff();
static void* GetPixelFormat();
protected:
virtual ~GLSurfaceCGL();
private:
DISALLOW_COPY_AND_ASSIGN(GLSurfaceCGL);
};
......@@ -30,7 +32,6 @@ class GLSurfaceCGL : public GLSurface {
class UI_EXPORT NoOpGLSurfaceCGL : public GLSurfaceCGL {
public:
explicit NoOpGLSurfaceCGL(const gfx::Size& size);
virtual ~NoOpGLSurfaceCGL();
// Implement GLSurface.
virtual bool Initialize() OVERRIDE;
......@@ -40,6 +41,9 @@ class UI_EXPORT NoOpGLSurfaceCGL : public GLSurfaceCGL {
virtual gfx::Size GetSize() OVERRIDE;
virtual void* GetHandle() OVERRIDE;
protected:
virtual ~NoOpGLSurfaceCGL();
private:
gfx::Size size_;
......
......@@ -14,10 +14,6 @@ GLSurfaceOSMesa::GLSurfaceOSMesa(unsigned format, const gfx::Size& size)
size_(size) {
}
GLSurfaceOSMesa::~GLSurfaceOSMesa() {
Destroy();
}
bool GLSurfaceOSMesa::Initialize() {
return Resize(size_);
}
......@@ -79,4 +75,8 @@ unsigned GLSurfaceOSMesa::GetFormat() {
return format_;
}
GLSurfaceOSMesa::~GLSurfaceOSMesa() {
Destroy();
}
} // namespace gfx
......@@ -18,7 +18,6 @@ namespace gfx {
class GL_EXPORT GLSurfaceOSMesa : public GLSurface {
public:
GLSurfaceOSMesa(unsigned format, const gfx::Size& size);
virtual ~GLSurfaceOSMesa();
// Implement GLSurface.
virtual bool Initialize() OVERRIDE;
......@@ -30,6 +29,9 @@ class GL_EXPORT GLSurfaceOSMesa : public GLSurface {
virtual void* GetHandle() OVERRIDE;
virtual unsigned GetFormat() OVERRIDE;
protected:
virtual ~GLSurfaceOSMesa();
private:
unsigned format_;
gfx::Size size_;
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -6,9 +6,6 @@
namespace gfx {
GLSurfaceStub::~GLSurfaceStub() {
}
void GLSurfaceStub::Destroy() {
}
......@@ -28,4 +25,6 @@ void* GLSurfaceStub::GetHandle() {
return NULL;
}
GLSurfaceStub::~GLSurfaceStub() {}
} // namespace gfx
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -13,8 +13,6 @@ namespace gfx {
// A GLSurface that does nothing for unit tests.
class GL_EXPORT GLSurfaceStub : public GLSurface {
public:
virtual ~GLSurfaceStub();
void SetSize(const gfx::Size& size) { size_ = size; }
// Implement GLSurface.
......@@ -24,6 +22,9 @@ class GL_EXPORT GLSurfaceStub : public GLSurface {
virtual gfx::Size GetSize() OVERRIDE;
virtual void* GetHandle() OVERRIDE;
protected:
virtual ~GLSurfaceStub();
private:
gfx::Size size_;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment