aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/HashTest.cpp
Commit message (Collapse)AuthorAge
* Fix SkTHashTable dangling valuesGravatar Florin Malita2017-03-10
| | | | | | | | | | | | | | The element rearrange logic in SkTHashTable::remove() marks empty slots as such, but does not reset their value. When breaking out of the rearrange loop, we must also reset the last empty slot value to avoid retaining unwanted copies. Change-Id: I8ba2a25088c0aa5210277124e0917224cb295691 Reviewed-on: https://skia-review.googlesource.com/9533 Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
* add move semantics to SkTHash*Gravatar Mike Klein2016-12-13
| | | | | | | | | | | | | | | | The more I look at std::unordered_map and co., the less I like them. I think we might want to bet on SkTHash*. As a simple first improvement, add move support. Next comes shrinking, and then I'll start moving over SkTDynamicHash users. BUG=skia:6053 Change-Id: Ifdb5d713aab66434ca271c7f18a0cbbb0720099c Reviewed-on: https://skia-review.googlesource.com/5943 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Herb Derby <herb@google.com> Reviewed-by: Hal Canary <halcanary@google.com>
* SkTHash: hash from fnptr to functor typeGravatar mtklein2015-10-15
| | | | | | | | Passing &SkGoodHash to SkTHashMap and SkTHashSet doesn't guarantee that it's actually instantiated. Using a functor does. BUG=skia: Review URL: https://codereview.chromium.org/1405053002
* Style Change: NULL->nullptrGravatar halcanary2015-08-27
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316233002 Review URL: https://codereview.chromium.org/1316233002
* Add approxBytesUsed to hashes.Gravatar mtklein2015-08-07
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1280653003
* Cleanup: Remove unnecessary double-semicolons.Gravatar tfarina2015-04-27
| | | | | | | | | | | | | | | The entries were found by the following command line: $ find . -regex ".*\.[cChH]\(pp\)?" | xargs git grep -e ';;' --and --not -e 'for *(.*;;' Which is a combination of http://stackoverflow.com/a/3858879 and http://gitster.livejournal.com/27674.html BUG=None R=mtklein@google.com Review URL: https://codereview.chromium.org/1088763005
* SkTHash: remove()Gravatar mtklein2015-04-21
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1057043003
* Add SkTHashSet::find()Gravatar mtklein2015-04-01
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1058553002
* Some usability ideas around SkTHash.Gravatar mtklein2015-03-20
| | | | | | | | | | | | | | - By default, use new SkGoodHash to hash keys, which is: * for 4 byte values, use SkChecksum::Mix, * for SkStrings, use SkChecksum::Murmur3 on the data, * for other structs, shallow hash the struct with Murmur3. - Expand SkChecksum::Murmur3 to support non-4-byte-aligned data. - Add const foreach() methods. - Have foreach() take a functor, which allows lambdas. BUG=skia: Review URL: https://codereview.chromium.org/1021033002
* Port GrGLCaps over to use SkTHash.Gravatar mtklein2015-02-20
| | | | | | | | | | | | | I've written some new hashtable interfaces that should be easier to use, and I've been trying to roll them out bit by bit, hopefully replacing SkTDynamicHash, SkTMultiMap, SkTHashCache, etc. This turns the cache in GrGLCaps::readPixelsSupported() into an SkTHashMap, mapping the format key to a bool. Functionally, it's the same. BUG=skia: Review URL: https://codereview.chromium.org/948473002
* Minimize SkTHash object copyingGravatar fmalita2015-02-12
| | | | | | | | AKA ref-constify the world. R=mtklein@google.com Review URL: https://codereview.chromium.org/919193002
* fix windows buildGravatar Mike Klein2015-02-12
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/917363002
* Spin off SkTHashTable, SkTHashMap, SkTHashSetGravatar mtklein2015-02-12
SkTHashTable is very similar to SkTDynamicHash, except it's generalized to support non-pointer value types. It doesn't support remove(), just to keep things simple (it's not hard to add). Instead of an iterator, it has foreach(), again, to keep things simple. SkTHashMap<K,V> and SkTHashSet<T> build a friendlier experience on top of SkTHashTable. BUG=skia: Review URL: https://codereview.chromium.org/925613002