aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2016-10-27 09:30:08 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-10-27 09:30:08 -0700
commit6bd5284415bd983b0628c4941dff5def40018f5a (patch)
tree7de7e45431f76db69807204ecdce3ed6fcc4d9e8 /include
parent56380524d903f27627a75e2e1189463999725008 (diff)
Remove SkAutoTUnref and SkAutoTDelete from public includes.
This also makes the required changed to src, tests, and tools. The few public APIs modified by this change appear to be unused outside of Skia. Removing these from the public API makes it easier to ensure users are no longer using them. This also updates GrGpu::wrapBackendXXX and the ::onWrapBackendXXX methods to clarify ownership. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2448593002 Review-Url: https://codereview.chromium.org/2448593002
Diffstat (limited to 'include')
-rw-r--r--include/codec/SkAndroidCodec.h2
-rw-r--r--include/codec/SkCodec.h2
-rw-r--r--include/core/SkCanvas.h10
-rw-r--r--include/core/SkPath.h2
-rw-r--r--include/core/SkPathRef.h10
-rw-r--r--include/core/SkPictureRecorder.h14
-rw-r--r--include/core/SkWriteBuffer.h8
-rw-r--r--include/gpu/GrCaps.h4
-rw-r--r--include/gpu/GrContext.h18
-rw-r--r--include/gpu/GrGpuResource.h2
-rw-r--r--include/gpu/GrGpuResourceRef.h2
-rw-r--r--include/gpu/GrTextureProvider.h6
-rw-r--r--include/gpu/GrXferProcessor.h11
-rw-r--r--include/gpu/gl/GrGLExtensions.h2
-rw-r--r--include/gpu/vk/GrVkBackendContext.h18
-rw-r--r--include/ports/SkFontMgr_indirect.h8
-rw-r--r--include/ports/SkTypeface_win.h2
-rw-r--r--include/private/GrAuditTrail.h6
-rw-r--r--include/private/SkMiniRecorder.h2
-rw-r--r--include/views/SkOSWindow_Win.h10
-rw-r--r--include/xml/SkDOM.h6
21 files changed, 68 insertions, 77 deletions
diff --git a/include/codec/SkAndroidCodec.h b/include/codec/SkAndroidCodec.h
index c7587b62e9..07d1b135aa 100644
--- a/include/codec/SkAndroidCodec.h
+++ b/include/codec/SkAndroidCodec.h
@@ -260,6 +260,6 @@ private:
// embedded SkCodec.
const SkImageInfo& fInfo;
- SkAutoTDelete<SkCodec> fCodec;
+ std::unique_ptr<SkCodec> fCodec;
};
#endif // SkAndroidCodec_DEFINED
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h
index a97a79c4bb..368d5e37b3 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -775,7 +775,7 @@ protected:
private:
const SkEncodedInfo fEncodedInfo;
const SkImageInfo fSrcInfo;
- SkAutoTDelete<SkStream> fStream;
+ std::unique_ptr<SkStream> fStream;
bool fNeedsRewind;
const Origin fOrigin;
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 5b30a08772..b323b2af8e 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -1357,7 +1357,7 @@ public:
* @return the current clip stack ("list" of individual clip elements)
*/
const SkClipStack* getClipStack() const {
- return fClipStack;
+ return fClipStack.get();
}
typedef SkCanvasClipVisitor ClipVisitor;
@@ -1516,12 +1516,6 @@ protected:
const SkShadowParams& params);
#endif
- // Returns the canvas to be used by DrawIter. Default implementation
- // returns this. Subclasses that encapsulate an indirect canvas may
- // need to overload this method. The impl must keep track of this, as it
- // is not released or deleted by the caller.
- virtual SkCanvas* canvasForDrawIter();
-
// Clip rectangle bounds. Called internally by saveLayer.
// returns false if the entire rectangle is entirely clipped out
// If non-NULL, The imageFilter parameter will be used to expand the clip
@@ -1592,7 +1586,7 @@ private:
class MCRec;
- SkAutoTUnref<SkClipStack> fClipStack;
+ sk_sp<SkClipStack> fClipStack;
SkDeque fMCStack;
// points to top of stack
MCRec* fMCRec;
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index d1af4f31b6..46cb15c785 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -1121,7 +1121,7 @@ private:
kCurrent_Version = 2
};
- SkAutoTUnref<SkPathRef> fPathRef;
+ sk_sp<SkPathRef> fPathRef;
int fLastMoveToIndex;
uint8_t fFillType;
mutable uint8_t fConvexity;
diff --git a/include/core/SkPathRef.h b/include/core/SkPathRef.h
index 9b15c3e4f2..5e6fda7d85 100644
--- a/include/core/SkPathRef.h
+++ b/include/core/SkPathRef.h
@@ -26,8 +26,8 @@ class SkWBuffer;
* modify the contents. To modify or append to the verbs/points wrap the SkPathRef in an
* SkPathRef::Editor object. Installing the editor resets the generation ID. It also performs
* copy-on-write if the SkPathRef is shared by multiple SkPaths. The caller passes the Editor's
- * constructor a SkAutoTUnref, which may be updated to point to a new SkPathRef after the editor's
- * constructor returns.
+ * constructor a pointer to a sk_sp<SkPathRef>, which may be updated to point to a new SkPathRef
+ * after the editor's constructor returns.
*
* The points and verbs are stored in a single allocation. The points are at the begining of the
* allocation while the verbs are stored at end of the allocation, in reverse order. Thus the points
@@ -40,7 +40,7 @@ class SK_API SkPathRef final : public SkNVRefCnt<SkPathRef> {
public:
class Editor {
public:
- Editor(SkAutoTUnref<SkPathRef>* pathRef,
+ Editor(sk_sp<SkPathRef>* pathRef,
int incReserveVerbs = 0,
int incReservePoints = 0);
@@ -230,7 +230,7 @@ public:
/**
* Transforms a path ref by a matrix, allocating a new one only if necessary.
*/
- static void CreateTransformedCopy(SkAutoTUnref<SkPathRef>* dst,
+ static void CreateTransformedCopy(sk_sp<SkPathRef>* dst,
const SkPathRef& src,
const SkMatrix& matrix);
@@ -241,7 +241,7 @@ public:
* repopulated with approximately the same number of verbs and points. A new path ref is created
* only if necessary.
*/
- static void Rewind(SkAutoTUnref<SkPathRef>* pathRef);
+ static void Rewind(sk_sp<SkPathRef>* pathRef);
~SkPathRef();
int countPoints() const { SkDEBUGCODE(this->validate();) return fPointCnt; }
diff --git a/include/core/SkPictureRecorder.h b/include/core/SkPictureRecorder.h
index c824189300..890e7ca213 100644
--- a/include/core/SkPictureRecorder.h
+++ b/include/core/SkPictureRecorder.h
@@ -124,13 +124,13 @@ private:
friend class SkPictureRecorderReplayTester; // for unit testing
void partialReplay(SkCanvas* canvas) const;
- bool fActivelyRecording;
- uint32_t fFlags;
- SkRect fCullRect;
- SkAutoTUnref<SkBBoxHierarchy> fBBH;
- SkAutoTUnref<SkRecorder> fRecorder;
- SkAutoTUnref<SkRecord> fRecord;
- SkMiniRecorder fMiniRecorder;
+ bool fActivelyRecording;
+ uint32_t fFlags;
+ SkRect fCullRect;
+ sk_sp<SkBBoxHierarchy> fBBH;
+ sk_sp<SkRecorder> fRecorder;
+ sk_sp<SkRecord> fRecord;
+ SkMiniRecorder fMiniRecorder;
typedef SkNoncopyable INHERITED;
};
diff --git a/include/core/SkWriteBuffer.h b/include/core/SkWriteBuffer.h
index 29f923fedd..a104ffcb1f 100644
--- a/include/core/SkWriteBuffer.h
+++ b/include/core/SkWriteBuffer.h
@@ -134,12 +134,10 @@ public:
* Set an SkPixelSerializer to store an encoded representation of pixels,
* e.g. SkBitmaps.
*
- * Calls ref() on the serializer.
- *
* TODO: Encode SkImage pixels as well.
*/
- void setPixelSerializer(SkPixelSerializer*);
- SkPixelSerializer* getPixelSerializer() const { return fPixelSerializer; }
+ void setPixelSerializer(sk_sp<SkPixelSerializer>);
+ SkPixelSerializer* getPixelSerializer() const { return fPixelSerializer.get(); }
private:
const uint32_t fFlags;
@@ -148,7 +146,7 @@ private:
SkRefCntSet* fTFSet;
- SkAutoTUnref<SkPixelSerializer> fPixelSerializer;
+ sk_sp<SkPixelSerializer> fPixelSerializer;
// Only used if we do not have an fFactorySet
SkTHashMap<SkString, uint32_t> fFlattenableDict;
diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h
index a97be72c3f..204cfc98cb 100644
--- a/include/gpu/GrCaps.h
+++ b/include/gpu/GrCaps.h
@@ -133,7 +133,7 @@ public:
virtual SkString dump() const;
- GrShaderCaps* shaderCaps() const { return fShaderCaps; }
+ GrShaderCaps* shaderCaps() const { return fShaderCaps.get(); }
bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; }
/** To avoid as-yet-unnecessary complexity we don't allow any partial support of MIP Maps (e.g.
@@ -294,7 +294,7 @@ protected:
expand them. */
void applyOptionsOverrides(const GrContextOptions& options);
- SkAutoTUnref<GrShaderCaps> fShaderCaps;
+ sk_sp<GrShaderCaps> fShaderCaps;
bool fNPOTTextureTileSupport : 1;
bool fMipMapSupport : 1;
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 996b77f2db..8e5781100e 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -60,7 +60,7 @@ public:
virtual ~GrContext();
- GrContextThreadSafeProxy* threadSafeProxy();
+ sk_sp<GrContextThreadSafeProxy> threadSafeProxy();
/**
* The GrContext normally assumes that no outsider is setting state
@@ -327,7 +327,7 @@ public:
GrGpu* getGpu() { return fGpu; }
const GrGpu* getGpu() const { return fGpu; }
GrBatchFontCache* getBatchFontCache() { return fBatchFontCache; }
- GrTextBlobCache* getTextBlobCache() { return fTextBlobCache; }
+ GrTextBlobCache* getTextBlobCache() { return fTextBlobCache.get(); }
bool abandoned() const;
GrResourceProvider* resourceProvider() { return fResourceProvider; }
const GrResourceProvider* resourceProvider() const { return fResourceProvider; }
@@ -383,10 +383,10 @@ private:
GrTextureProvider* fTextureProvider;
};
- SkAutoTUnref<GrContextThreadSafeProxy> fThreadSafeProxy;
+ sk_sp<GrContextThreadSafeProxy> fThreadSafeProxy;
GrBatchFontCache* fBatchFontCache;
- SkAutoTDelete<GrTextBlobCache> fTextBlobCache;
+ std::unique_ptr<GrTextBlobCache> fTextBlobCache;
bool fDidTestPMConversions;
int fPMToUPMConversion;
@@ -418,7 +418,7 @@ private:
const uint32_t fUniqueID;
- SkAutoTDelete<GrDrawingManager> fDrawingManager;
+ std::unique_ptr<GrDrawingManager> fDrawingManager;
GrAuditTrail fAuditTrail;
@@ -463,12 +463,12 @@ private:
*/
class GrContextThreadSafeProxy : public SkRefCnt {
private:
- GrContextThreadSafeProxy(const GrCaps* caps, uint32_t uniqueID)
- : fCaps(SkRef(caps))
+ GrContextThreadSafeProxy(sk_sp<const GrCaps> caps, uint32_t uniqueID)
+ : fCaps(std::move(caps))
, fContextUniqueID(uniqueID) {}
- SkAutoTUnref<const GrCaps> fCaps;
- uint32_t fContextUniqueID;
+ sk_sp<const GrCaps> fCaps;
+ uint32_t fContextUniqueID;
friend class GrContext;
friend class SkImage;
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
index d3cfa86086..5f5ccbf8ee 100644
--- a/include/gpu/GrGpuResource.h
+++ b/include/gpu/GrGpuResource.h
@@ -46,7 +46,7 @@ class SkTraceMemoryDump;
template <typename DERIVED> class GrIORef : public SkNoncopyable {
public:
// 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
+ // templated helper classes (e.g. sk_sp). However, we have different categories of
// refs (e.g. pending reads). We also don't require thread safety as GrCacheable objects are
// not intended to cross thread boundaries.
void ref() const {
diff --git a/include/gpu/GrGpuResourceRef.h b/include/gpu/GrGpuResourceRef.h
index 13adbee242..a91dcfeed5 100644
--- a/include/gpu/GrGpuResourceRef.h
+++ b/include/gpu/GrGpuResourceRef.h
@@ -28,7 +28,7 @@
* state 2 to state 3. Calling pendingIOComplete() moves from state 2 to state 1. There is no
* valid way of going from state 3 back to 2 or 1.
*
- * Like SkAutoTUnref, its constructor and setter adopt a ref from their caller.
+ * Like sk_sp, its constructor and setter adopt a ref from their caller.
*
* TODO: Once GrDODrawState no longer exists and therefore GrDrawState and GrOptDrawState no
* longer share an instance of this class, attempt to make the resource owned by GrGpuResourceRef
diff --git a/include/gpu/GrTextureProvider.h b/include/gpu/GrTextureProvider.h
index e013bfff0f..efecc96358 100644
--- a/include/gpu/GrTextureProvider.h
+++ b/include/gpu/GrTextureProvider.h
@@ -98,8 +98,8 @@ public:
*
* @return GrTexture object or NULL on failure.
*/
- GrTexture* wrapBackendTexture(const GrBackendTextureDesc& desc,
- GrWrapOwnership = kBorrow_GrWrapOwnership);
+ sk_sp<GrTexture> wrapBackendTexture(const GrBackendTextureDesc& desc,
+ GrWrapOwnership = kBorrow_GrWrapOwnership);
/**
* Wraps an existing render target with a GrRenderTarget object. It is
@@ -110,7 +110,7 @@ public:
*
* @return GrRenderTarget object or NULL on failure.
*/
- GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc);
+ sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc);
protected:
GrTextureProvider(GrGpu* gpu, GrResourceCache* cache, GrSingleOwner* singleOwner);
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h
index 1d4717e156..5317c187e2 100644
--- a/include/gpu/GrXferProcessor.h
+++ b/include/gpu/GrXferProcessor.h
@@ -70,7 +70,7 @@ public:
}
DstTexture& operator=(const DstTexture& other) {
- fTexture.reset(SkSafeRef(other.fTexture.get()));
+ fTexture = other.fTexture;
fOffset = other.fOffset;
return *this;
}
@@ -82,14 +82,13 @@ public:
GrTexture* texture() const { return fTexture.get(); }
- GrTexture* setTexture(GrTexture* texture) {
- fTexture.reset(SkSafeRef(texture));
- return texture;
+ void setTexture(sk_sp<GrTexture> texture) {
+ fTexture = std::move(texture);
}
private:
- SkAutoTUnref<GrTexture> fTexture;
- SkIPoint fOffset;
+ sk_sp<GrTexture> fTexture;
+ SkIPoint fOffset;
};
/**
diff --git a/include/gpu/gl/GrGLExtensions.h b/include/gpu/gl/GrGLExtensions.h
index dd088de671..faf73fd36c 100644
--- a/include/gpu/gl/GrGLExtensions.h
+++ b/include/gpu/gl/GrGLExtensions.h
@@ -68,7 +68,7 @@ public:
private:
bool fInitialized;
- SkAutoTDelete<SkTArray<SkString> > fStrings;
+ std::unique_ptr<SkTArray<SkString>> fStrings;
};
#endif
diff --git a/include/gpu/vk/GrVkBackendContext.h b/include/gpu/vk/GrVkBackendContext.h
index 9942016927..5e51beea6b 100644
--- a/include/gpu/vk/GrVkBackendContext.h
+++ b/include/gpu/vk/GrVkBackendContext.h
@@ -37,15 +37,15 @@ enum GrVkFeatureFlags {
// creation, and any GrBackendObjects handed to us (e.g., for wrapped textures) need to be created
// in or transitioned to that family.
struct GrVkBackendContext : public SkRefCnt {
- VkInstance fInstance;
- VkPhysicalDevice fPhysicalDevice;
- VkDevice fDevice;
- VkQueue fQueue;
- uint32_t fGraphicsQueueIndex;
- uint32_t fMinAPIVersion;
- uint32_t fExtensions;
- uint32_t fFeatures;
- SkAutoTUnref<const GrVkInterface> fInterface;
+ VkInstance fInstance;
+ VkPhysicalDevice fPhysicalDevice;
+ VkDevice fDevice;
+ VkQueue fQueue;
+ uint32_t fGraphicsQueueIndex;
+ uint32_t fMinAPIVersion;
+ uint32_t fExtensions;
+ uint32_t fFeatures;
+ sk_sp<const GrVkInterface> fInterface;
using CanPresentFn = std::function<bool(VkInstance, VkPhysicalDevice,
uint32_t queueFamilyIndex)>;
diff --git a/include/ports/SkFontMgr_indirect.h b/include/ports/SkFontMgr_indirect.h
index 406a75a7ee..6c258c851d 100644
--- a/include/ports/SkFontMgr_indirect.h
+++ b/include/ports/SkFontMgr_indirect.h
@@ -28,8 +28,8 @@ public:
// TODO: The SkFontMgr is only used for createFromStream/File/Data.
// In the future these calls should be broken out into their own interface
// with a name like SkFontRenderer.
- SkFontMgr_Indirect(SkFontMgr* impl, SkRemotableFontMgr* proxy)
- : fImpl(SkRef(impl)), fProxy(SkRef(proxy))
+ SkFontMgr_Indirect(sk_sp<SkFontMgr> impl, sk_sp<SkRemotableFontMgr> proxy)
+ : fImpl(std::move(impl)), fProxy(std::move(proxy))
{ }
protected:
@@ -60,8 +60,8 @@ protected:
private:
SkTypeface* createTypefaceFromFontId(const SkFontIdentity& fontId) const;
- SkAutoTUnref<SkFontMgr> fImpl;
- SkAutoTUnref<SkRemotableFontMgr> fProxy;
+ sk_sp<SkFontMgr> fImpl;
+ sk_sp<SkRemotableFontMgr> fProxy;
struct DataEntry {
uint32_t fDataId; // key1
diff --git a/include/ports/SkTypeface_win.h b/include/ports/SkTypeface_win.h
index 1945b755e7..f3a881f3cc 100644
--- a/include/ports/SkTypeface_win.h
+++ b/include/ports/SkTypeface_win.h
@@ -57,7 +57,7 @@ SK_API SkFontMgr* SkFontMgr_New_DirectWrite(IDWriteFactory* factory,
*
* If DirectWrite could not be initialized, will return NULL.
*/
-SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr*);
+SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(sk_sp<SkRemotableFontMgr>);
/**
* Creates an SkRemotableFontMgr backed by DirectWrite using the default
diff --git a/include/private/GrAuditTrail.h b/include/private/GrAuditTrail.h
index 3bb7bea435..b39f13f362 100644
--- a/include/private/GrAuditTrail.h
+++ b/include/private/GrAuditTrail.h
@@ -134,7 +134,7 @@ private:
int fBatchListID;
int fChildID;
};
- typedef SkTArray<SkAutoTDelete<Batch>, true> BatchPool;
+ typedef SkTArray<std::unique_ptr<Batch>, true> BatchPool;
typedef SkTArray<Batch*> Batches;
@@ -144,14 +144,14 @@ private:
Batches fChildren;
uint32_t fRenderTargetUniqueID;
};
- typedef SkTArray<SkAutoTDelete<BatchNode>, true> BatchList;
+ typedef SkTArray<std::unique_ptr<BatchNode>, true> BatchList;
void copyOutFromBatchList(BatchInfo* outBatchInfo, int batchListID);
template <typename T>
static void JsonifyTArray(SkString* json, const char* name, const T& array,
bool addComma);
-
+
BatchPool fBatchPool;
SkTHashMap<uint32_t, int> fIDLookup;
SkTHashMap<int, Batches*> fClientIDLookup;
diff --git a/include/private/SkMiniRecorder.h b/include/private/SkMiniRecorder.h
index 6365ebc65b..06b35ca714 100644
--- a/include/private/SkMiniRecorder.h
+++ b/include/private/SkMiniRecorder.h
@@ -29,7 +29,7 @@ public:
// Flush anything we've recorded to the canvas, resetting this SkMiniRecorder.
// This is logically the same as but rather more efficient than:
- // SkAutoTUnref<SkPicture> pic(this->detachAsPicture(SkRect::MakeEmpty()));
+ // sk_sp<SkPicture> pic(this->detachAsPicture(SkRect::MakeEmpty()));
// pic->playback(canvas);
void flushAndReset(SkCanvas*);
diff --git a/include/views/SkOSWindow_Win.h b/include/views/SkOSWindow_Win.h
index 7ed22a6514..774244400c 100644
--- a/include/views/SkOSWindow_Win.h
+++ b/include/views/SkOSWindow_Win.h
@@ -91,11 +91,11 @@ private:
#if SK_SUPPORT_GPU
void* fHGLRC;
#if SK_ANGLE
- EGLDisplay fDisplay;
- EGLContext fContext;
- EGLSurface fSurface;
- EGLConfig fConfig;
- SkAutoTUnref<const GrGLInterface> fANGLEInterface;
+ EGLDisplay fDisplay;
+ EGLContext fContext;
+ EGLSurface fSurface;
+ EGLConfig fConfig;
+ sk_sp<const GrGLInterface> fANGLEInterface;
#endif // SK_ANGLE
#endif // SK_SUPPORT_GPU
diff --git a/include/xml/SkDOM.h b/include/xml/SkDOM.h
index b6f611af6e..c40f4bd522 100644
--- a/include/xml/SkDOM.h
+++ b/include/xml/SkDOM.h
@@ -89,9 +89,9 @@ public:
SkDEBUGCODE(void dump(const Node* node = NULL, int tabLevel = 0) const;)
private:
- SkChunkAlloc fAlloc;
- Node* fRoot;
- SkAutoTDelete<SkDOMParser> fParser;
+ SkChunkAlloc fAlloc;
+ Node* fRoot;
+ std::unique_ptr<SkDOMParser> fParser;
typedef SkNoncopyable INHERITED;
};