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>
This commit is contained in:
parent
77a86f81f3
commit
2a0daee1af
@ -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));
|
||||
|
@ -60,6 +60,10 @@ public:
|
||||
: SkArenaAlloc(block, kSize, extraSize)
|
||||
{}
|
||||
|
||||
SkArenaAlloc(size_t extraSize)
|
||||
: SkArenaAlloc(nullptr, 0, extraSize)
|
||||
{}
|
||||
|
||||
~SkArenaAlloc();
|
||||
|
||||
template <typename T, typename... Args>
|
||||
|
Loading…
Reference in New Issue
Block a user