remove SkInstCnt

It's been outclassed by Valgrind and leak sanitizer,
and it seems to be causing problems for external folks building Skia.

I'm not sure why our own builds seem unaffected.

Latest thread:
https://groups.google.com/forum/#!topic/skia-discuss/oj9FsQwwSF0

BUG=skia:

Review URL: https://codereview.chromium.org/1217573002
This commit is contained in:
mtklein 2015-06-26 11:45:03 -07:00 committed by Commit bot
parent 46043ee50f
commit 2766c00fc0
115 changed files with 98 additions and 391 deletions

View File

@ -43,8 +43,6 @@ public:
class Benchmark : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(Benchmark)
Benchmark();
const char* getName();

View File

@ -23,7 +23,6 @@ enum {
class BenchResource : public GrGpuResource {
public:
SK_DECLARE_INST_COUNT(BenchResource);
BenchResource (GrGpu* gpu)
: INHERITED(gpu, kCached_LifeCycle) {
this->registerWithCache();

View File

@ -89,8 +89,6 @@ private:
class PlacedRefCnt : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(PlacedRefCnt)
PlacedRefCnt() : SkRefCnt() { }
void operator delete(void*) { }

View File

@ -17,7 +17,6 @@
#include "SkFontMgr.h"
#include "SkForceLinking.h"
#include "SkGraphics.h"
#include "SkInstCnt.h"
#include "SkMD5.h"
#include "SkOSFile.h"
#include "SkTHash.h"
@ -751,9 +750,6 @@ int dm_main() {
SetupCrashHandler();
SkAutoGraphics ag;
SkTaskGroup::Enabler enabled(FLAGS_threads);
if (FLAGS_leaks) {
SkInstCountPrintLeaksOnExit();
}
gCreateTypefaceDelegate = &create_from_name;
start_keepalive();

View File

@ -18,8 +18,6 @@
*/
class SK_API SkNulCanvas : public SkCanvas {
public:
SK_DECLARE_INST_COUNT(SkNulCanvas);
SkNulCanvas() {}
explicit SkNulCanvas(SkBaseDevice* device) : SkCanvas(device) {}
@ -98,7 +96,7 @@ protected:
const uint16_t indices[], int indexCount,
const SkPaint& paint) override {}
private:
typedef SkCanvas INHERITED;
};

View File

@ -25,8 +25,6 @@
// TODO: can this be derived from SkBaseDevice instead?
class SkTrackDevice : public SkBitmapDevice {
public:
SK_DECLARE_INST_COUNT(SkTrackDevice)
SkTrackDevice(const SkBitmap& bitmap)
: INHERITED(bitmap, SkSurfaceProps(0, kUnknown_SkPixelGeometry))
, fTracker(NULL) {

View File

@ -171,8 +171,6 @@ namespace skiagm {
*/
class ExpectationsSource : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(ExpectationsSource)
virtual Expectations get(const char *testName) const = 0;
private:

View File

@ -112,7 +112,6 @@
'<(skia_src_path)/core/SkGraphics.cpp',
'<(skia_src_path)/core/SkHalf.cpp',
'<(skia_src_path)/core/SkHalf.h',
'<(skia_src_path)/core/SkInstCnt.cpp',
'<(skia_src_path)/core/SkImageFilter.cpp',
'<(skia_src_path)/core/SkImageInfo.cpp',
'<(skia_src_path)/core/SkImageGenerator.cpp',
@ -282,7 +281,6 @@
'<(skia_include_path)/core/SkImageEncoder.h',
'<(skia_include_path)/core/SkImageFilter.h',
'<(skia_include_path)/core/SkImageInfo.h',
'<(skia_include_path)/core/SkInstCnt.h',
'<(skia_include_path)/core/SkMallocPixelRef.h',
'<(skia_include_path)/core/SkMask.h',
'<(skia_include_path)/core/SkMaskFilter.h',

View File

@ -58,13 +58,6 @@
//#define SK_DEBUG_GLYPH_CACHE
//#define SK_DEBUG_PATH
/* To assist debugging, Skia provides an instance counting utility in
include/core/SkInstCount.h. This flag turns on and off that utility to
allow instance count tracking in either debug or release builds. By
default it is enabled in debug but disabled in release.
*/
//#define SK_ENABLE_INST_COUNT 1
/* If, in debugging mode, Skia needs to stop (presumably to invoke a debugger)
it will call SK_CRASH(). If this is not defined it, it is defined in
SkPostConfig.h to write to an illegal address

View File

@ -673,8 +673,6 @@ public:
class Allocator : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(Allocator)
/** Allocate the pixel memory for the bitmap, given its dimensions and
colortype. Return true on success, where success means either setPixels
or setPixelRef was called. The pixels need not be locked when this

View File

@ -14,8 +14,6 @@
///////////////////////////////////////////////////////////////////////////////
class SK_API SkBitmapDevice : public SkBaseDevice {
public:
SK_DECLARE_INST_COUNT(SkBitmapDevice)
/**
* Construct a new device with the specified bitmap as its backend. It is
* valid for the bitmap to have no pixels associated with it. In that case,

View File

@ -54,8 +54,6 @@ class SkCanvasState;
*/
class SK_API SkCanvas : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkCanvas)
/**
* Attempt to allocate raster canvas, matching the ImageInfo, that will draw directly into the
* specified pixels. To access the pixels after drawing to them, the caller should call
@ -1241,7 +1239,7 @@ protected:
virtual void onDrawVertices(VertexMode, int vertexCount, const SkPoint vertices[],
const SkPoint texs[], const SkColor colors[], SkXfermode*,
const uint16_t indices[], int indexCount, const SkPaint&);
virtual void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[],
int count, SkXfermode::Mode, const SkRect* cull, const SkPaint*);
virtual void onDrawPath(const SkPath&, const SkPaint&);

View File

@ -27,8 +27,6 @@ class GrContext;
*/
class SK_API SkColorFilter : public SkFlattenable {
public:
SK_DECLARE_INST_COUNT(SkColorFilter)
/**
* If the filter can be represented by a source color plus Mode, this
* returns true, and sets (if not NULL) the color and mode appropriately.

View File

@ -24,8 +24,6 @@
*/
class SK_API SkColorTable : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkColorTable)
/** Copy up to 256 colors into a new SkColorTable.
*/
SkColorTable(const SkPMColor colors[], int count);

View File

@ -20,8 +20,6 @@ class SkStream;
*/
class SK_API SkData : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkData)
/**
* Returns the number of bytes stored.
*/

View File

@ -20,8 +20,6 @@
*/
class SK_API SkDataTable : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkDataTable)
/**
* Returns true if the table is empty (i.e. has no entries).
*/

View File

@ -26,8 +26,6 @@ class GrRenderTarget;
class SK_API SkBaseDevice : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkBaseDevice)
/**
* Construct a new device.
*/

View File

@ -32,8 +32,6 @@ class SkWStream;
*/
class SK_API SkDocument : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkDocument)
/**
* Create a PDF-backed document, writing the results into a SkWStream.
*

View File

@ -23,8 +23,6 @@ class SkPaint;
*/
class SK_API SkDrawFilter : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkDrawFilter)
enum Type {
kPaint_Type,
kPoint_Type,

View File

@ -30,8 +30,6 @@ class SkString;
*/
class SK_API SkDrawLooper : public SkFlattenable {
public:
SK_DECLARE_INST_COUNT(SkDrawLooper)
/**
* Holds state during a draw. Users call next() until it returns false.
*

View File

@ -80,8 +80,6 @@ public:
kSkXfermode_Type,
};
SK_DECLARE_INST_COUNT(SkFlattenable)
typedef SkFlattenable* (*Factory)(SkReadBuffer&);
SkFlattenable() {}

View File

@ -41,8 +41,6 @@ class GrTexture;
*/
class SK_API SkImage : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkImage)
typedef SkImageInfo Info;
typedef void* ReleaseContext;
@ -172,7 +170,7 @@ public:
*/
bool isTextureBacked() const;
/**
/**
* Retrieves the backend API handle of the texture. If flushPendingGrContextReads then the
* GrContext will issue to the backend API any deferred read operations on the texture before
* returning.

View File

@ -133,8 +133,6 @@ public:
*/
class Peeker : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(Peeker)
/** Return true to continue decoding, or false to indicate an error, which
will cause the decoder to not return the image.
*/
@ -376,7 +374,7 @@ protected:
* Return the default preference being used by the current or latest call to decode.
*/
SkColorType getDefaultPref() { return fDefaultPref; }
/* Helper for subclasses. Call this to allocate the pixel memory given the bitmap's info.
Returns true on success. This method handles checking for an optional Allocator.
*/
@ -421,7 +419,7 @@ private:
*/
class SkImageDecoderFactory : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkImageDecoderFactory)
virtual SkImageDecoder* newDecoder(SkStreamRewindable*) = 0;

