Remove GrRefCnt.h in favor of SkRefCnt.h
This removes GrRefCnt.h with all its tyepdefs and #defines and just switch them
to the Sk* equivalents.
GrSafeSetNull was promoted to SkSafeSetNull in SkRefCnt.h.
BUG=None
TEST=none, no functional changes.
R=bsalomon@google.com, robertphillips@google.com
Author: tfarina@chromium.org
Review URL: https://chromiumcodereview.appspot.com/23904003
git-svn-id: http://skia.googlecode.com/svn/trunk@11151 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index ae549b6..42413fb 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -15,7 +15,6 @@
#include "GrPathRendererChain.h"
#include "GrPoint.h"
#include "GrRenderTarget.h"
-#include "GrRefCnt.h"
#include "GrTexture.h"
class GrAARectRenderer;
@@ -40,7 +39,7 @@
class GrSoftwarePathRenderer;
class SkStrokeRec;
-class SK_API GrContext : public GrRefCnt {
+class SK_API GrContext : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrContext)
@@ -635,20 +634,20 @@
public:
AutoRenderTarget(GrContext* context, GrRenderTarget* target) {
fPrevTarget = context->getRenderTarget();
- GrSafeRef(fPrevTarget);
+ SkSafeRef(fPrevTarget);
context->setRenderTarget(target);
fContext = context;
}
AutoRenderTarget(GrContext* context) {
fPrevTarget = context->getRenderTarget();
- GrSafeRef(fPrevTarget);
+ SkSafeRef(fPrevTarget);
fContext = context;
}
~AutoRenderTarget() {
if (NULL != fContext) {
fContext->setRenderTarget(fPrevTarget);
}
- GrSafeUnref(fPrevTarget);
+ SkSafeUnref(fPrevTarget);
}
private:
GrContext* fContext;
@@ -934,7 +933,7 @@
*/
static bool OverbudgetCB(void* data);
- typedef GrRefCnt INHERITED;
+ typedef SkRefCnt INHERITED;
};
/**
diff --git a/include/gpu/GrEffect.h b/include/gpu/GrEffect.h
index a84810c..b0d336b 100644
--- a/include/gpu/GrEffect.h
+++ b/include/gpu/GrEffect.h
@@ -11,7 +11,6 @@
#include "GrColor.h"
#include "GrEffectUnitTest.h"
#include "GrNoncopyable.h"
-#include "GrRefCnt.h"
#include "GrTexture.h"
#include "GrTextureAccess.h"
#include "GrTypesPriv.h"
@@ -74,13 +73,13 @@
member function of a GrEffect subclass.
Because almost no code should ever handle a GrEffect directly outside of a GrEffectRef, we
- privately inherit from GrRefCnt to help prevent accidental direct ref'ing/unref'ing of effects.
+ privately inherit from SkRefCnt to help prevent accidental direct ref'ing/unref'ing of effects.
Dynamically allocated GrEffects and their corresponding GrEffectRefs are managed by a per-thread
memory pool. The ref count of an effect must reach 0 before the thread terminates and the pool
is destroyed. To create a static effect use the macro GR_CREATE_STATIC_EFFECT declared below.
*/
-class GrEffect : private GrRefCnt {
+class GrEffect : private SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrEffect)
@@ -317,7 +316,7 @@
bool fWillReadFragmentPosition;
GrEffectRef* fEffectRef;
- typedef GrRefCnt INHERITED;
+ typedef SkRefCnt INHERITED;
};
inline GrEffectRef::GrEffectRef(GrEffect* effect) {
diff --git a/include/gpu/GrFontScaler.h b/include/gpu/GrFontScaler.h
index f5dcf53..e51c4ac 100644
--- a/include/gpu/GrFontScaler.h
+++ b/include/gpu/GrFontScaler.h
@@ -20,7 +20,7 @@
* The client is responsible for subclassing, and instantiating this. The
* instance is create for a specific font+size+matrix.
*/
-class GrFontScaler : public GrRefCnt {
+class GrFontScaler : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrFontScaler)
@@ -32,7 +32,7 @@
virtual bool getGlyphPath(uint16_t glyphID, SkPath*) = 0;
private:
- typedef GrRefCnt INHERITED;
+ typedef SkRefCnt INHERITED;
};
#endif
diff --git a/include/gpu/GrKey.h b/include/gpu/GrKey.h
index 80eb537..e9d6feb 100644
--- a/include/gpu/GrKey.h
+++ b/include/gpu/GrKey.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2010 Google Inc.
*
@@ -6,14 +5,10 @@
* found in the LICENSE file.
*/
-
-
#ifndef GrKey_DEFINED
#define GrKey_DEFINED
-#include "GrRefCnt.h"
-
-class GrKey : public GrRefCnt {
+class GrKey : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrKey)
@@ -37,7 +32,7 @@
private:
const Hash fHash;
- typedef GrRefCnt INHERITED;
+ typedef SkRefCnt INHERITED;
};
#endif
diff --git a/include/gpu/GrPathRendererChain.h b/include/gpu/GrPathRendererChain.h
index d51a4bb..ca8c35b 100644
--- a/include/gpu/GrPathRendererChain.h
+++ b/include/gpu/GrPathRendererChain.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2011 Google Inc.
*
@@ -6,11 +5,10 @@
* found in the LICENSE file.
*/
-
#ifndef GrPathRendererChain_DEFINED
#define GrPathRendererChain_DEFINED
-#include "GrRefCnt.h"
+#include "SkRefCnt.h"
#include "SkTArray.h"
class GrContext;
@@ -64,7 +62,6 @@
StencilSupport* stencilSupport);
private:
-
GrPathRendererChain();
void init();
@@ -79,5 +76,4 @@
typedef SkRefCnt INHERITED;
};
-
#endif
diff --git a/include/gpu/GrRefCnt.h b/include/gpu/GrRefCnt.h
deleted file mode 100644
index 31aa80d..0000000
--- a/include/gpu/GrRefCnt.h
+++ /dev/null
@@ -1,33 +0,0 @@
-
-/*
- * Copyright 2010 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-
-#ifndef GrRefCnt_DEFINED
-#define GrRefCnt_DEFINED
-
-#include "GrTypes.h"
-#include "SkRefCnt.h"
-
-typedef SkRefCnt GrRefCnt;
-typedef SkAutoRef GrAutoRef;
-typedef SkAutoUnref GrAutoUnref;
-
-#define GrSafeRef SkSafeRef
-#define GrSafeUnref SkSafeUnref
-#define GrSafeAssign(a, b) SkRefCnt_SafeAssign(a, b)
-
-template<typename T>
-static inline void GrSafeSetNull(T*& obj) {
- if (NULL != obj) {
- obj->unref();
- obj = NULL;
- }
-}
-
-#endif
diff --git a/include/gpu/GrResource.h b/include/gpu/GrResource.h
index c52fa04..836c215 100644
--- a/include/gpu/GrResource.h
+++ b/include/gpu/GrResource.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2011 Google Inc.
*
@@ -6,12 +5,10 @@
* found in the LICENSE file.
*/
-
#ifndef GrResource_DEFINED
#define GrResource_DEFINED
-#include "GrRefCnt.h"
-
+#include "SkRefCnt.h"
#include "SkTInternalLList.h"
class GrGpu;
@@ -21,7 +18,7 @@
/**
* Base class for the GPU resources created by a GrContext.
*/
-class GrResource : public GrRefCnt {
+class GrResource : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrResource)
@@ -111,7 +108,7 @@
};
uint32_t fFlags;
- typedef GrRefCnt INHERITED;
+ typedef SkRefCnt INHERITED;
};
#endif
diff --git a/include/gpu/gl/GrGLInterface.h b/include/gpu/gl/GrGLInterface.h
index b4d3f79..44a9c7c 100644
--- a/include/gpu/gl/GrGLInterface.h
+++ b/include/gpu/gl/GrGLInterface.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2011 Google Inc.
*
@@ -6,12 +5,11 @@
* found in the LICENSE file.
*/
-
#ifndef GrGLInterface_DEFINED
#define GrGLInterface_DEFINED
#include "GrGLFunctions.h"
-#include "GrRefCnt.h"
+#include "SkRefCnt.h"
////////////////////////////////////////////////////////////////////////////////
@@ -110,7 +108,7 @@
* non-NULL or GrContext creation will fail. This can be tested with the
* validate() method when the OpenGL context has been made current.
*/
-struct SK_API GrGLInterface : public GrRefCnt {
+struct SK_API GrGLInterface : public SkRefCnt {
private:
// simple wrapper class that exists only to initialize a pointer to NULL
template <typename FNPTR_TYPE> class GLPtr {
@@ -122,7 +120,7 @@
FNPTR_TYPE fPtr;
};
- typedef GrRefCnt INHERITED;
+ typedef SkRefCnt INHERITED;
public:
SK_DECLARE_INST_COUNT(GrGLInterface)