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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 void allClientsAndObserversRemoved() override; | 55 void allClientsAndObserversRemoved() override; |
56 void startLoadLimitTimersIfNeeded(); | 56 void startLoadLimitTimersIfNeeded(); |
57 | 57 |
58 void setCORSFailed() override { m_corsFailed = true; } | 58 void setCORSFailed() override { m_corsFailed = true; } |
59 bool isCORSFailed() const { return m_corsFailed; } | 59 bool isCORSFailed() const { return m_corsFailed; } |
60 String otsParsingMessage() const { return m_otsParsingMessage; } | 60 String otsParsingMessage() const { return m_otsParsingMessage; } |
61 | 61 |
62 bool ensureCustomFontData(); | 62 bool ensureCustomFontData(); |
63 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital
ic, FontOrientation = FontOrientation::Horizontal); | 63 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital
ic, FontOrientation = FontOrientation::Horizontal); |
64 | 64 |
65 protected: | |
66 bool isSafeToUnlock() const override; | |
67 | |
68 private: | 65 private: |
69 class FontResourceFactory : public ResourceFactory { | 66 class FontResourceFactory : public ResourceFactory { |
70 public: | 67 public: |
71 FontResourceFactory() | 68 FontResourceFactory() |
72 : ResourceFactory(Resource::Font) { } | 69 : ResourceFactory(Resource::Font) { } |
73 | 70 |
74 Resource* create(const ResourceRequest& request, const ResourceLoaderOpt
ions& options, const String& charset) const override | 71 Resource* create(const ResourceRequest& request, const ResourceLoaderOpt
ions& options, const String& charset) const override |
75 { | 72 { |
76 return new FontResource(request, options); | 73 return new FontResource(request, options); |
77 } | 74 } |
78 }; | 75 }; |
79 FontResource(const ResourceRequest&, const ResourceLoaderOptions&); | 76 FontResource(const ResourceRequest&, const ResourceLoaderOptions&); |
80 | 77 |
81 void checkNotify() override; | 78 void checkNotify() override; |
82 void fontLoadShortLimitCallback(Timer<FontResource>*); | 79 void fontLoadShortLimitCallback(Timer<FontResource>*); |
83 void fontLoadLongLimitCallback(Timer<FontResource>*); | 80 void fontLoadLongLimitCallback(Timer<FontResource>*); |
84 | 81 |
| 82 bool isSafeToUnlock() const override; |
| 83 |
85 enum LoadLimitState { UnderLimit, ShortLimitExceeded, LongLimitExceeded }; | 84 enum LoadLimitState { UnderLimit, ShortLimitExceeded, LongLimitExceeded }; |
86 | 85 |
87 std::unique_ptr<FontCustomPlatformData> m_fontData; | 86 std::unique_ptr<FontCustomPlatformData> m_fontData; |
88 String m_otsParsingMessage; | 87 String m_otsParsingMessage; |
89 LoadLimitState m_loadLimitState; | 88 LoadLimitState m_loadLimitState; |
90 bool m_corsFailed; | 89 bool m_corsFailed; |
91 Timer<FontResource> m_fontLoadShortLimitTimer; | 90 Timer<FontResource> m_fontLoadShortLimitTimer; |
92 Timer<FontResource> m_fontLoadLongLimitTimer; | 91 Timer<FontResource> m_fontLoadLongLimitTimer; |
93 | 92 |
94 friend class MemoryCache; | 93 friend class MemoryCache; |
95 }; | 94 }; |
96 | 95 |
97 DEFINE_RESOURCE_TYPE_CASTS(Font); | 96 DEFINE_RESOURCE_TYPE_CASTS(Font); |
98 | 97 |
99 class FontResourceClient : public GarbageCollectedMixin, public ResourceClient { | 98 class FontResourceClient : public GarbageCollectedMixin, public ResourceClient { |
100 public: | 99 public: |
101 ~FontResourceClient() override {} | 100 ~FontResourceClient() override {} |
102 static bool isExpectedType(ResourceClient* client) { return client->getResou
rceClientType() == FontType; } | 101 static bool isExpectedType(ResourceClient* client) { return client->getResou
rceClientType() == FontType; } |
103 ResourceClientType getResourceClientType() const final { return FontType; } | 102 ResourceClientType getResourceClientType() const final { return FontType; } |
104 virtual void fontLoadShortLimitExceeded(FontResource*) {} | 103 virtual void fontLoadShortLimitExceeded(FontResource*) {} |
105 virtual void fontLoadLongLimitExceeded(FontResource*) {} | 104 virtual void fontLoadLongLimitExceeded(FontResource*) {} |
106 | 105 |
107 DEFINE_INLINE_VIRTUAL_TRACE() {} | 106 DEFINE_INLINE_VIRTUAL_TRACE() {} |
108 }; | 107 }; |
109 | 108 |
110 } // namespace blink | 109 } // namespace blink |
111 | 110 |
112 #endif | 111 #endif |
OLD | NEW |