| Index: src/gpu/vk/GrVkResource.h
|
| diff --git a/src/gpu/vk/GrVkResource.h b/src/gpu/vk/GrVkResource.h
|
| index fde3e377127b7a67a47ee654c860061bb0ca49d8..3bb5ff777de5507a075ba43dc4992d6676f81984 100644
|
| --- a/src/gpu/vk/GrVkResource.h
|
| +++ b/src/gpu/vk/GrVkResource.h
|
| @@ -9,8 +9,8 @@
|
| #define GrVkResource_DEFINED
|
|
|
| #include "SkAtomics.h"
|
| -#include "SkTDynamicHash.h"
|
| #include "SkRandom.h"
|
| +#include "SkTHash.h"
|
|
|
| class GrVkGpu;
|
|
|
| @@ -38,25 +38,26 @@ class GrVkResource : SkNoncopyable {
|
| public:
|
| // Simple refCount tracing, to ensure that everything ref'ed is unref'ed.
|
| #ifdef SK_TRACE_VK_RESOURCES
|
| - static const uint32_t& GetKey(const GrVkResource& r) { return r.fKey; }
|
| - static uint32_t Hash(const uint32_t& k) { return k; }
|
| + struct Hash {
|
| + uint32_t operator()(const GrVkResource* const& r) const {
|
| + SkASSERT(r);
|
| + return r->fKey;
|
| + }
|
| + };
|
|
|
| class Trace {
|
| public:
|
| ~Trace() {
|
| - if (fHash.count()) {
|
| - SkTDynamicHash<GrVkResource, uint32_t>::Iter iter(&fHash);
|
| - for (; !iter.done(); ++iter) {
|
| - (*iter).dumpInfo();
|
| - }
|
| - }
|
| - SkASSERT(0 == fHash.count());
|
| + fHashSet.foreach([](const GrVkResource* r) {
|
| + r->dumpInfo();
|
| + });
|
| + SkASSERT(0 == fHashSet.count());
|
| }
|
| - void add(GrVkResource* r) { fHash.add(r); }
|
| - void remove(const GrVkResource* r) { fHash.remove(GetKey(*r)); }
|
| + void add(const GrVkResource* r) { fHashSet.add(r); }
|
| + void remove(const GrVkResource* r) { fHashSet.remove(r); }
|
|
|
| private:
|
| - SkTDynamicHash<GrVkResource, uint32_t> fHash;
|
| + SkTHashSet<const GrVkResource*, GrVkResource::Hash> fHashSet;
|
| };
|
| static Trace fTrace;
|
|
|
|
|