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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/FontDataCache.h

Issue 2392033002: Correcting text baseline for tiny fonts (Closed)
Patch Set: Rebaseline. Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 }; 67 };
68 68
69 class FontDataCache { 69 class FontDataCache {
70 USING_FAST_MALLOC(FontDataCache); 70 USING_FAST_MALLOC(FontDataCache);
71 WTF_MAKE_NONCOPYABLE(FontDataCache); 71 WTF_MAKE_NONCOPYABLE(FontDataCache);
72 72
73 public: 73 public:
74 FontDataCache() {} 74 FontDataCache() {}
75 75
76 PassRefPtr<SimpleFontData> get(const FontPlatformData*, 76 PassRefPtr<SimpleFontData> get(const FontPlatformData*,
77 ShouldRetain = Retain); 77 ShouldRetain = Retain,
78 bool = false);
78 bool contains(const FontPlatformData*) const; 79 bool contains(const FontPlatformData*) const;
79 void release(const SimpleFontData*); 80 void release(const SimpleFontData*);
80 81
81 // This is used by FontVerticalDataCache to mark all items with vertical data 82 // This is used by FontVerticalDataCache to mark all items with vertical data
82 // that are currently in cache as "in cache", which is later used to sweep the 83 // that are currently in cache as "in cache", which is later used to sweep the
83 // FontVerticalDataCache. 84 // FontVerticalDataCache.
84 void markAllVerticalData(); 85 void markAllVerticalData();
85 86
86 // Purges items in FontDataCache according to provided severity. 87 // Purges items in FontDataCache according to provided severity.
87 // Returns true if any removal of cache items actually occurred. 88 // Returns true if any removal of cache items actually occurred.
88 bool purge(PurgeSeverity); 89 bool purge(PurgeSeverity);
89 90
90 private: 91 private:
91 bool purgeLeastRecentlyUsed(int count); 92 bool purgeLeastRecentlyUsed(int count);
92 93
93 typedef HashMap<const FontPlatformData*, 94 typedef HashMap<const FontPlatformData*,
94 std::pair<RefPtr<SimpleFontData>, unsigned>, 95 std::pair<RefPtr<SimpleFontData>, unsigned>,
95 FontDataCacheKeyHash> 96 FontDataCacheKeyHash>
96 Cache; 97 Cache;
97 Cache m_cache; 98 Cache m_cache;
98 ListHashSet<RefPtr<SimpleFontData>> m_inactiveFontData; 99 ListHashSet<RefPtr<SimpleFontData>> m_inactiveFontData;
99 }; 100 };
100 101
101 } // namespace blink 102 } // namespace blink
102 103
103 #endif 104 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698