aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2016-08-05 06:51:50 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-05 06:51:50 -0700
commitfeb3c1a57faee39dc10ac904f6b215ba50e286b4 (patch)
treec861461ccc43d19a3b19fe7482c5e0381baccb5a /include
parent4c35a3f905670873b3174c5e6c9279677b4f9d54 (diff)
Move to SkDataTable::MakeXXX and sk_sp.
Change SkDataTable::NewXXX to SkDataTable::MakeXXX and return sk_sp. This updates users of SkDataTable to sk_sp as well. There do not appear to be any external users of these methods. Review-Url: https://codereview.chromium.org/2211143002
Diffstat (limited to 'include')
-rw-r--r--include/core/SkDataTable.h15
-rw-r--r--include/ports/SkFontConfigInterface.h2
-rw-r--r--include/ports/SkFontMgr_indirect.h2
-rw-r--r--include/ports/SkRemotableFontMgr.h4
4 files changed, 10 insertions, 13 deletions
diff --git a/include/core/SkDataTable.h b/include/core/SkDataTable.h
index c9d915d255..2ec2d0f2e2 100644
--- a/include/core/SkDataTable.h
+++ b/include/core/SkDataTable.h
@@ -63,7 +63,7 @@ public:
typedef void (*FreeProc)(void* context);
- static SkDataTable* NewEmpty();
+ static sk_sp<SkDataTable> MakeEmpty();
/**
* Return a new DataTable that contains a copy of the data stored in each
@@ -74,8 +74,8 @@ public:
* ptrs[] array.
* @param count the number of array elements in ptrs[] and sizes[] to copy.
*/
- static SkDataTable* NewCopyArrays(const void * const * ptrs,
- const size_t sizes[], int count);
+ static sk_sp<SkDataTable> MakeCopyArrays(const void * const * ptrs,
+ const size_t sizes[], int count);
/**
* Return a new table that contains a copy of the data in array.
@@ -85,11 +85,10 @@ public:
* @param count the number of entries to be copied out of array. The number
* of bytes that will be copied is count * elemSize.
*/
- static SkDataTable* NewCopyArray(const void* array, size_t elemSize,
- int count);
+ static sk_sp<SkDataTable> MakeCopyArray(const void* array, size_t elemSize, int count);
- static SkDataTable* NewArrayProc(const void* array, size_t elemSize,
- int count, FreeProc proc, void* context);
+ static sk_sp<SkDataTable> MakeArrayProc(const void* array, size_t elemSize, int count,
+ FreeProc proc, void* context);
private:
struct Dir {
@@ -164,7 +163,7 @@ public:
* calls to append(). This call also clears any accumluated entries from
* this builder, so its count() will be 0 after this call.
*/
- SkDataTable* detachDataTable();
+ sk_sp<SkDataTable> detachDataTable();
private:
SkTDArray<SkDataTable::Dir> fDir;
diff --git a/include/ports/SkFontConfigInterface.h b/include/ports/SkFontConfigInterface.h
index 536768a8bf..30fc8a35fb 100644
--- a/include/ports/SkFontConfigInterface.h
+++ b/include/ports/SkFontConfigInterface.h
@@ -111,7 +111,7 @@ public:
// New APIS, which have default impls for now (which do nothing)
- virtual SkDataTable* getFamilyNames() { return SkDataTable::NewEmpty(); }
+ virtual sk_sp<SkDataTable> getFamilyNames() { return SkDataTable::MakeEmpty(); }
typedef SkRefCnt INHERITED;
};
diff --git a/include/ports/SkFontMgr_indirect.h b/include/ports/SkFontMgr_indirect.h
index d3f47cb82b..406a75a7ee 100644
--- a/include/ports/SkFontMgr_indirect.h
+++ b/include/ports/SkFontMgr_indirect.h
@@ -95,7 +95,7 @@ private:
mutable SkTArray<DataEntry> fDataCache;
mutable SkMutex fDataCacheMutex;
- mutable SkAutoTUnref<SkDataTable> fFamilyNames;
+ mutable sk_sp<SkDataTable> fFamilyNames;
mutable SkOnce fFamilyNamesInitOnce;
static void set_up_family_names(const SkFontMgr_Indirect* self);
diff --git a/include/ports/SkRemotableFontMgr.h b/include/ports/SkRemotableFontMgr.h
index ddc8e50a12..2e028cee26 100644
--- a/include/ports/SkRemotableFontMgr.h
+++ b/include/ports/SkRemotableFontMgr.h
@@ -61,10 +61,8 @@ public:
*
* The indexes may be used with getIndex(int) and
* matchIndexStyle(int, SkFontStyle).
- *
- * The caller must unref() the returned object.
*/
- virtual SkDataTable* getFamilyNames() const = 0;
+ virtual sk_sp<SkDataTable> getFamilyNames() const = 0;
/**
* Returns all of the fonts with the given familyIndex.