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

Unified Diff: src/core/SkImageFilter.cpp

Issue 1537923002: Revert of Create a hash table from id<-->key in SkImageFilter::CacheImpl (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 | « include/core/SkImageFilter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageFilter.cpp
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 9bf9b28ab6cd9ca4a1be35add5113797f19bf9df..a3f89d08fad3fc4023c4ddc9805764a34972372e 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -18,7 +18,6 @@
#include "SkReadBuffer.h"
#include "SkRect.h"
#include "SkTDynamicHash.h"
-#include "SkTHash.h"
#include "SkTInternalLList.h"
#include "SkValidationUtils.h"
#include "SkWriteBuffer.h"
@@ -202,7 +201,6 @@
SkSafeUnref(fInputs[i]);
}
delete[] fInputs;
- Cache::Get()->purgeByImageFilterId(fUniqueID);
}
SkImageFilter::SkImageFilter(int inputCount, SkReadBuffer& buffer)
@@ -602,13 +600,6 @@
removeInternal(v);
}
Value* v = new Value(key, result, offset);
- if (SkTArray<Key>** array = fIdToKeys.find(key.fUniqueID)) {
- (*array)->push_back(key);
- } else {
- SkTArray<Key>* keyArray = new SkTArray<Key>();
- keyArray->push_back(key);
- fIdToKeys.set(key.fUniqueID, keyArray);
- }
fLookup.add(v);
fLRU.addToHead(v);
fCurrentBytes += result.getSize();
@@ -631,19 +622,6 @@
}
}
- void purgeByImageFilterId(uint32_t uniqueID) override {
- SkAutoMutexAcquire mutex(fMutex);
- if (SkTArray<Key>** array = fIdToKeys.find(uniqueID)) {
- for (auto& key : **array) {
- if (Value* v = fLookup.find(key)) {
- this->removeInternal(v);
- }
- }
- fIdToKeys.remove(uniqueID);
- delete *array; // This can be deleted outside the lock
- }
- }
-
private:
void removeInternal(Value* v) {
fCurrentBytes -= v->fBitmap.getSize();
@@ -652,12 +630,11 @@
delete v;
}
private:
- SkTDynamicHash<Value, Key> fLookup;
- SkTHashMap<uint32_t, SkTArray<Key>*> fIdToKeys;
- mutable SkTInternalLList<Value> fLRU;
- size_t fMaxBytes;
- size_t fCurrentBytes;
- mutable SkMutex fMutex;
+ SkTDynamicHash<Value, Key> fLookup;
+ mutable SkTInternalLList<Value> fLRU;
+ size_t fMaxBytes;
+ size_t fCurrentBytes;
+ mutable SkMutex fMutex;
};
} // namespace
« no previous file with comments | « include/core/SkImageFilter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698