| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 using ClientType = FontResourceClient; | 47 using ClientType = FontResourceClient; |
| 48 | 48 |
| 49 static FontResource* fetch(FetchRequest&, ResourceFetcher*); | 49 static FontResource* fetch(FetchRequest&, ResourceFetcher*); |
| 50 ~FontResource() override; | 50 ~FontResource() override; |
| 51 | 51 |
| 52 void didAddClient(ResourceClient*) override; | 52 void didAddClient(ResourceClient*) override; |
| 53 | 53 |
| 54 void setRevalidatingRequest(const ResourceRequest&) override; | 54 void setRevalidatingRequest(const ResourceRequest&) override; |
| 55 | 55 |
| 56 void allClientsAndObserversRemoved() override; | 56 void allClientsAndObserversRemoved() override; |
| 57 void startLoadLimitTimersIfNeeded(); | 57 void startLoadLimitTimers(); |
| 58 | 58 |
| 59 void setCORSFailed() override { m_corsFailed = true; } | 59 void setCORSFailed() override { m_corsFailed = true; } |
| 60 bool isCORSFailed() const { return m_corsFailed; } | 60 bool isCORSFailed() const { return m_corsFailed; } |
| 61 String otsParsingMessage() const { return m_otsParsingMessage; } | 61 String otsParsingMessage() const { return m_otsParsingMessage; } |
| 62 | 62 |
| 63 bool ensureCustomFontData(); | 63 bool ensureCustomFontData(); |
| 64 FontPlatformData platformDataFromCustomData( | 64 FontPlatformData platformDataFromCustomData( |
| 65 float size, | 65 float size, |
| 66 bool bold, | 66 bool bold, |
| 67 bool italic, | 67 bool italic, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 83 void checkNotify() override; | 83 void checkNotify() override; |
| 84 void fontLoadShortLimitCallback(TimerBase*); | 84 void fontLoadShortLimitCallback(TimerBase*); |
| 85 void fontLoadLongLimitCallback(TimerBase*); | 85 void fontLoadLongLimitCallback(TimerBase*); |
| 86 | 86 |
| 87 enum LoadLimitState { UnderLimit, ShortLimitExceeded, LongLimitExceeded }; | 87 enum LoadLimitState { UnderLimit, ShortLimitExceeded, LongLimitExceeded }; |
| 88 | 88 |
| 89 std::unique_ptr<FontCustomPlatformData> m_fontData; | 89 std::unique_ptr<FontCustomPlatformData> m_fontData; |
| 90 String m_otsParsingMessage; | 90 String m_otsParsingMessage; |
| 91 LoadLimitState m_loadLimitState; | 91 LoadLimitState m_loadLimitState; |
| 92 bool m_corsFailed; | 92 bool m_corsFailed; |
| 93 bool m_isLoadLimitTimersStarted; |
| 93 Timer<FontResource> m_fontLoadShortLimitTimer; | 94 Timer<FontResource> m_fontLoadShortLimitTimer; |
| 94 Timer<FontResource> m_fontLoadLongLimitTimer; | 95 Timer<FontResource> m_fontLoadLongLimitTimer; |
| 95 | 96 |
| 96 friend class MemoryCache; | 97 friend class MemoryCache; |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 DEFINE_RESOURCE_TYPE_CASTS(Font); | 100 DEFINE_RESOURCE_TYPE_CASTS(Font); |
| 100 | 101 |
| 101 class FontResourceClient : public ResourceClient { | 102 class FontResourceClient : public ResourceClient { |
| 102 public: | 103 public: |
| 103 ~FontResourceClient() override {} | 104 ~FontResourceClient() override {} |
| 104 static bool isExpectedType(ResourceClient* client) { | 105 static bool isExpectedType(ResourceClient* client) { |
| 105 return client->getResourceClientType() == FontType; | 106 return client->getResourceClientType() == FontType; |
| 106 } | 107 } |
| 107 ResourceClientType getResourceClientType() const final { return FontType; } | 108 ResourceClientType getResourceClientType() const final { return FontType; } |
| 108 virtual void fontLoadShortLimitExceeded(FontResource*) {} | 109 virtual void fontLoadShortLimitExceeded(FontResource*) {} |
| 109 virtual void fontLoadLongLimitExceeded(FontResource*) {} | 110 virtual void fontLoadLongLimitExceeded(FontResource*) {} |
| 110 }; | 111 }; |
| 111 | 112 |
| 112 } // namespace blink | 113 } // namespace blink |
| 113 | 114 |
| 114 #endif | 115 #endif |
| OLD | NEW |