Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(869)

Side by Side Diff: Source/core/fetch/FontResource.h

Issue 230383003: Webfont CORS-enabled fetching with fallback (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add invalidator, retry only CORS failure Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&) OVERRIDE; 51 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&) OVERRIDE;
52 52
53 virtual void didAddClient(ResourceClient*) OVERRIDE; 53 virtual void didAddClient(ResourceClient*) OVERRIDE;
54 54
55 virtual void allClientsRemoved() OVERRIDE; 55 virtual void allClientsRemoved() OVERRIDE;
56 void beginLoadIfNeeded(ResourceFetcher* dl); 56 void beginLoadIfNeeded(ResourceFetcher* dl);
57 virtual bool stillNeedsLoad() const OVERRIDE { return !m_loadInitiated; } 57 virtual bool stillNeedsLoad() const OVERRIDE { return !m_loadInitiated; }
58 bool exceedsFontLoadWaitLimit() const { return m_exceedsFontLoadWaitLimit; } 58 bool exceedsFontLoadWaitLimit() const { return m_exceedsFontLoadWaitLimit; }
59 59
60 void setCORSFailed() { m_corsFailed = true; }
61
60 bool ensureCustomFontData(); 62 bool ensureCustomFontData();
61 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital ic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth); 63 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital ic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
62 64
63 #if ENABLE(SVG_FONTS) 65 #if ENABLE(SVG_FONTS)
64 bool ensureSVGFontData(); 66 bool ensureSVGFontData();
65 SVGFontElement* getSVGFontById(const String&) const; 67 SVGFontElement* getSVGFontById(const String&) const;
66 #endif 68 #endif
67 69
68 protected: 70 protected:
69 virtual bool isSafeToUnlock() const OVERRIDE; 71 virtual bool isSafeToUnlock() const OVERRIDE;
70 72
71 private: 73 private:
72 virtual void checkNotify() OVERRIDE; 74 virtual void checkNotify() OVERRIDE;
73 void fontLoadWaitLimitCallback(Timer<FontResource>*); 75 void fontLoadWaitLimitCallback(Timer<FontResource>*);
74 76
75 OwnPtr<FontCustomPlatformData> m_fontData; 77 OwnPtr<FontCustomPlatformData> m_fontData;
76 bool m_loadInitiated; 78 bool m_loadInitiated;
77 bool m_exceedsFontLoadWaitLimit; 79 bool m_exceedsFontLoadWaitLimit;
80 bool m_corsFailed;
78 Timer<FontResource> m_fontLoadWaitLimitTimer; 81 Timer<FontResource> m_fontLoadWaitLimitTimer;
79 82
80 #if ENABLE(SVG_FONTS) 83 #if ENABLE(SVG_FONTS)
81 RefPtr<WebCore::SVGDocument> m_externalSVGDocument; 84 RefPtr<WebCore::SVGDocument> m_externalSVGDocument;
82 #endif 85 #endif
83 86
84 friend class MemoryCache; 87 friend class MemoryCache;
85 }; 88 };
86 89
87 DEFINE_RESOURCE_TYPE_CASTS(Font); 90 DEFINE_RESOURCE_TYPE_CASTS(Font);
88 91
89 class FontResourceClient : public ResourceClient { 92 class FontResourceClient : public ResourceClient {
90 public: 93 public:
91 virtual ~FontResourceClient() { } 94 virtual ~FontResourceClient() { }
92 static ResourceClientType expectedType() { return FontType; } 95 static ResourceClientType expectedType() { return FontType; }
93 virtual ResourceClientType resourceClientType() const OVERRIDE FINAL { retur n expectedType(); } 96 virtual ResourceClientType resourceClientType() const OVERRIDE FINAL { retur n expectedType(); }
94 virtual void fontLoaded(FontResource*) { } 97 virtual void fontLoaded(FontResource*) { }
95 virtual void didStartFontLoad(FontResource*) { } 98 virtual void didStartFontLoad(FontResource*) { }
96 virtual void fontLoadWaitLimitExceeded(FontResource*) { } 99 virtual void fontLoadWaitLimitExceeded(FontResource*) { }
100 virtual void corsFailed(FontResource*) { }
97 }; 101 };
98 102
99 } 103 }
100 104
101 #endif 105 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698