Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(997)

Unified Diff: src/gpu/vk/GrVkResource.h

Issue 2128273002: Only check resource tracking on program shutdown, not context shutdown (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkBuffer.cpp ('k') | src/gpu/vk/GrVkResourceProvider.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkResource.h
diff --git a/src/gpu/vk/GrVkResource.h b/src/gpu/vk/GrVkResource.h
index d42ec70d765342b7d08876d4406f22187fcad4a4..3999749b6e8790898fda2fdba944c57385465e5b 100644
--- a/src/gpu/vk/GrVkResource.h
+++ b/src/gpu/vk/GrVkResource.h
@@ -40,7 +40,26 @@ public:
#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; }
- static SkTDynamicHash<GrVkResource, uint32_t> fTrace;
+
+ class Trace {
+ public:
+ ~Trace() {
+ if (fHash.count()) {
+ SkTDynamicHash<GrVkResource, uint32_t>::Iter iter(&fHash);
+ for (; !iter.done(); ++iter) {
+ (*iter).dumpInfo();
+ }
+ }
+ SkASSERT(0 == fHash.count());
+ }
+ void add(GrVkResource* r) { fHash.add(r); }
+ void remove(const GrVkResource* r) { fHash.remove(GetKey(*r)); }
+
+ private:
+ SkTDynamicHash<GrVkResource, uint32_t> fHash;
+ };
+ static Trace fTrace;
+
static SkRandom fRandom;
#endif
@@ -144,7 +163,7 @@ private:
void internal_dispose(const GrVkGpu* gpu) const {
this->freeGPUData(gpu);
#ifdef SK_TRACE_VK_RESOURCES
- fTrace.remove(GetKey(*this));
+ fTrace.remove(this);
#endif
SkASSERT(0 == fRefCnt);
fRefCnt = 1;
@@ -157,7 +176,7 @@ private:
void internal_dispose() const {
this->abandonSubResources();
#ifdef SK_TRACE_VK_RESOURCES
- fTrace.remove(GetKey(*this));
+ fTrace.remove(this);
#endif
SkASSERT(0 == fRefCnt);
fRefCnt = 1;
« no previous file with comments | « src/gpu/vk/GrVkBuffer.cpp ('k') | src/gpu/vk/GrVkResourceProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698