| 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 18 matching lines...) Expand all  Loading... | 
|   29  */ |   29  */ | 
|   30  |   30  | 
|   31 #ifndef FontDataCache_h |   31 #ifndef FontDataCache_h | 
|   32 #define FontDataCache_h |   32 #define FontDataCache_h | 
|   33  |   33  | 
|   34 #include "platform/fonts/FontCache.h" |   34 #include "platform/fonts/FontCache.h" | 
|   35 #include "platform/fonts/FontPlatformData.h" |   35 #include "platform/fonts/FontPlatformData.h" | 
|   36 #include "wtf/HashMap.h" |   36 #include "wtf/HashMap.h" | 
|   37 #include "wtf/ListHashSet.h" |   37 #include "wtf/ListHashSet.h" | 
|   38  |   38  | 
 |   39 namespace base { | 
 |   40 namespace trace_event { | 
 |   41 class ProcessMemoryDump; | 
 |   42 } | 
 |   43 } | 
 |   44  | 
 |   45  | 
|   39 namespace blink { |   46 namespace blink { | 
|   40  |   47  | 
|   41 class SimpleFontData; |   48 class SimpleFontData; | 
|   42  |   49  | 
|   43 struct FontDataCacheKeyHash { |   50 struct FontDataCacheKeyHash { | 
|   44     STATIC_ONLY(FontDataCacheKeyHash); |   51     STATIC_ONLY(FontDataCacheKeyHash); | 
|   45     static unsigned hash(const FontPlatformData* platformData) |   52     static unsigned hash(const FontPlatformData* platformData) | 
|   46     { |   53     { | 
|   47         return platformData->hash(); |   54         return platformData->hash(); | 
|   48     } |   55     } | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
|   78     void release(const SimpleFontData*); |   85     void release(const SimpleFontData*); | 
|   79  |   86  | 
|   80     // This is used by FontVerticalDataCache to mark all items with vertical dat
     a |   87     // This is used by FontVerticalDataCache to mark all items with vertical dat
     a | 
|   81     // that are currently in cache as "in cache", which is later used to sweep t
     he FontVerticalDataCache. |   88     // that are currently in cache as "in cache", which is later used to sweep t
     he FontVerticalDataCache. | 
|   82     void markAllVerticalData(); |   89     void markAllVerticalData(); | 
|   83  |   90  | 
|   84     // Purges items in FontDataCache according to provided severity. |   91     // Purges items in FontDataCache according to provided severity. | 
|   85     // Returns true if any removal of cache items actually occurred. |   92     // Returns true if any removal of cache items actually occurred. | 
|   86     bool purge(PurgeSeverity); |   93     bool purge(PurgeSeverity); | 
|   87  |   94  | 
 |   95     void dumpCountAndGlyphToBoundsMaps(base::trace_event::ProcessMemoryDump*); | 
 |   96  | 
|   88 private: |   97 private: | 
|   89     bool purgeLeastRecentlyUsed(int count); |   98     bool purgeLeastRecentlyUsed(int count); | 
|   90  |   99  | 
|   91     typedef HashMap<const FontPlatformData*, std::pair<RefPtr<SimpleFontData>, u
     nsigned>, FontDataCacheKeyHash> Cache; |  100     typedef HashMap<const FontPlatformData*, std::pair<RefPtr<SimpleFontData>, u
     nsigned>, FontDataCacheKeyHash> Cache; | 
|   92     Cache m_cache; |  101     Cache m_cache; | 
|   93     ListHashSet<RefPtr<SimpleFontData>> m_inactiveFontData; |  102     ListHashSet<RefPtr<SimpleFontData>> m_inactiveFontData; | 
|   94 }; |  103 }; | 
|   95  |  104  | 
|   96 } // namespace blink |  105 } // namespace blink | 
|   97  |  106  | 
|   98 #endif |  107 #endif | 
| OLD | NEW |