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

Unified Diff: src/core/SkTHashCache.h

Issue 395203002: Revert of Reopened: Caching the result of readPixelsSupported (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « gyp/tests.gypi ('k') | src/gpu/gl/GrGLCaps.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTHashCache.h
diff --git a/src/core/SkTHashCache.h b/src/core/SkTHashCache.h
deleted file mode 100644
index cfee9722f2ea1c4e7366444dbf5a0b167291c833..0000000000000000000000000000000000000000
--- a/src/core/SkTHashCache.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkTHASHCACHE_DEFINED
-#define SkTHASHCACHE_DEFINED
-
-#include "SkTypes.h"
-#include "SkTDynamicHash.h"
-
-template <typename T,
-typename Key,
-typename Traits = T,
-int kGrowPercent = 75 >
-class SkTHashCache : public SkNoncopyable {
-public:
-
- SkTHashCache() {
- this->reset();
- }
-
- ~SkTHashCache() {
- this->clear();
- }
-
- T* find(const Key& key) const {
- return fDict->find(key);
- }
-
- /**
- * If element already in cache, return immediately the cached value
- */
- T& add(const T& add) {
- Key key = Traits::GetKey(add);
- if (T* val = this->find(key)) {
- return *val;
- }
-
- T* element = SkNEW_ARGS(T, (add));
-
- fDict->add(element);
-
- return *element;
- }
-
- int size() const {
- return fDict->count();
- }
-
- void reset() {
- this->clear();
-
- fDict.reset(SkNEW(DictType));
- }
-
-private:
- typedef SkTDynamicHash<T, Key, Traits, kGrowPercent> DictType;
-
- void clear() {
- if (fDict.get()) {
- typename DictType::Iter it(fDict.get());
-
- while (!it.done()) {
- SkDELETE(&(*it));
- ++it;
- }
- }
- }
-
- SkAutoTDelete<DictType> fDict;
-};
-
-#endif /* SkHASHCACHE_DEFINED */
-
« no previous file with comments | « gyp/tests.gypi ('k') | src/gpu/gl/GrGLCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698