| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2007-2008 Torch Mobile, Inc. | 3 * Copyright (C) 2007-2008 Torch Mobile, Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #ifndef FontCache_h | 30 #ifndef FontCache_h |
| 31 #define FontCache_h | 31 #define FontCache_h |
| 32 | 32 |
| 33 #include <limits.h> | 33 #include <limits.h> |
| 34 #include "platform/PlatformExport.h" |
| 34 #include "wtf/Forward.h" | 35 #include "wtf/Forward.h" |
| 35 #include "wtf/PassRefPtr.h" | 36 #include "wtf/PassRefPtr.h" |
| 36 #include "wtf/RefPtr.h" | 37 #include "wtf/RefPtr.h" |
| 37 #include "wtf/Vector.h" | 38 #include "wtf/Vector.h" |
| 38 #include "wtf/text/CString.h" | 39 #include "wtf/text/CString.h" |
| 39 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
| 40 #include "wtf/unicode/Unicode.h" | 41 #include "wtf/unicode/Unicode.h" |
| 41 | 42 |
| 42 #if OS(WIN) | 43 #if OS(WIN) |
| 43 #include <windows.h> | 44 #include <windows.h> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 56 class FontPlatformData; | 57 class FontPlatformData; |
| 57 class FontData; | 58 class FontData; |
| 58 class FontDescription; | 59 class FontDescription; |
| 59 class FontSelector; | 60 class FontSelector; |
| 60 class OpenTypeVerticalData; | 61 class OpenTypeVerticalData; |
| 61 class SimpleFontData; | 62 class SimpleFontData; |
| 62 | 63 |
| 63 enum ShouldRetain { Retain, DoNotRetain }; | 64 enum ShouldRetain { Retain, DoNotRetain }; |
| 64 enum PurgeSeverity { PurgeIfNeeded, ForcePurge }; | 65 enum PurgeSeverity { PurgeIfNeeded, ForcePurge }; |
| 65 | 66 |
| 66 class FontCache { | 67 class PLATFORM_EXPORT FontCache { |
| 67 friend class FontCachePurgePreventer; | 68 friend class FontCachePurgePreventer; |
| 68 | 69 |
| 69 WTF_MAKE_NONCOPYABLE(FontCache); WTF_MAKE_FAST_ALLOCATED; | 70 WTF_MAKE_NONCOPYABLE(FontCache); WTF_MAKE_FAST_ALLOCATED; |
| 70 public: | 71 public: |
| 71 friend FontCache* fontCache(); | 72 static FontCache* fontCache(); |
| 72 | 73 |
| 73 void releaseFontData(const SimpleFontData*); | 74 void releaseFontData(const SimpleFontData*); |
| 74 | 75 |
| 75 // This method is implemented by the plaform and used by | 76 // This method is implemented by the plaform and used by |
| 76 // FontFastPath to lookup the font for a given character. | 77 // FontFastPath to lookup the font for a given character. |
| 77 PassRefPtr<SimpleFontData> platformFallbackForCharacter(const FontDescriptio
n&, UChar32, const SimpleFontData* fontDataToSubstitute, bool disallowSynthetics
); | 78 PassRefPtr<SimpleFontData> platformFallbackForCharacter(const FontDescriptio
n&, UChar32, const SimpleFontData* fontDataToSubstitute, bool disallowSynthetics
); |
| 78 | 79 |
| 79 // Also implemented by the platform. | 80 // Also implemented by the platform. |
| 80 void platformInit(); | 81 void platformInit(); |
| 81 | 82 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 bool m_useSubpixelPositioning; | 144 bool m_useSubpixelPositioning; |
| 144 #endif | 145 #endif |
| 145 | 146 |
| 146 #if OS(MACOSX) || OS(ANDROID) | 147 #if OS(MACOSX) || OS(ANDROID) |
| 147 friend class ComplexTextController; | 148 friend class ComplexTextController; |
| 148 #endif | 149 #endif |
| 149 friend class SimpleFontData; // For fontDataFromFontPlatformData | 150 friend class SimpleFontData; // For fontDataFromFontPlatformData |
| 150 friend class FontFallbackList; | 151 friend class FontFallbackList; |
| 151 }; | 152 }; |
| 152 | 153 |
| 153 // Get the global fontCache. | 154 class PLATFORM_EXPORT FontCachePurgePreventer { |
| 154 FontCache* fontCache(); | |
| 155 | |
| 156 class FontCachePurgePreventer { | |
| 157 public: | 155 public: |
| 158 FontCachePurgePreventer() { fontCache()->disablePurging(); } | 156 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } |
| 159 ~FontCachePurgePreventer() { fontCache()->enablePurging(); } | 157 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } |
| 160 }; | 158 }; |
| 161 | 159 |
| 162 } | 160 } |
| 163 | 161 |
| 164 #endif | 162 #endif |
| OLD | NEW |