OLD | NEW |
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 Loading... |
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); | |
79 bool contains(const FontPlatformData*) const; | 78 bool contains(const FontPlatformData*) const; |
80 void release(const SimpleFontData*); | 79 void release(const SimpleFontData*); |
81 | 80 |
82 // This is used by FontVerticalDataCache to mark all items with vertical data | 81 // This is used by FontVerticalDataCache to mark all items with vertical data |
83 // that are currently in cache as "in cache", which is later used to sweep the | 82 // that are currently in cache as "in cache", which is later used to sweep the |
84 // FontVerticalDataCache. | 83 // FontVerticalDataCache. |
85 void markAllVerticalData(); | 84 void markAllVerticalData(); |
86 | 85 |
87 // Purges items in FontDataCache according to provided severity. | 86 // Purges items in FontDataCache according to provided severity. |
88 // Returns true if any removal of cache items actually occurred. | 87 // Returns true if any removal of cache items actually occurred. |
89 bool purge(PurgeSeverity); | 88 bool purge(PurgeSeverity); |
90 | 89 |
91 private: | 90 private: |
92 bool purgeLeastRecentlyUsed(int count); | 91 bool purgeLeastRecentlyUsed(int count); |
93 | 92 |
94 typedef HashMap<const FontPlatformData*, | 93 typedef HashMap<const FontPlatformData*, |
95 std::pair<RefPtr<SimpleFontData>, unsigned>, | 94 std::pair<RefPtr<SimpleFontData>, unsigned>, |
96 FontDataCacheKeyHash> | 95 FontDataCacheKeyHash> |
97 Cache; | 96 Cache; |
98 Cache m_cache; | 97 Cache m_cache; |
99 ListHashSet<RefPtr<SimpleFontData>> m_inactiveFontData; | 98 ListHashSet<RefPtr<SimpleFontData>> m_inactiveFontData; |
100 }; | 99 }; |
101 | 100 |
102 } // namespace blink | 101 } // namespace blink |
103 | 102 |
104 #endif | 103 #endif |
OLD | NEW |