Chromium Code Reviews| Index: src/gpu/vk/GrVkResource.h |
| diff --git a/src/gpu/vk/GrVkResource.h b/src/gpu/vk/GrVkResource.h |
| index fde3e377127b7a67a47ee654c860061bb0ca49d8..b93f4c43316ff3b4e19461fc143427a9451b8f90 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,28 @@ 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(); |
| - } |
| + if (fHashSet.count()) { |
|
mtklein
2016/07/29 14:33:19
No real need for this if?
egdaniel
2016/07/29 15:05:41
Ah right good catch. Gone.
|
| + fHashSet.foreach([](const GrVkResource* r) { |
| + r->dumpInfo(); |
| + }); |
| } |
| - SkASSERT(0 == fHash.count()); |
| + 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; |