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

Unified Diff: src/core/SkTDynamicHash.h

Issue 390103002: Replace use of GrTHashTable in GrFontCache with SkTDynamicHash. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add deleteAll() and freeAll() to SkTDynamicHash. Created 6 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/core/SkDescriptor.h ('k') | src/gpu/GrTextStrike.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTDynamicHash.h
diff --git a/src/core/SkTDynamicHash.h b/src/core/SkTDynamicHash.h
index 496dc8d1417e6872d29706f277928eb048a1c9fc..b578bfc647d34c45c3405ce9aa42af8d11187c15 100644
--- a/src/core/SkTDynamicHash.h
+++ b/src/core/SkTDynamicHash.h
@@ -135,6 +135,28 @@ public:
fArray = NULL;
}
+ void deleteAll() {
mtklein 2014/07/22 13:54:30 I think you can do both of these just as easily fr
jvanverth1 2014/07/22 14:14:07 Yup, just had that discussion here. Done.
+ int index = 0;
+ while (index < fCapacity) {
+ if (fArray[index] != Empty() && fArray[index] != Deleted()) {
+ SkDELETE(fArray[index]);
+ }
+ ++index;
+ }
+ this->reset();
+ }
+
+ void freeAll() {
+ int index = 0;
+ while (index < fCapacity) {
+ if (fArray[index] != Empty() && fArray[index] != Deleted()) {
+ sk_free(fArray[index]);
+ }
+ ++index;
+ }
+ this->reset();
+ }
+
protected:
// These methods are used by tests only.
« no previous file with comments | « src/core/SkDescriptor.h ('k') | src/gpu/GrTextStrike.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698