aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/gpu/vk/GrVkResource.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/gpu/vk/GrVkResource.h b/src/gpu/vk/GrVkResource.h
index fde3e37712..9d7212ed82 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;