SkNonCopyable should be used with private inheritance.
This is mostly s/public SkNoncopyable/SkNoncopyable/g.
Two classes (SkDrawLooper::Context and SkPicture::OperationList) don't actually work with SkNoncopyable because they introduce a virtual destructor. I added SkNoncopyableVirtual to make them work as intended. Sort of questionable whether they really need to be noncopyable in the first place, but I guess it doesn't hurt to keep the behavior the same.
BUG=skia:
R=reed@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/226183018
git-svn-id: http://skia.googlecode.com/svn/trunk@14081 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/PdfViewer/inc/SkPdfContext.h b/experimental/PdfViewer/inc/SkPdfContext.h
index a547fd6..cd6eba2 100644
--- a/experimental/PdfViewer/inc/SkPdfContext.h
+++ b/experimental/PdfViewer/inc/SkPdfContext.h
@@ -22,7 +22,7 @@
* The context of the drawing. The document we draw from, the current stack of
* objects, ...
*/
-class SkPdfContext : public SkNoncopyable {
+class SkPdfContext : SkNoncopyable {
public:
// FIXME (scroggo): Add functions for accessing these.
SkTDStackNester<SkPdfNativeObject*> fObjectStack;
diff --git a/experimental/PdfViewer/inc/SkPdfRenderer.h b/experimental/PdfViewer/inc/SkPdfRenderer.h
index c978a73..9fc1ff7 100644
--- a/experimental/PdfViewer/inc/SkPdfRenderer.h
+++ b/experimental/PdfViewer/inc/SkPdfRenderer.h
@@ -29,7 +29,7 @@
* The SkPdfRenderer class is used to render a PDF into canvas.
*
*/
-class SkPdfRenderer : public SkNoncopyable {
+class SkPdfRenderer : SkNoncopyable {
public:
// Create a new renderer from a stream.
// TODO(edisonn): replace it with a SkSmartStream which would know to to efficiently
diff --git a/experimental/SkiaExamples/SkExample.h b/experimental/SkiaExamples/SkExample.h
index 4b84723..ea734dc 100644
--- a/experimental/SkiaExamples/SkExample.h
+++ b/experimental/SkiaExamples/SkExample.h
@@ -19,7 +19,7 @@
class SkCanvas;
class SkExampleWindow;
-class SkExample : public SkNoncopyable {
+class SkExample : SkNoncopyable {
public:
SkExample(SkExampleWindow* window) : fWindow(window) {}
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 18c4679..45b6288 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -811,7 +811,7 @@
friend struct SkBitmapProcState;
};
-class SkAutoLockPixels : public SkNoncopyable {
+class SkAutoLockPixels : SkNoncopyable {
public:
SkAutoLockPixels(const SkBitmap& bm, bool doLock = true) : fBitmap(bm) {
fDidLock = doLock;
@@ -835,7 +835,7 @@
/** Helper class that performs the lock/unlockColors calls on a colortable.
The destructor will call unlockColors(false) if it has a bitmap's colortable
*/
-class SkAutoLockColors : public SkNoncopyable {
+class SkAutoLockColors : SkNoncopyable {
public:
/** Initialize with no bitmap. Call lockColors(bitmap) to lock bitmap's
colortable
diff --git a/include/core/SkDrawLooper.h b/include/core/SkDrawLooper.h
index 3c45a6a..cc42952 100644
--- a/include/core/SkDrawLooper.h
+++ b/include/core/SkDrawLooper.h
@@ -35,7 +35,7 @@
* Subclasses of SkDrawLooper should create a subclass of this object to
* hold state specific to their subclass.
*/
- class SK_API Context : public SkNoncopyable {
+ class SK_API Context : ::SkNoncopyable {
public:
Context() {}
virtual ~Context() {}
diff --git a/include/core/SkImageDecoder.h b/include/core/SkImageDecoder.h
index 2300f6d..130b721 100644
--- a/include/core/SkImageDecoder.h
+++ b/include/core/SkImageDecoder.h
@@ -24,7 +24,7 @@
Base class for decoding compressed images into a SkBitmap
*/
-class SkImageDecoder : public SkNoncopyable {
+class SkImageDecoder : SkNoncopyable {
public:
virtual ~SkImageDecoder();
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index baa9486..7069117 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -328,7 +328,7 @@
private:
// An OperationList encapsulates a set of operation offsets into the picture byte
// stream along with the CTMs needed for those operation.
- class OperationList : public SkNoncopyable {
+ class OperationList : ::SkNoncopyable {
public:
virtual ~OperationList() {}
@@ -345,9 +345,6 @@
virtual const SkMatrix& matrix(int index) const { SkASSERT(false); return SkMatrix::I(); }
static const OperationList& InvalidList();
-
- private:
- typedef SkNoncopyable INHERITED;
};
/** PRIVATE / EXPERIMENTAL -- do not call
diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h
index e4524be..41c7829 100644
--- a/include/core/SkRefCnt.h
+++ b/include/core/SkRefCnt.h
@@ -25,7 +25,7 @@
destructor to be called explicitly (or via the object going out of scope on
the stack or calling delete) if getRefCnt() > 1.
*/
-class SK_API SkRefCntBase : public SkNoncopyable {
+class SK_API SkRefCntBase : SkNoncopyable {
public:
SK_DECLARE_INST_COUNT_ROOT(SkRefCntBase)
diff --git a/include/core/SkTInternalLList.h b/include/core/SkTInternalLList.h
index 0b67d4a..1c82a71 100644
--- a/include/core/SkTInternalLList.h
+++ b/include/core/SkTInternalLList.h
@@ -38,7 +38,7 @@
/**
* This class implements a templated internal doubly linked list data structure.
*/
-template <class T> class SkTInternalLList : public SkNoncopyable {
+template <class T> class SkTInternalLList : SkNoncopyable {
public:
SkTInternalLList()
: fHead(NULL)
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index 74ddf02..13450cd 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -490,7 +490,7 @@
* the lifetime of the block, so the caller must not call sk_free() or delete
* on the block, unless detach() was called.
*/
-class SkAutoMalloc : public SkNoncopyable {
+class SkAutoMalloc : SkNoncopyable {
public:
explicit SkAutoMalloc(size_t size = 0) {
fPtr = size ? sk_malloc_throw(size) : NULL;
diff --git a/include/gpu/GrBackendEffectFactory.h b/include/gpu/GrBackendEffectFactory.h
index d115a54..0fc981c 100644
--- a/include/gpu/GrBackendEffectFactory.h
+++ b/include/gpu/GrBackendEffectFactory.h
@@ -28,7 +28,7 @@
class GrGLCaps;
class GrDrawEffect;
-class GrBackendEffectFactory : public SkNoncopyable {
+class GrBackendEffectFactory : SkNoncopyable {
public:
typedef uint32_t EffectKey;
enum {
diff --git a/include/gpu/GrClipData.h b/include/gpu/GrClipData.h
index b06dc06..1dc4b0d 100644
--- a/include/gpu/GrClipData.h
+++ b/include/gpu/GrClipData.h
@@ -20,7 +20,7 @@
* device coordinates (i.e., they have been translated by -fOrigin w.r.t.
* the canvas' device coordinates).
*/
-class GrClipData : public SkNoncopyable {
+class GrClipData : SkNoncopyable {
public:
const SkClipStack* fClipStack;
SkIPoint fOrigin;
diff --git a/include/gpu/GrContextFactory.h b/include/gpu/GrContextFactory.h
index 333afd2..916d5df 100644
--- a/include/gpu/GrContextFactory.h
+++ b/include/gpu/GrContextFactory.h
@@ -28,7 +28,7 @@
* factory is destroyed (though the caller can always grab a ref on the returned
* Gr and GL contexts to make them outlive the factory).
*/
-class GrContextFactory : public SkNoncopyable {
+class GrContextFactory : SkNoncopyable {
public:
/**
* Types of GL contexts supported. For historical and testing reasons the native GrContext will
diff --git a/include/gpu/GrCoordTransform.h b/include/gpu/GrCoordTransform.h
index 14e2620..f266577 100644
--- a/include/gpu/GrCoordTransform.h
+++ b/include/gpu/GrCoordTransform.h
@@ -39,7 +39,7 @@
* position). GrEffects just define these transformations, and the framework does the rest of the
* work to make the transformed coordinates available in their fragment shader.
*/
-class GrCoordTransform : public SkNoncopyable {
+class GrCoordTransform : SkNoncopyable {
public:
GrCoordTransform() { SkDEBUGCODE(fInEffect = false); }
diff --git a/include/gpu/GrEffectUnitTest.h b/include/gpu/GrEffectUnitTest.h
index 850db9b..f71ab54 100644
--- a/include/gpu/GrEffectUnitTest.h
+++ b/include/gpu/GrEffectUnitTest.h
@@ -35,7 +35,7 @@
class GrEffectRef;
class GrTexture;
-class GrEffectTestFactory : public SkNoncopyable {
+class GrEffectTestFactory : SkNoncopyable {
public:
typedef GrEffectRef* (*CreateProc)(SkRandom*,
diff --git a/include/gpu/GrTextureAccess.h b/include/gpu/GrTextureAccess.h
index 87b8d82..9f56171 100644
--- a/include/gpu/GrTextureAccess.h
+++ b/include/gpu/GrTextureAccess.h
@@ -112,7 +112,7 @@
* key. However, if a GrEffect uses different swizzles based on its input then it must
* consider that variation in its key-generation.
*/
-class GrTextureAccess : public SkNoncopyable {
+class GrTextureAccess : SkNoncopyable {
public:
/**
* A default GrTextureAccess must have reset() called on it in a GrEffect subclass's
diff --git a/src/core/SkMatrixClipStateMgr.h b/src/core/SkMatrixClipStateMgr.h
index b227583..270eacd 100644
--- a/src/core/SkMatrixClipStateMgr.h
+++ b/src/core/SkMatrixClipStateMgr.h
@@ -53,7 +53,7 @@
static const int32_t kIdentityWideOpenStateID = 0;
static const int kIdentityMatID = 0;
- class MatrixClipState : public SkNoncopyable {
+ class MatrixClipState : SkNoncopyable {
public:
class MatrixInfo {
public:
@@ -108,7 +108,7 @@
typedef SkNoncopyable INHERITED;
};
- class ClipInfo : public SkNoncopyable {
+ class ClipInfo : SkNoncopyable {
public:
ClipInfo() {}
diff --git a/src/core/SkSmallAllocator.h b/src/core/SkSmallAllocator.h
index 2eddb51..655008b 100644
--- a/src/core/SkSmallAllocator.h
+++ b/src/core/SkSmallAllocator.h
@@ -29,7 +29,7 @@
* object it allocated and freeing its memory.
*/
template<uint32_t kMaxObjects, size_t kTotalBytes>
-class SkSmallAllocator : public SkNoncopyable {
+class SkSmallAllocator : SkNoncopyable {
public:
SkSmallAllocator()
: fStorageUsed(0)
diff --git a/src/core/SkTLList.h b/src/core/SkTLList.h
index aeae3f7..e2b9691 100644
--- a/src/core/SkTLList.h
+++ b/src/core/SkTLList.h
@@ -28,7 +28,7 @@
constructor arguments for type_name. These macros behave like addBefore() and addAfter().
*/
template <typename T>
-class SkTLList : public SkNoncopyable {
+class SkTLList : SkNoncopyable {
private:
struct Block;
struct Node {
diff --git a/src/gpu/GrAllocPool.h b/src/gpu/GrAllocPool.h
index 07ba05f..4fc8265 100644
--- a/src/gpu/GrAllocPool.h
+++ b/src/gpu/GrAllocPool.h
@@ -10,7 +10,7 @@
#include "SkTypes.h"
-class GrAllocPool : public SkNoncopyable {
+class GrAllocPool : SkNoncopyable {
public:
GrAllocPool(size_t blockSize = 0);
~GrAllocPool();
diff --git a/src/gpu/GrAllocator.h b/src/gpu/GrAllocator.h
index 4e47fb1..a2ad408e 100644
--- a/src/gpu/GrAllocator.h
+++ b/src/gpu/GrAllocator.h
@@ -13,7 +13,7 @@
#include "SkTArray.h"
#include "SkTypes.h"
-class GrAllocator : public SkNoncopyable {
+class GrAllocator : SkNoncopyable {
public:
~GrAllocator() {
reset();
@@ -153,7 +153,7 @@
};
template <typename T>
-class GrTAllocator : public SkNoncopyable {
+class GrTAllocator : SkNoncopyable {
public:
virtual ~GrTAllocator() { this->reset(); };
diff --git a/src/gpu/GrBufferAllocPool.h b/src/gpu/GrBufferAllocPool.h
index 809fa5f..9a31cc2 100644
--- a/src/gpu/GrBufferAllocPool.h
+++ b/src/gpu/GrBufferAllocPool.h
@@ -27,7 +27,7 @@
* a number of buffers to preallocate can be specified. These will
* be allocated at the min size and kept around until the pool is destroyed.
*/
-class GrBufferAllocPool : public SkNoncopyable {
+class GrBufferAllocPool : SkNoncopyable {
public:
/**
* Ensures all buffers are unlocked and have all data written to them.
diff --git a/src/gpu/GrClipMaskCache.h b/src/gpu/GrClipMaskCache.h
index 213e282..b332c7b 100644
--- a/src/gpu/GrClipMaskCache.h
+++ b/src/gpu/GrClipMaskCache.h
@@ -18,7 +18,7 @@
* The stencil buffer stores the last clip path - providing a single entry
* "cache". This class provides similar functionality for AA clip paths
*/
-class GrClipMaskCache : public SkNoncopyable {
+class GrClipMaskCache : SkNoncopyable {
public:
GrClipMaskCache();
diff --git a/src/gpu/GrClipMaskManager.h b/src/gpu/GrClipMaskManager.h
index 1732910..260d708 100644
--- a/src/gpu/GrClipMaskManager.h
+++ b/src/gpu/GrClipMaskManager.h
@@ -36,7 +36,7 @@
* mask can be represented as a rectangle then scissoring is used. In all
* cases scissoring is used to bound the range of the clip mask.
*/
-class GrClipMaskManager : public SkNoncopyable {
+class GrClipMaskManager : SkNoncopyable {
public:
GrClipMaskManager()
: fGpu(NULL)
diff --git a/src/gpu/GrOrderedSet.h b/src/gpu/GrOrderedSet.h
index b149dfb..23b9353 100644
--- a/src/gpu/GrOrderedSet.h
+++ b/src/gpu/GrOrderedSet.h
@@ -11,7 +11,7 @@
#include "GrRedBlackTree.h"
template <typename T, typename C = GrLess<T> >
-class GrOrderedSet : public SkNoncopyable {
+class GrOrderedSet : SkNoncopyable {
public:
/**
* Creates an empty set
diff --git a/src/gpu/GrPlotMgr.h b/src/gpu/GrPlotMgr.h
index 6ea6086..8d55ed0 100644
--- a/src/gpu/GrPlotMgr.h
+++ b/src/gpu/GrPlotMgr.h
@@ -12,7 +12,7 @@
#include "GrPoint.h"
#include "SkTypes.h"
-class GrPlotMgr : public SkNoncopyable {
+class GrPlotMgr : SkNoncopyable {
public:
GrPlotMgr(int width, int height) {
fDim.set(width, height);
diff --git a/src/gpu/GrRedBlackTree.h b/src/gpu/GrRedBlackTree.h
index 6f57754..d9b1a04 100644
--- a/src/gpu/GrRedBlackTree.h
+++ b/src/gpu/GrRedBlackTree.h
@@ -40,7 +40,7 @@
* will be created and used for all comparisons.
*/
template <typename T, typename C = GrLess<T> >
-class GrRedBlackTree : public SkNoncopyable {
+class GrRedBlackTree : SkNoncopyable {
public:
/**
* Creates an empty tree.
diff --git a/src/gpu/GrSWMaskHelper.h b/src/gpu/GrSWMaskHelper.h
index b274e84..697d6f3 100644
--- a/src/gpu/GrSWMaskHelper.h
+++ b/src/gpu/GrSWMaskHelper.h
@@ -38,7 +38,7 @@
* The result of this process will be the final mask (on the GPU) in the
* upper left hand corner of the texture.
*/
-class GrSWMaskHelper : public SkNoncopyable {
+class GrSWMaskHelper : SkNoncopyable {
public:
GrSWMaskHelper(GrContext* context)
: fContext(context) {
diff --git a/src/gpu/GrTemplates.h b/src/gpu/GrTemplates.h
index 5a009df..2cab132 100644
--- a/src/gpu/GrTemplates.h
+++ b/src/gpu/GrTemplates.h
@@ -35,7 +35,7 @@
* ...
* } // fCount is restored
*/
-template <typename T> class GrAutoTRestore : public SkNoncopyable {
+template <typename T> class GrAutoTRestore : SkNoncopyable {
public:
GrAutoTRestore() : fPtr(NULL), fVal() {}
diff --git a/src/gpu/effects/GrTextureStripAtlas.h b/src/gpu/effects/GrTextureStripAtlas.h
index e06e273..5227cc3 100644
--- a/src/gpu/effects/GrTextureStripAtlas.h
+++ b/src/gpu/effects/GrTextureStripAtlas.h
@@ -79,7 +79,7 @@
* The state of a single row in our cache, next/prev pointers allow these to be chained
* together to represent LRU status
*/
- struct AtlasRow : public SkNoncopyable {
+ struct AtlasRow : SkNoncopyable {
AtlasRow() : fKey(kEmptyAtlasRowKey), fLocks(0), fNext(NULL), fPrev(NULL) { }
// GenerationID of the bitmap that is represented by this row, 0xffffffff means "empty"
uint32_t fKey;
diff --git a/src/gpu/gl/GrGLBufferImpl.h b/src/gpu/gl/GrGLBufferImpl.h
index ab25556..148ca1b 100644
--- a/src/gpu/gl/GrGLBufferImpl.h
+++ b/src/gpu/gl/GrGLBufferImpl.h
@@ -17,7 +17,7 @@
* This class serves as the implementation of GrGL*Buffer classes. It was written to avoid code
* duplication in those classes.
*/
-class GrGLBufferImpl : public SkNoncopyable {
+class GrGLBufferImpl : SkNoncopyable {
public:
struct Desc {
bool fIsWrapped;
diff --git a/src/gpu/gl/GrGLShaderBuilder.h b/src/gpu/gl/GrGLShaderBuilder.h
index fb75d3a..233bb52 100644
--- a/src/gpu/gl/GrGLShaderBuilder.h
+++ b/src/gpu/gl/GrGLShaderBuilder.h
@@ -255,7 +255,7 @@
void appendUniformDecls(ShaderVisibility, SkString*) const;
private:
- class CodeStage : public SkNoncopyable {
+ class CodeStage : SkNoncopyable {
public:
CodeStage() : fNextIndex(0), fCurrentIndex(-1), fEffectStage(NULL) {}
@@ -274,7 +274,7 @@
return fCurrentIndex;
}
- class AutoStageRestore : public SkNoncopyable {
+ class AutoStageRestore : SkNoncopyable {
public:
AutoStageRestore(CodeStage* codeStage, const GrEffectStage* newStage) {
SkASSERT(NULL != codeStage);
diff --git a/src/gpu/gl/debug/GrFakeRefObj.h b/src/gpu/gl/debug/GrFakeRefObj.h
index 47ec4ee..84ac499 100644
--- a/src/gpu/gl/debug/GrFakeRefObj.h
+++ b/src/gpu/gl/debug/GrFakeRefObj.h
@@ -18,7 +18,7 @@
// are tracking in this class are actually OpenGL's references to the objects
// not "ours"
// Each object also gets a unique globally identifying ID
-class GrFakeRefObj : public SkNoncopyable {
+class GrFakeRefObj : SkNoncopyable {
public:
GrFakeRefObj()
: fRef(0)
diff --git a/src/pdf/SkPDFFont.h b/src/pdf/SkPDFFont.h
index 694c69a..68a00f0 100644
--- a/src/pdf/SkPDFFont.h
+++ b/src/pdf/SkPDFFont.h
@@ -21,7 +21,7 @@
class SkPDFCatalog;
class SkPDFFont;
-class SkPDFGlyphSet : public SkNoncopyable {
+class SkPDFGlyphSet : SkNoncopyable {
public:
SkPDFGlyphSet();
@@ -34,7 +34,7 @@
SkBitSet fBitSet;
};
-class SkPDFGlyphSetMap : public SkNoncopyable {
+class SkPDFGlyphSetMap : SkNoncopyable {
public:
struct FontGlyphSetPair {
FontGlyphSetPair(SkPDFFont* font, SkPDFGlyphSet* glyphSet);