OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 void beginLoadIfNeeded(ResourceFetcher* dl); | 54 void beginLoadIfNeeded(ResourceFetcher* dl); |
55 virtual bool stillNeedsLoad() const override { return m_state != LoadInitiat
ed; } | 55 virtual bool stillNeedsLoad() const override { return m_state != LoadInitiat
ed; } |
56 bool exceedsFontLoadWaitLimit() const { return m_exceedsFontLoadWaitLimit; } | 56 bool exceedsFontLoadWaitLimit() const { return m_exceedsFontLoadWaitLimit; } |
57 | 57 |
58 bool loadScheduled() const { return m_state != Unloaded; } | 58 bool loadScheduled() const { return m_state != Unloaded; } |
59 void didScheduleLoad(); | 59 void didScheduleLoad(); |
60 void didUnscheduleLoad(); | 60 void didUnscheduleLoad(); |
61 | 61 |
62 void setCORSFailed() override { m_corsFailed = true; } | 62 void setCORSFailed() override { m_corsFailed = true; } |
63 bool isCORSFailed() const { return m_corsFailed; } | 63 bool isCORSFailed() const { return m_corsFailed; } |
| 64 String otsParsingMessage() const { return m_otsParsingMessage; } |
64 | 65 |
65 bool ensureCustomFontData(); | 66 bool ensureCustomFontData(); |
66 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital
ic, FontOrientation = FontOrientation::Horizontal); | 67 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital
ic, FontOrientation = FontOrientation::Horizontal); |
67 | 68 |
68 protected: | 69 protected: |
69 virtual bool isSafeToUnlock() const override; | 70 virtual bool isSafeToUnlock() const override; |
70 | 71 |
71 private: | 72 private: |
72 class FontResourceFactory : public ResourceFactory { | 73 class FontResourceFactory : public ResourceFactory { |
73 public: | 74 public: |
74 FontResourceFactory() | 75 FontResourceFactory() |
75 : ResourceFactory(Resource::Font) { } | 76 : ResourceFactory(Resource::Font) { } |
76 | 77 |
77 Resource* create(const ResourceRequest& request, const String& charset)
const override | 78 Resource* create(const ResourceRequest& request, const String& charset)
const override |
78 { | 79 { |
79 return new FontResource(request); | 80 return new FontResource(request); |
80 } | 81 } |
81 }; | 82 }; |
82 FontResource(const ResourceRequest&); | 83 FontResource(const ResourceRequest&); |
83 | 84 |
84 virtual void checkNotify() override; | 85 virtual void checkNotify() override; |
85 void fontLoadWaitLimitCallback(Timer<FontResource>*); | 86 void fontLoadWaitLimitCallback(Timer<FontResource>*); |
86 | 87 |
87 enum State { Unloaded, LoadScheduled, LoadInitiated }; | 88 enum State { Unloaded, LoadScheduled, LoadInitiated }; |
88 | 89 |
89 OwnPtr<FontCustomPlatformData> m_fontData; | 90 OwnPtr<FontCustomPlatformData> m_fontData; |
| 91 String m_otsParsingMessage; |
90 State m_state; | 92 State m_state; |
91 bool m_exceedsFontLoadWaitLimit; | 93 bool m_exceedsFontLoadWaitLimit; |
92 bool m_corsFailed; | 94 bool m_corsFailed; |
93 Timer<FontResource> m_fontLoadWaitLimitTimer; | 95 Timer<FontResource> m_fontLoadWaitLimitTimer; |
94 | 96 |
95 friend class MemoryCache; | 97 friend class MemoryCache; |
96 }; | 98 }; |
97 | 99 |
98 DEFINE_RESOURCE_TYPE_CASTS(Font); | 100 DEFINE_RESOURCE_TYPE_CASTS(Font); |
99 | 101 |
100 class FontResourceClient : public ResourceClient { | 102 class FontResourceClient : public ResourceClient { |
101 public: | 103 public: |
102 virtual ~FontResourceClient() { } | 104 virtual ~FontResourceClient() { } |
103 static ResourceClientType expectedType() { return FontType; } | 105 static ResourceClientType expectedType() { return FontType; } |
104 virtual ResourceClientType resourceClientType() const override final { retur
n expectedType(); } | 106 virtual ResourceClientType resourceClientType() const override final { retur
n expectedType(); } |
105 virtual void fontLoaded(FontResource*) { } | 107 virtual void fontLoaded(FontResource*) { } |
106 virtual void didStartFontLoad(FontResource*) { } | 108 virtual void didStartFontLoad(FontResource*) { } |
107 virtual void fontLoadWaitLimitExceeded(FontResource*) { } | 109 virtual void fontLoadWaitLimitExceeded(FontResource*) { } |
108 }; | 110 }; |
109 | 111 |
110 } | 112 } |
111 | 113 |
112 #endif | 114 #endif |
OLD | NEW |