| 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 26 matching lines...) Expand all Loading... |
| 37 class FetchRequest; | 37 class FetchRequest; |
| 38 class ResourceFetcher; | 38 class ResourceFetcher; |
| 39 class FontPlatformData; | 39 class FontPlatformData; |
| 40 class FontCustomPlatformData; | 40 class FontCustomPlatformData; |
| 41 class FontResourceClient; | 41 class FontResourceClient; |
| 42 | 42 |
| 43 class FontResource final : public Resource { | 43 class FontResource final : public Resource { |
| 44 public: | 44 public: |
| 45 using ClientType = FontResourceClient; | 45 using ClientType = FontResourceClient; |
| 46 | 46 |
| 47 static PassRefPtrWillBeRawPtr<FontResource> fetch(FetchRequest&, ResourceFet
cher*); | 47 static RawPtr<FontResource> fetch(FetchRequest&, ResourceFetcher*); |
| 48 ~FontResource() override; | 48 ~FontResource() override; |
| 49 | 49 |
| 50 void load(ResourceFetcher*) override; | 50 void load(ResourceFetcher*) override; |
| 51 | 51 |
| 52 void didAddClient(ResourceClient*) override; | 52 void didAddClient(ResourceClient*) override; |
| 53 | 53 |
| 54 void allClientsAndObserversRemoved() override; | 54 void allClientsAndObserversRemoved() override; |
| 55 void beginLoadIfNeeded(ResourceFetcher* dl); | 55 void beginLoadIfNeeded(ResourceFetcher* dl); |
| 56 | 56 |
| 57 bool loadScheduled() const { return getStatus() == LoadStartScheduled; } | 57 bool loadScheduled() const { return getStatus() == LoadStartScheduled; } |
| 58 void didScheduleLoad(); | 58 void didScheduleLoad(); |
| 59 void didUnscheduleLoad(); | 59 void didUnscheduleLoad(); |
| 60 | 60 |
| 61 void setCORSFailed() override { m_corsFailed = true; } | 61 void setCORSFailed() override { m_corsFailed = true; } |
| 62 bool isCORSFailed() const { return m_corsFailed; } | 62 bool isCORSFailed() const { return m_corsFailed; } |
| 63 String otsParsingMessage() const { return m_otsParsingMessage; } | 63 String otsParsingMessage() const { return m_otsParsingMessage; } |
| 64 | 64 |
| 65 bool ensureCustomFontData(); | 65 bool ensureCustomFontData(); |
| 66 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital
ic, FontOrientation = FontOrientation::Horizontal); | 66 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital
ic, FontOrientation = FontOrientation::Horizontal); |
| 67 | 67 |
| 68 protected: | 68 protected: |
| 69 bool isSafeToUnlock() const override; | 69 bool isSafeToUnlock() const override; |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 class FontResourceFactory : public ResourceFactory { | 72 class FontResourceFactory : public ResourceFactory { |
| 73 public: | 73 public: |
| 74 FontResourceFactory() | 74 FontResourceFactory() |
| 75 : ResourceFactory(Resource::Font) { } | 75 : ResourceFactory(Resource::Font) { } |
| 76 | 76 |
| 77 PassRefPtrWillBeRawPtr<Resource> create(const ResourceRequest& request,
const ResourceLoaderOptions& options, const String& charset) const override | 77 RawPtr<Resource> create(const ResourceRequest& request, const ResourceLo
aderOptions& options, const String& charset) const override |
| 78 { | 78 { |
| 79 return adoptRefWillBeNoop(new FontResource(request, options)); | 79 return new FontResource(request, options); |
| 80 } | 80 } |
| 81 }; | 81 }; |
| 82 FontResource(const ResourceRequest&, const ResourceLoaderOptions&); | 82 FontResource(const ResourceRequest&, const ResourceLoaderOptions&); |
| 83 | 83 |
| 84 void checkNotify() override; | 84 void checkNotify() override; |
| 85 void fontLoadShortLimitCallback(Timer<FontResource>*); | 85 void fontLoadShortLimitCallback(Timer<FontResource>*); |
| 86 void fontLoadLongLimitCallback(Timer<FontResource>*); | 86 void fontLoadLongLimitCallback(Timer<FontResource>*); |
| 87 | 87 |
| 88 enum LoadLimitState { UnderLimit, ShortLimitExceeded, LongLimitExceeded }; | 88 enum LoadLimitState { UnderLimit, ShortLimitExceeded, LongLimitExceeded }; |
| 89 | 89 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 106 ResourceClientType getResourceClientType() const final { return FontType; } | 106 ResourceClientType getResourceClientType() const final { return FontType; } |
| 107 virtual void fontLoaded(FontResource*) {} | 107 virtual void fontLoaded(FontResource*) {} |
| 108 virtual void didStartFontLoad(FontResource*) {} | 108 virtual void didStartFontLoad(FontResource*) {} |
| 109 virtual void fontLoadShortLimitExceeded(FontResource*) {} | 109 virtual void fontLoadShortLimitExceeded(FontResource*) {} |
| 110 virtual void fontLoadLongLimitExceeded(FontResource*) {} | 110 virtual void fontLoadLongLimitExceeded(FontResource*) {} |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 } // namespace blink | 113 } // namespace blink |
| 114 | 114 |
| 115 #endif | 115 #endif |
| OLD | NEW |