diff options
author | mtklein <mtklein@chromium.org> | 2015-10-15 12:23:01 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-15 12:23:02 -0700 |
commit | c8d1dd48c01f562cfffe64da0e5cee5ed2713541 (patch) | |
tree | d561462e44e5b2f644b41c1fd670c1e66c5f03de /src/pdf/SkPDFCanon.h | |
parent | b9519f86bbce946e505980a4fa950fdc4bcf74ab (diff) |
SkTHash: hash from fnptr to functor type
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
Diffstat (limited to 'src/pdf/SkPDFCanon.h')
-rw-r--r-- | src/pdf/SkPDFCanon.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/pdf/SkPDFCanon.h b/src/pdf/SkPDFCanon.h index 988b2855e1..3d2ba6a77d 100644 --- a/src/pdf/SkPDFCanon.h +++ b/src/pdf/SkPDFCanon.h @@ -102,10 +102,12 @@ private: SkASSERT(rhs.fPtr); return *fPtr == *rhs.fPtr; } - static uint32_t Hash(const WrapGS& w) { - SkASSERT(w.fPtr); - return w.fPtr->hash(); - } + struct Hash { + uint32_t operator()(const WrapGS& w) const { + SkASSERT(w.fPtr); + return w.fPtr->hash(); + } + }; }; SkTHashSet<WrapGS, WrapGS::Hash> fGraphicStateRecords; |