Index: third_party/WebKit/Source/platform/fonts/FontDataCache.h |
diff --git a/third_party/WebKit/Source/platform/fonts/FontDataCache.h b/third_party/WebKit/Source/platform/fonts/FontDataCache.h |
index 3652e0350b1479675a59fdeb504e315eeb6a056f..f08d5cfd8c8acbb192840d9209980d615e74cea0 100644 |
--- a/third_party/WebKit/Source/platform/fonts/FontDataCache.h |
+++ b/third_party/WebKit/Source/platform/fonts/FontDataCache.h |
@@ -42,35 +42,29 @@ class SimpleFontData; |
struct FontDataCacheKeyHash { |
STATIC_ONLY(FontDataCacheKeyHash); |
- static unsigned hash(const FontPlatformData& platformData) |
+ static unsigned hash(const FontPlatformData* platformData) |
{ |
- return platformData.hash(); |
+ return platformData->hash(); |
} |
- static bool equal(const FontPlatformData& a, const FontPlatformData& b) |
+ static bool equal(const FontPlatformData* a, const FontPlatformData* b) |
{ |
- return a == b; |
- } |
+ const FontPlatformData* emptyValue = reinterpret_cast<FontPlatformData*>(-1); |
- static const bool safeToCompareToEmptyOrDeleted = true; |
-}; |
+ if (a == emptyValue) |
eae
2016/06/06 17:26:53
What's the difference between emptyValue (-1) and
|
+ return b == emptyValue; |
+ if (b == emptyValue) |
+ return a == emptyValue; |
-struct FontDataCacheKeyTraits : WTF::GenericHashTraits<FontPlatformData> { |
- STATIC_ONLY(FontDataCacheKeyTraits); |
- static const bool emptyValueIsZero = true; |
- static const FontPlatformData& emptyValue() |
- { |
- DEFINE_STATIC_LOCAL(FontPlatformData, key, (0.f, false, false)); |
- return key; |
- } |
- static void constructDeletedValue(FontPlatformData& slot, bool) |
- { |
- new (NotNull, &slot) FontPlatformData(WTF::HashTableDeletedValue); |
- } |
- static bool isDeletedValue(const FontPlatformData& value) |
- { |
- return value.isHashTableDeletedValue(); |
+ if (!a || !b) |
+ return a == b; |
+ |
+ CHECK(a && b); |
+ |
+ return *a == *b; |
} |
+ |
+ static const bool safeToCompareToEmptyOrDeleted = true; |
}; |
class FontDataCache { |
@@ -94,7 +88,7 @@ public: |
private: |
bool purgeLeastRecentlyUsed(int count); |
- typedef HashMap<FontPlatformData, std::pair<RefPtr<SimpleFontData>, unsigned>, FontDataCacheKeyHash, FontDataCacheKeyTraits> Cache; |
+ typedef HashMap<const FontPlatformData*, std::pair<RefPtr<SimpleFontData>, unsigned>, FontDataCacheKeyHash> Cache; |
Cache m_cache; |
ListHashSet<RefPtr<SimpleFontData>> m_inactiveFontData; |
}; |