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 23 matching lines...) Expand all Loading... |
34 #include "wtf/OwnPtr.h" | 34 #include "wtf/OwnPtr.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 class Document; | 38 class Document; |
39 class ResourceFetcher; | 39 class ResourceFetcher; |
40 class FontPlatformData; | 40 class FontPlatformData; |
41 class SVGFontElement; | 41 class SVGFontElement; |
42 class FontCustomPlatformData; | 42 class FontCustomPlatformData; |
43 | 43 |
44 class FontResource FINAL : public Resource { | 44 class FontResource final : public Resource { |
45 public: | 45 public: |
46 typedef ResourceClient ClientType; | 46 typedef ResourceClient ClientType; |
47 | 47 |
48 FontResource(const ResourceRequest&); | 48 FontResource(const ResourceRequest&); |
49 virtual ~FontResource(); | 49 virtual ~FontResource(); |
50 virtual void trace(Visitor*) OVERRIDE; | 50 virtual void trace(Visitor*) override; |
51 | 51 |
52 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&) OVERRIDE; | 52 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&) override; |
53 | 53 |
54 virtual void didAddClient(ResourceClient*) OVERRIDE; | 54 virtual void didAddClient(ResourceClient*) override; |
55 | 55 |
56 virtual void allClientsRemoved() OVERRIDE; | 56 virtual void allClientsRemoved() override; |
57 void beginLoadIfNeeded(ResourceFetcher* dl); | 57 void beginLoadIfNeeded(ResourceFetcher* dl); |
58 virtual bool stillNeedsLoad() const OVERRIDE { return m_state != LoadInitiat
ed; } | 58 virtual bool stillNeedsLoad() const override { return m_state != LoadInitiat
ed; } |
59 bool exceedsFontLoadWaitLimit() const { return m_exceedsFontLoadWaitLimit; } | 59 bool exceedsFontLoadWaitLimit() const { return m_exceedsFontLoadWaitLimit; } |
60 | 60 |
61 bool loadScheduled() const { return m_state != Unloaded; } | 61 bool loadScheduled() const { return m_state != Unloaded; } |
62 void didScheduleLoad(); | 62 void didScheduleLoad(); |
63 void didUnscheduleLoad(); | 63 void didUnscheduleLoad(); |
64 | 64 |
65 void setCORSFailed() { m_corsFailed = true; } | 65 void setCORSFailed() { m_corsFailed = true; } |
66 bool isCORSFailed() const { return m_corsFailed; } | 66 bool isCORSFailed() const { return m_corsFailed; } |
67 | 67 |
68 bool ensureCustomFontData(); | 68 bool ensureCustomFontData(); |
69 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital
ic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth); | 69 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital
ic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth); |
70 | 70 |
71 #if ENABLE(SVG_FONTS) | 71 #if ENABLE(SVG_FONTS) |
72 bool ensureSVGFontData(); | 72 bool ensureSVGFontData(); |
73 SVGFontElement* getSVGFontById(const String&) const; | 73 SVGFontElement* getSVGFontById(const String&) const; |
74 #endif | 74 #endif |
75 | 75 |
76 protected: | 76 protected: |
77 virtual bool isSafeToUnlock() const OVERRIDE; | 77 virtual bool isSafeToUnlock() const override; |
78 | 78 |
79 private: | 79 private: |
80 virtual void checkNotify() OVERRIDE; | 80 virtual void checkNotify() override; |
81 void fontLoadWaitLimitCallback(Timer<FontResource>*); | 81 void fontLoadWaitLimitCallback(Timer<FontResource>*); |
82 | 82 |
83 enum State { Unloaded, LoadScheduled, LoadInitiated }; | 83 enum State { Unloaded, LoadScheduled, LoadInitiated }; |
84 | 84 |
85 OwnPtr<FontCustomPlatformData> m_fontData; | 85 OwnPtr<FontCustomPlatformData> m_fontData; |
86 State m_state; | 86 State m_state; |
87 bool m_exceedsFontLoadWaitLimit; | 87 bool m_exceedsFontLoadWaitLimit; |
88 bool m_corsFailed; | 88 bool m_corsFailed; |
89 Timer<FontResource> m_fontLoadWaitLimitTimer; | 89 Timer<FontResource> m_fontLoadWaitLimitTimer; |
90 | 90 |
91 #if ENABLE(SVG_FONTS) | 91 #if ENABLE(SVG_FONTS) |
92 RefPtrWillBeMember<Document> m_externalSVGDocument; | 92 RefPtrWillBeMember<Document> m_externalSVGDocument; |
93 #endif | 93 #endif |
94 | 94 |
95 friend class MemoryCache; | 95 friend class MemoryCache; |
96 }; | 96 }; |
97 | 97 |
98 DEFINE_RESOURCE_TYPE_CASTS(Font); | 98 DEFINE_RESOURCE_TYPE_CASTS(Font); |
99 | 99 |
100 class FontResourceClient : public ResourceClient { | 100 class FontResourceClient : public ResourceClient { |
101 public: | 101 public: |
102 virtual ~FontResourceClient() { } | 102 virtual ~FontResourceClient() { } |
103 static ResourceClientType expectedType() { return FontType; } | 103 static ResourceClientType expectedType() { return FontType; } |
104 virtual ResourceClientType resourceClientType() const OVERRIDE FINAL { retur
n expectedType(); } | 104 virtual ResourceClientType resourceClientType() const override final { retur
n expectedType(); } |
105 virtual void fontLoaded(FontResource*) { } | 105 virtual void fontLoaded(FontResource*) { } |
106 virtual void didStartFontLoad(FontResource*) { } | 106 virtual void didStartFontLoad(FontResource*) { } |
107 virtual void fontLoadWaitLimitExceeded(FontResource*) { } | 107 virtual void fontLoadWaitLimitExceeded(FontResource*) { } |
108 }; | 108 }; |
109 | 109 |
110 } | 110 } |
111 | 111 |
112 #endif | 112 #endif |
OLD | NEW |