diff options
author | Herb Derby <herb@google.com> | 2017-01-20 16:58:06 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-23 19:07:01 +0000 |
commit | 2a0daee1afcaf781e1d7ca51656bc5edac3cfa9a (patch) | |
tree | 80d35371da0d8f5777a750e6bf41c1b198ef422f | |
parent | 77a86f81f39227ea53441af2afc647f589a96a0d (diff) |
Update SkTDict to use SkArenaAlloc.
Change-Id: I7ac33faa59bcad25b0580193af965a8525eb18e7
Reviewed-on: https://skia-review.googlesource.com/7360
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
-rw-r--r-- | include/private/SkTDict.h | 6 | ||||
-rw-r--r-- | src/core/SkArenaAlloc.h | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/include/private/SkTDict.h b/include/private/SkTDict.h index 106cace2f2..cd76e72999 100644 --- a/include/private/SkTDict.h +++ b/include/private/SkTDict.h @@ -8,7 +8,7 @@ #ifndef SkTDict_DEFINED #define SkTDict_DEFINED -#include "SkChunkAlloc.h" +#include "SkArenaAlloc.h" #include "SkTSearch.h" #include "SkTDArray.h" @@ -37,7 +37,7 @@ public: return false; } else { Pair* pair = fArray.insert(~index); - char* copy = (char*)fStrings.alloc(len + 1, SkChunkAlloc::kThrow_AllocFailType); + char* copy = fStrings.makeArrayDefault<char>(len + 1); memcpy(copy, name, len); copy[len] = '\0'; pair->fName = copy; @@ -123,7 +123,7 @@ public: private: SkTDArray<Pair> fArray; - SkChunkAlloc fStrings; + SkArenaAlloc fStrings; int find_index(const char name[]) const { return find_index(name, strlen(name)); diff --git a/src/core/SkArenaAlloc.h b/src/core/SkArenaAlloc.h index 7deac72bd8..532b45aa25 100644 --- a/src/core/SkArenaAlloc.h +++ b/src/core/SkArenaAlloc.h @@ -60,6 +60,10 @@ public: : SkArenaAlloc(block, kSize, extraSize) {} + SkArenaAlloc(size_t extraSize) + : SkArenaAlloc(nullptr, 0, extraSize) + {} + ~SkArenaAlloc(); template <typename T, typename... Args> |