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