View File

@ -31,8 +31,6 @@ struct SkIPoint;
*/
class SK_API SkImageFilter : public SkFlattenable {
public:
SK_DECLARE_INST_COUNT(SkImageFilter)
class CropRect {
public:
enum CropEdge {
@ -84,7 +82,7 @@ public:
class Proxy {
public:
Proxy(SkBaseDevice* device) : fDevice(device) { }
SkBaseDevice* createDevice(int width, int height);
// Returns true if the proxy handled the filter itself. If this returns
@ -95,7 +93,7 @@ public:
private:
SkBaseDevice* fDevice;
};
/**
* Request a new (result) image to be created from the src image.

View File

@ -1,82 +0,0 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkInstCnt_DEFINED
#define SkInstCnt_DEFINED
/* To count all instances of T, including all subclasses of T,
* add SK_DECLARE_INST_COUNT(T) to T's class definition.
* If you want to print out counts of leaked instances, set gPrintInstCount to true in main().
*
* E.g.
* struct Base { SK_DECLARE_INST_COUNT(Base) };
* struct A : public Base {};
* struct SubBase : public Base { SK_DECLARE_INST_COUNT(SubBase); }
* struct B : public SubBase {};
*
* If gPrintInstCount is true, at the program exit you will see something like:
* Base: <N> leaked instances
* SubBase: <M> leaked instances
* where N >= M. Leaked instances of A count against Base; leaked instances of B count against
* both SubBase and Base.
*
* If SK_ENABLE_INST_COUNT is not defined or defined to 0, or we're in a shared library build,
* this entire system is compiled away to a noop.
*/
#include "SkTypes.h"
#if SK_ENABLE_INST_COUNT && !defined(SKIA_DLL) // See skia:2058 for why we noop on shared builds.
#include "SkThread.h"
#include <stdlib.h>
#define SK_DECLARE_INST_COUNT(T) \
static const char* InstCountClassName() { return #T; } \
SkInstCount<T, T::InstCountClassName> fInstCnt; \
static int32_t GetInstanceCount() { return SkInstCount<T, InstCountClassName>::Count(); }
extern bool gPrintInstCount;
template <typename T, const char*(Name)()>
class SkInstCount {
public:
SkInstCount() { Inc(); }
SkInstCount(const SkInstCount&) { Inc(); }
~SkInstCount() { sk_atomic_dec(&gCount); }
SkInstCount& operator==(const SkInstCount&) { return *this; } // == can't change the count.
static void Inc() {
// If it's the first time we go from 0 to 1, register to print leaks at process exit.
if (0 == sk_atomic_inc(&gCount) && sk_atomic_cas(&gRegistered, 0, 1)) {
atexit(PrintAtExit);
}
}
static void PrintAtExit() {
int32_t leaks = Count();
if (gPrintInstCount && leaks > 0) {
SkDebugf("Leaked %s: %d\n", Name(), leaks);
}
}
// FIXME: Used publicly by unit tests. Seems like a bad idea in a DM world.
static int32_t Count() { return sk_acquire_load(&gCount); }
private:
static int32_t gCount, gRegistered;
};
// As template values, these will be deduplicated. (No one-definition rule problems.)
template <typename T, const char*(Name)()> int32_t SkInstCount<T, Name>::gCount = 0;
template <typename T, const char*(Name)()> int32_t SkInstCount<T, Name>::gRegistered = 0;
#else
#define SK_DECLARE_INST_COUNT(T)
#endif
void SkInstCountPrintLeaksOnExit();
#endif // SkInstCnt_DEFINED

View File

@ -16,7 +16,6 @@
*/
class SK_API SkMallocPixelRef : public SkPixelRef {
public:
SK_DECLARE_INST_COUNT(SkMallocPixelRef)
/**
* Return a new SkMallocPixelRef with the provided pixel storage, rowBytes,
* and optional colortable. The caller is responsible for managing the

View File

@ -41,8 +41,6 @@ class SkStrokeRec;
*/
class SK_API SkMaskFilter : public SkFlattenable {
public:
SK_DECLARE_INST_COUNT(SkMaskFilter)
/** Returns the format of the resulting mask that this subclass will return
when its filterMask() method is called.
*/

View File

@ -8,7 +8,6 @@
#ifndef SkPath_DEFINED
#define SkPath_DEFINED
#include "SkInstCnt.h"
#include "SkMatrix.h"
#include "SkPathRef.h"
#include "SkTDArray.h"
@ -28,8 +27,6 @@ class SkWStream;
*/
class SK_API SkPath {
public:
SK_DECLARE_INST_COUNT(SkPath);
SkPath();
SkPath(const SkPath&);
~SkPath();

View File

@ -29,8 +29,6 @@ class SkPath;
*/
class SK_API SkPathEffect : public SkFlattenable {
public:
SK_DECLARE_INST_COUNT(SkPathEffect)
/**
* Given a src path (input) and a stroke-rec (input and output), apply
* this effect to the src path, returning the new path in dst, and return
@ -168,7 +166,7 @@ protected:
// these are visible to our subclasses
SkPathEffect* fPE0, *fPE1;
SK_TO_STRING_OVERRIDE()
SK_TO_STRING_OVERRIDE()
private:
typedef SkPathEffect INHERITED;
@ -193,7 +191,7 @@ public:
virtual bool filterPath(SkPath* dst, const SkPath& src,
SkStrokeRec*, const SkRect*) const override;
SK_TO_STRING_OVERRIDE()
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect)
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
@ -230,7 +228,7 @@ public:
virtual bool filterPath(SkPath* dst, const SkPath& src,
SkStrokeRec*, const SkRect*) const override;
SK_TO_STRING_OVERRIDE()
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect)
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK

View File

@ -36,8 +36,6 @@ class SkWBuffer;
class SK_API SkPathRef : public ::SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkPathRef);
class Editor {
public:
Editor(SkAutoTUnref<SkPathRef>* pathRef,

View File

@ -49,8 +49,6 @@ class GrTexture;
*/
class SK_API SkPixelRef : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkPixelRef)
explicit SkPixelRef(const SkImageInfo&);
SkPixelRef(const SkImageInfo&, SkBaseMutex* mutex);
virtual ~SkPixelRef();

View File

@ -122,23 +122,6 @@
///////////////////////////////////////////////////////////////////////////////
/**
* SK_ENABLE_INST_COUNT controlls printing how many reference counted objects
* are still held on exit.
* Defaults to 1 in DEBUG and 0 in RELEASE.
*/
#ifndef SK_ENABLE_INST_COUNT
// Only enabled for static builds, because instance counting relies on static
// variables in functions defined in header files.
# if SK_DEVELOPER && !defined(SKIA_DLL)
# define SK_ENABLE_INST_COUNT 1
# else
# define SK_ENABLE_INST_COUNT 0
# endif
#endif
///////////////////////////////////////////////////////////////////////////////
#ifdef SK_BUILD_FOR_WIN
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN

View File

@ -20,8 +20,6 @@ struct SkIRect;
class SK_API SkRasterizer : public SkFlattenable {
public:
SK_DECLARE_INST_COUNT(SkRasterizer)
/** Turn the path into a mask, respecting the specified local->device matrix.
*/
bool rasterize(const SkPath& path, const SkMatrix& matrix,

View File

@ -11,7 +11,6 @@
#define SkRefCnt_DEFINED
#include "SkAtomics.h"
#include "SkInstCnt.h"
#include "SkTemplates.h"
/** \class SkRefCntBase
@ -26,8 +25,6 @@
*/
class SK_API SkRefCntBase : SkNoncopyable {
public:
SK_DECLARE_INST_COUNT(SkRefCntBase)
/** Default construct, initializing the reference count to 1.
*/
SkRefCntBase() : fRefCnt(1) {}

View File

@ -33,8 +33,6 @@ class GrFragmentProcessor;
*/
class SK_API SkShader : public SkFlattenable {
public:
SK_DECLARE_INST_COUNT(SkShader)
SkShader(const SkMatrix* localMatrix = NULL);
virtual ~SkShader();

View File

@ -181,8 +181,6 @@ public:
class SK_API SkWStream : SkNoncopyable {
public:
SK_DECLARE_INST_COUNT(SkWStream)
virtual ~SkWStream();
/** Called to write bytes to a SkWStream. Returns true on success
@ -231,8 +229,6 @@ struct SkFILE;
/** A stream that wraps a C FILE* file stream. */
class SK_API SkFILEStream : public SkStreamAsset {
public:
SK_DECLARE_INST_COUNT(SkFILEStream)
/** Initialize the stream by calling sk_fopen on the specified path.
* This internal stream will be closed in the destructor.
*/
@ -286,8 +282,6 @@ private:
class SK_API SkMemoryStream : public SkStreamMemory {
public:
SK_DECLARE_INST_COUNT(SkMemoryStream)
SkMemoryStream();
/** We allocate (and free) the memory. Write to it via getMemoryBase() */
@ -358,8 +352,6 @@ private:
class SK_API SkFILEWStream : public SkWStream {
public:
SK_DECLARE_INST_COUNT(SkFILEWStream)
SkFILEWStream(const char path[]);
virtual ~SkFILEWStream();
@ -379,8 +371,6 @@ private:
class SkMemoryWStream : public SkWStream {
public:
SK_DECLARE_INST_COUNT(SkMemoryWStream)
SkMemoryWStream(void* buffer, size_t size);
bool write(const void* buffer, size_t size) override;
size_t bytesWritten() const override { return fBytesWritten; }
@ -395,8 +385,6 @@ private:
class SK_API SkDynamicMemoryWStream : public SkWStream {
public:
SK_DECLARE_INST_COUNT(SkDynamicMemoryWStream)
SkDynamicMemoryWStream();
virtual ~SkDynamicMemoryWStream();
@ -444,7 +432,6 @@ private:
class SK_API SkDebugWStream : public SkWStream {
public:
SkDebugWStream() : fBytesWritten(0) {}
SK_DECLARE_INST_COUNT(SkDebugWStream)
// overrides
bool write(const void* buffer, size_t size) override;

View File

@ -30,8 +30,6 @@ class GrRenderTarget;
*/
class SK_API SkSurface : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkSurface)
/**
* Indicates whether a new surface or image should count against a cache budget. Currently this
* is only used by the GPU backend (sw-raster surfaces and images are never counted against the
@ -84,7 +82,7 @@ public:
* Return a new surface using the specified render target.
*/
static SkSurface* NewRenderTargetDirect(GrRenderTarget*, const SkSurfaceProps*);
static SkSurface* NewRenderTargetDirect(GrRenderTarget* target) {
return NewRenderTargetDirect(target, NULL);
}
@ -95,7 +93,7 @@ public:
*/
static SkSurface* NewWrappedRenderTarget(GrContext*, GrBackendTextureDesc,
const SkSurfaceProps*);
/**
* Return a new surface whose contents will be drawn to an offscreen
* render target, allocated by the surface.

View File

@ -41,8 +41,6 @@ typedef uint32_t SkFontTableTag;
*/
class SK_API SkTypeface : public SkWeakRefCnt {
public:
SK_DECLARE_INST_COUNT(SkTypeface)
/** Style specifies the intrinsic style attributes of a given typeface
*/
enum Style {

View File

@ -51,8 +51,6 @@
*/
class SK_API SkWeakRefCnt : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkWeakRefCnt)
/** Default construct, initializing the reference counts to 1.
The strong references collectively hold one weak reference. When the
strong reference count goes to zero, the collectively held weak

View File

@ -31,8 +31,6 @@ class SkString;
*/
class SK_API SkXfermode : public SkFlattenable {
public:
SK_DECLARE_INST_COUNT(SkXfermode)
virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
const SkAlpha aa[]) const;
virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
@ -169,7 +167,7 @@ public:
/**
* Returns whether or not the xfer mode can support treating coverage as alpha
*/
*/
virtual bool supportsCoverageAsAlpha() const;
/**

View File

@ -15,8 +15,6 @@
class SK_API SkLayerDrawLooper : public SkDrawLooper {
public:
SK_DECLARE_INST_COUNT(SkLayerDrawLooper)
virtual ~SkLayerDrawLooper();
/**

View File

@ -19,8 +19,6 @@ struct GrContextOptions;
class GrShaderCaps : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrShaderCaps)
/** Info about shader variable precision within a given shader stage. That is, this info
is relevant to a float (or vecNf) variable declared with a GrSLPrecision
in a given GrShaderType. The info here is hoisted from the OpenGL spec. */
@ -108,7 +106,7 @@ private:
*/
class GrCaps : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrCaps)
GrCaps(const GrContextOptions&);

View File

@ -46,8 +46,6 @@ class GrSoftwarePathRenderer;
class SK_API GrContext : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrContext)
/**
* Creates a GrContext for a backend context.
*/
@ -90,7 +88,7 @@ public:
}
/**
* Abandons all GPU resources and assumes the underlying backend 3D API
* Abandons all GPU resources and assumes the underlying backend 3D API
* context is not longer usable. Call this if you have lost the associated
* GPU context, and thus internal texture, buffer, etc. references/IDs are
* now invalid. Should be called even when GrContext is no longer going to
@ -172,7 +170,7 @@ public:
int getRecommendedSampleCount(GrPixelConfig config, SkScalar dpi) const;
/**
* Returns a helper object to orchestrate draws.
* Returns a helper object to orchestrate draws.
* Callers should take a ref if they rely on the GrDrawContext sticking around.
* NULL will be returned if the context has been abandoned.
*
@ -181,7 +179,7 @@ public:
* @return a draw context
*/
GrDrawContext* drawContext(const SkSurfaceProps* surfaceProps = NULL) {
return fDrawingMgr.drawContext(surfaceProps);
return fDrawingMgr.drawContext(surfaceProps);
}
///////////////////////////////////////////////////////////////////////////
@ -211,7 +209,7 @@ public:
void flushIfNecessary() {
if (fFlushToReduceCacheSize) {
this->flush();
}
}
}
/**
@ -363,7 +361,7 @@ private:
GrResourceCache* fResourceCache;
// this union exists because the inheritance of GrTextureProvider->GrResourceProvider
// is in a private header.
union {
union {
GrResourceProvider* fResourceProvider;
GrTextureProvider* fTextureProvider;
};
@ -398,7 +396,7 @@ private:
// and hands the appropriate one back given the user's request.
// All of the GrDrawContexts still land in the same GrDrawTarget!
//
// In the future this class will allocate a new GrDrawContext for
// In the future this class will allocate a new GrDrawContext for
// each GrRenderTarget/GrDrawTarget and manage the DAG.
class DrawingMgr {
public:

View File

@ -40,8 +40,6 @@ class SkTextBlob;
*/
class SK_API GrDrawContext : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrDrawContext)
~GrDrawContext() override;
void copySurface(GrRenderTarget* dst, GrSurface* src,
@ -253,7 +251,7 @@ private:
const GrPaint* paint);
GrTextContext* createTextContext(GrRenderTarget*, const SkSurfaceProps&);
// A simpler version of the above which just returns true on success; false on failure.
// A simpler version of the above which just returns true on success; false on failure.
// Clip is *NOT* set
bool prepareToDraw(GrRenderTarget* rt);

View File

@ -11,7 +11,6 @@
#include "GrResourceKey.h"
#include "GrTypesPriv.h"
#include "SkData.h"
#include "SkInstCnt.h"
class GrContext;
class GrGpu;
@ -46,8 +45,6 @@ class GrResourceCache;
*/
template <typename DERIVED> class GrIORef : public SkNoncopyable {
public:
SK_DECLARE_INST_COUNT(GrIORef)
// Some of the signatures are written to mirror SkRefCnt so that GrGpuResource can work with
// templated helper classes (e.g. SkAutoTUnref). However, we have different categories of
// refs (e.g. pending reads). We also don't require thread safety as GrCacheable objects are
@ -59,7 +56,7 @@ public:
void unref() const {
this->validate();
if (!(--fRefCnt)) {
if (!static_cast<const DERIVED*>(this)->notifyRefCountIsZero()) {
return;
@ -141,7 +138,7 @@ private:
*/
class SK_API GrGpuResource : public GrIORef<GrGpuResource> {
public:
SK_DECLARE_INST_COUNT(GrGpuResource)
enum LifeCycle {
/**

View File

@ -36,8 +36,6 @@
*/
class GrGpuResourceRef : SkNoncopyable {
public:
SK_DECLARE_INST_COUNT(GrGpuResourceRef);
~GrGpuResourceRef();
GrGpuResource* getResource() const { return fResource; }

View File

@ -34,8 +34,6 @@ public:
kNoRestriction_StencilSupport,
};
SK_DECLARE_INST_COUNT(GrPathRendererChain)
GrPathRendererChain(GrContext* context);
~GrPathRendererChain();

View File

@ -57,8 +57,6 @@ private:
*/
class GrProcessor : public GrProgramElement {
public:
SK_DECLARE_INST_COUNT(GrProcessor)
virtual ~GrProcessor();
/** Human-meaningful string to identify this prcoessor; may be embedded

View File

@ -25,8 +25,6 @@ class GrGpuResourceRef;
*/
class GrProgramElement : public SkNoncopyable {
public:
SK_DECLARE_INST_COUNT(GrProgramElement)
virtual ~GrProgramElement() {
// fRefCnt can be one when an effect is created statically using GR_CREATE_STATIC_EFFECT
SkASSERT((0 == fRefCnt || 1 == fRefCnt) && 0 == fPendingExecutions);

View File

@ -23,8 +23,6 @@ class GrRenderTargetPriv;
*/
class GrRenderTarget : virtual public GrSurface {
public:
SK_DECLARE_INST_COUNT(GrRenderTarget)
// GrSurface overrides
GrRenderTarget* asRenderTarget() override { return this; }
const GrRenderTarget* asRenderTarget() const override { return this; }

View File

@ -20,8 +20,6 @@ class GrTexture;
class GrSurface : public GrGpuResource {
public:
SK_DECLARE_INST_COUNT(GrSurface);
/**
* Retrieves the width of the surface.
*/
@ -122,14 +120,14 @@ public:
* if the surface has MSAA it will be resolved.
*/
void prepareForExternalRead();
/** Access methods that are only to be used within Skia code. */
inline GrSurfacePriv surfacePriv();
inline const GrSurfacePriv surfacePriv() const;
typedef void* ReleaseCtx;
typedef void (*ReleaseProc)(ReleaseCtx);
void setRelease(ReleaseProc proc, ReleaseCtx ctx) {
fReleaseProc = proc;
fReleaseCtx = ctx;
@ -170,7 +168,7 @@ private:
fReleaseProc = NULL;
}
}
ReleaseProc fReleaseProc;
ReleaseCtx fReleaseCtx;

View File

@ -113,8 +113,6 @@ private:
*/
class GrTextureAccess : public SkNoncopyable {
public:
SK_DECLARE_INST_COUNT(GrTextureAccess);
/**
* A default GrTextureAccess must have reset() called on it in a GrProcessor subclass's
* constructor if it will be accessible via GrProcessor::textureAccess().

View File

@ -20,7 +20,6 @@
*/
class SK_API SkROLockPixelsPixelRef : public SkPixelRef {
public:
SK_DECLARE_INST_COUNT(SkROLockPixelsPixelRef)
SkROLockPixelsPixelRef(const SkImageInfo&);
virtual ~SkROLockPixelsPixelRef();
@ -39,7 +38,6 @@ private:
*/
class SK_API SkGrPixelRef : public SkROLockPixelsPixelRef {
public:
SK_DECLARE_INST_COUNT(SkGrPixelRef)
/**
* Constructs a pixel ref around a GrSurface.
*/

View File

@ -121,7 +121,7 @@ private:
typedef SkRefCnt INHERITED;
public:
SK_DECLARE_INST_COUNT(GrGLInterface)
GrGLInterface();

View File

@ -18,7 +18,7 @@
class SK_API SkGLContext : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkGLContext)
~SkGLContext() override;

View File

@ -17,7 +17,7 @@ class SkStreamRewindable;
class SkMovie : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkMovie)
/** Try to create a movie from the stream. If the stream format is not
supported, return NULL.

View File

@ -24,7 +24,7 @@ struct SkBaseMutex;
*/
class SK_API SkFontConfigInterface : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkFontConfigInterface)
/**
* Returns the global SkFontConfigInterface instance, and if it is not

View File

@ -19,7 +19,7 @@ class SkTypeface;
class SK_API SkFontStyleSet : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkFontStyleSet)
virtual int count() = 0;
virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0;
@ -36,7 +36,7 @@ class SkTypeface;
class SK_API SkFontMgr : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkFontMgr)
int countFamilies() const;
void getFamilyName(int index, SkString* familyName) const;

View File

@ -35,7 +35,7 @@ struct SK_API SkFontIdentity {
class SK_API SkRemotableFontIdentitySet : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkRemotableFontIdentitySet)
SkRemotableFontIdentitySet(int count, SkFontIdentity** data);
@ -57,7 +57,7 @@ private:
class SK_API SkRemotableFontMgr : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkRemotableFontMgr)
/**
* Returns the names of the known fonts on the system.

View File

@ -13,7 +13,7 @@
class SkBoundary : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkBoundary)
// These must be 0, 1, 2, 3 for efficiency in the subclass implementations
enum Edge {

View File

@ -57,7 +57,7 @@ public:
*/
class Dumper : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(Dumper)
virtual void dump(SkDumpCanvas*, SkDumpCanvas::Verb, const char str[],
const SkPaint*) = 0;

View File

@ -23,7 +23,7 @@ class SkCanvas;
class SkLayer : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkLayer)
SkLayer();
SkLayer(const SkLayer&);

View File

@ -21,7 +21,7 @@ struct SkTagList;
*/
class SkEventSink : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkEventSink)
SkEventSink();
virtual ~SkEventSink();

View File

@ -258,7 +258,7 @@ public:
*/
class Artist : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(Artist)
void draw(SkView*, SkCanvas*);
void inflate(const SkDOM&, const SkDOM::Node*);
@ -286,7 +286,7 @@ public:
*/
class Layout : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(Layout)
void layoutChildren(SkView* parent);
void inflate(const SkDOM&, const SkDOM::Node*);

View File

@ -289,7 +289,7 @@ private:
class SkListSource : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkListSource)
virtual int countFields();
virtual void getFieldName(int index, SkString* field);

View File

@ -68,7 +68,7 @@ public:
*/
class DeviceManager : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(DeviceManager)
virtual void setUpBackend(SampleWindow* win, int msaaSampleCount) = 0;

View File

@ -25,7 +25,7 @@
class SkAdvancedTypefaceMetrics : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkAdvancedTypefaceMetrics)
SkString fFontName;

View File

@ -37,7 +37,7 @@ public:
// Get the root bound.
virtual SkRect getRootBound() const = 0;
SK_DECLARE_INST_COUNT(SkBBoxHierarchy)
private:
typedef SkRefCnt INHERITED;
};

View File

@ -52,7 +52,7 @@ private:
class SkBitmapHeapReader : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkBitmapHeapReader)
SkBitmapHeapReader() : INHERITED() {}
virtual SkBitmap* getBitmap(int32_t slot) const = 0;
@ -69,7 +69,7 @@ class SkBitmapHeap : public SkBitmapHeapReader {
public:
class ExternalStorage : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(ExternalStorage)
virtual bool insert(const SkBitmap& bitmap, int32_t slot) = 0;

View File

@ -12,7 +12,7 @@
class SkDeviceProfile : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkDeviceProfile)
enum LCDConfig {
kNone_LCDConfig, // disables LCD text rendering, uses A8 instead

View File

@ -1,15 +0,0 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkInstCnt.h"
#if SK_ENABLE_INST_COUNT && !defined(SKIA_DLL) // See SkInstCnt.h
bool gPrintInstCount = false;
void SkInstCountPrintLeaksOnExit() { gPrintInstCount = true; }
#else
void SkInstCountPrintLeaksOnExit() {}
#endif

View File

@ -92,7 +92,7 @@ void SkTMaskGamma_build_correcting_lut(uint8_t table[256], U8CPU srcI, SkScalar
* @param B The number of luminance bits to use [1, 8] from the blue channel.
*/
template <int R_LUM_BITS, int G_LUM_BITS, int B_LUM_BITS> class SkTMaskGamma : public SkRefCnt {
SK_DECLARE_INST_COUNT(SkTMaskGamma)
public:
/** Creates a linear SkTMaskGamma. */

View File

@ -182,7 +182,7 @@ class SkFlatData;
class SkFlatController : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkFlatController)
SkFlatController(uint32_t writeBufferFlags = 0);
virtual ~SkFlatController();

View File

@ -22,7 +22,7 @@
*/
class SkPtrSet : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkPtrSet)
/**
* Search for the specified ptr in the set. If it is found, return its
@ -144,7 +144,7 @@ class SkFactorySet : public SkTPtrSet<SkFlattenable::Factory> {};
*/
class SkNamedFactorySet : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkNamedFactorySet)
SkNamedFactorySet();

View File

@ -31,7 +31,7 @@
*/
class SkRTree : public SkBBoxHierarchy {
public:
SK_DECLARE_INST_COUNT(SkRTree)
/**
* If you have some prior information about the distribution of bounds you're expecting, you

View File

@ -74,7 +74,7 @@ void SkResourceCache::init() {
class SkOneShotDiscardablePixelRef : public SkPixelRef {
public:
SK_DECLARE_INST_COUNT(SkOneShotDiscardablePixelRef)
// Ownership of the discardablememory is transfered to the pixelref
SkOneShotDiscardablePixelRef(const SkImageInfo&, SkDiscardableMemory*, size_t rowBytes);
~SkOneShotDiscardablePixelRef();

View File

@ -682,7 +682,7 @@ class GrGLLight;
class SkLight : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkLight)
enum LightType {
kDistant_LightType,

View File

@ -30,7 +30,7 @@ struct SkTestFontData {
class SkTestFont : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkTestFont)
SkTestFont(const SkTestFontData& );
virtual ~SkTestFont();

View File

@ -39,7 +39,7 @@ struct GrInitInvariantOutput;
class GrBatch : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrBatch)
GrBatch() : fClassID(kIllegalBatchClassID), fNumberOfDraws(0) { SkDEBUGCODE(fUsed = false;) }
virtual ~GrBatch() {}

View File

@ -33,7 +33,7 @@ static GrBatchAtlas::AtlasID create_id(int index, int generation) {
class BatchPlot : public SkRefCnt {
public:
typedef GrBatchAtlas::BatchToken BatchToken;
SK_DECLARE_INST_COUNT(BatchPlot);
SK_DECLARE_INTERNAL_LLIST_INTERFACE(BatchPlot);
// index() refers to the index of the plot in the owning GrAtlas's plot array. genID() is a

View File

@ -37,7 +37,7 @@ class GrPipeline;
class GrDrawTarget : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrDrawTarget)
typedef GrPathRange::PathIndexType PathIndexType;
typedef GrPathRendering::PathTransformType PathTransformType;

View File

@ -21,7 +21,7 @@ class SkPath;
*/
class GrFontDescKey : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrFontDescKey)
typedef uint32_t Hash;
@ -60,7 +60,7 @@ private:
*/
class GrFontScaler : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrFontScaler)
explicit GrFontScaler(SkGlyphCache* strike);
virtual ~GrFontScaler();

View File

@ -19,7 +19,7 @@ class GrGpu;
*/
class GrGeometryBuffer : public GrGpuResource {
public:
SK_DECLARE_INST_COUNT(GrGeometryBuffer);
/**
*Retrieves whether the buffer was created with the dynamic flag

View File

@ -15,7 +15,7 @@
class GrPath : public GrGpuResource {
public:
SK_DECLARE_INST_COUNT(GrPath);
/**
* Initialize to a path with a fixed stroke. Stroke must not be hairline.

View File

@ -23,7 +23,7 @@ class SkDescriptor;
class GrPathRange : public GrGpuResource {
public:
SK_DECLARE_INST_COUNT(GrPathRange);
enum PathIndexType {
kU8_PathIndexType, //!< uint8_t

View File

@ -30,7 +30,7 @@ struct GrPoint;
*/
class SK_API GrPathRenderer : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrPathRenderer)
/**
* This is called to install custom path renderers in every GrContext at create time. The

View File

@ -28,7 +28,7 @@ class GrPipelineBuilder;
*/
class GrPipeline {
public:
SK_DECLARE_INST_COUNT(GrPipeline)
GrPipeline(const GrPipelineBuilder&,
const GrProcOptInfo& colorPOI,

View File

@ -18,7 +18,7 @@ class GrResourceKey;
class GrStencilAttachment : public GrGpuResource {
public:
SK_DECLARE_INST_COUNT(GrStencilAttachment);
virtual ~GrStencilAttachment() {
// TODO: allow SB to be purged and detach itself from rts

View File

@ -26,7 +26,7 @@ class GrGLSLCaps;
*/
class GrGLCaps : public GrCaps {
public:
SK_DECLARE_INST_COUNT(GrGLCaps)
typedef GrGLStencilAttachment::Format StencilFormat;

View File

@ -20,7 +20,7 @@ namespace {
class BufferObj {
public:
SK_DECLARE_INST_COUNT(BufferObj);
BufferObj(GrGLuint id) : fID(id), fDataPtr(NULL), fSize(0), fMapped(false) {
}
@ -53,7 +53,7 @@ private:
// This class maintains a sparsely populated array of buffer pointers.
class BufferManager {
public:
SK_DECLARE_INST_COUNT(BufferManager);
BufferManager() : fFreeListHead(kFreeListEnd) {}
@ -122,7 +122,7 @@ private:
*/
struct ThreadContext {
public:
SK_DECLARE_INST_COUNT(ThreadContext);
BufferManager fBufferManager;
GrGLuint fCurrArrayBuffer;

View File

@ -22,7 +22,7 @@ SK_CONF_DECLARE(bool, c_DisplayCache, "gpu.displayCache", false,
typedef GrGLProgramDataManager::UniformHandle UniformHandle;
struct GrGLGpu::ProgramCache::Entry {
SK_DECLARE_INST_COUNT(Entry);
Entry() : fProgram(NULL), fLRUStamp(0) {}
SkAutoTUnref<GrGLProgram> fProgram;

View File

@ -34,7 +34,7 @@ class GrPipeline;
*/
class GrGLProgram : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrGLProgram)
typedef GrGLProgramBuilder::BuiltinUniformHandles BuiltinUniformHandles;

View File

@ -19,7 +19,7 @@ static SkNullGLContext::ContextState* current_context();
class BufferObj {
public:
SK_DECLARE_INST_COUNT(BufferObj);
BufferObj(GrGLuint id) : fID(id), fDataPtr(NULL), fSize(0), fMapped(false) {}
~BufferObj() { SkDELETE_ARRAY(fDataPtr); }
@ -51,7 +51,7 @@ private:
// This class maintains a sparsely populated array of buffer pointers.
class BufferManager {
public:
SK_DECLARE_INST_COUNT(BufferManager);
BufferManager() : fFreeListHead(kFreeListEnd) {}
@ -117,7 +117,7 @@ private:
*/
class SkNullGLContext::ContextState : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(ContextState);
BufferManager fBufferManager;
GrGLuint fCurrArrayBuffer;

View File

@ -781,7 +781,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetBufferParameteriv(GrGLenum target,
struct GrDebugGLInterface : public GrGLInterface {
public:
SK_DECLARE_INST_COUNT(GrDebugGLInterface)
GrDebugGLInterface()
: fWrapped(NULL) {

View File

@ -14,7 +14,7 @@
class GrGLSLCaps : public GrShaderCaps {
public:
SK_DECLARE_INST_COUNT(GrGLSLCaps)
/**
* Indicates how GLSL must interact with advanced blend equations. The KHR extension requires

View File

@ -17,7 +17,7 @@
class SkImage_Gpu : public SkImage_Base {
public:
SK_DECLARE_INST_COUNT(SkImage_Gpu)
/**
* An "image" can be a subset/window into a larger texture, so we explicit take the

View File

@ -16,7 +16,7 @@ class SkGpuDevice;
class SkSurface_Gpu : public SkSurface_Base {
public:
SK_DECLARE_INST_COUNT(SkSurface_Gpu)
SkSurface_Gpu(SkGpuDevice*);
virtual ~SkSurface_Gpu();

View File

@ -26,7 +26,7 @@ class SkColorTable;
*/
class SkCachingPixelRef : public SkPixelRef {
public:
SK_DECLARE_INST_COUNT(SkCachingPixelRef)
/**
* Takes ownership of SkImageGenerator. If this method fails for
* whatever reason, it will return false and immediatetely delete

View File

@ -20,7 +20,7 @@
*/
class SkDiscardablePixelRef : public SkPixelRef {
public:
SK_DECLARE_INST_COUNT(SkDiscardablePixelRef)
protected:
~SkDiscardablePixelRef();

View File

@ -78,7 +78,7 @@ private:
reference to each instantiated class.
*/
class SkPDFFont : public SkPDFDict {
SK_DECLARE_INST_COUNT(SkPDFFont)
public:
virtual ~SkPDFFont();

Some files were not shown because too many files have changed in this diff Show More