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

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

Issue 457273002: Webfonts should not block load event for more than one frame (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/FontLoader.cpp ('k') | Source/core/fetch/FontResource.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_loadInitiated; } 58 virtual bool stillNeedsLoad() const OVERRIDE { return !m_loadInitiated; }
59 bool exceedsFontLoadWaitLimit() const { return m_exceedsFontLoadWaitLimit; } 59 bool exceedsFontLoadWaitLimit() const { return m_exceedsFontLoadWaitLimit; }
60 60
61 bool loadScheduled() const { return m_loadScheduled; }
62 void setLoadScheduled(bool loadScheduled) { m_loadScheduled = loadScheduled; }
63
61 void setCORSFailed() { m_corsFailed = true; } 64 void setCORSFailed() { m_corsFailed = true; }
62 bool isCORSFailed() const { return m_corsFailed; } 65 bool isCORSFailed() const { return m_corsFailed; }
63 66
64 bool ensureCustomFontData(); 67 bool ensureCustomFontData();
65 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital ic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth); 68 FontPlatformData platformDataFromCustomData(float size, bool bold, bool ital ic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
66 69
67 #if ENABLE(SVG_FONTS) 70 #if ENABLE(SVG_FONTS)
68 bool ensureSVGFontData(); 71 bool ensureSVGFontData();
69 SVGFontElement* getSVGFontById(const String&) const; 72 SVGFontElement* getSVGFontById(const String&) const;
70 #endif 73 #endif
71 74
72 protected: 75 protected:
73 virtual bool isSafeToUnlock() const OVERRIDE; 76 virtual bool isSafeToUnlock() const OVERRIDE;
74 77
75 private: 78 private:
76 virtual void checkNotify() OVERRIDE; 79 virtual void checkNotify() OVERRIDE;
77 void fontLoadWaitLimitCallback(Timer<FontResource>*); 80 void fontLoadWaitLimitCallback(Timer<FontResource>*);
78 81
79 OwnPtr<FontCustomPlatformData> m_fontData; 82 OwnPtr<FontCustomPlatformData> m_fontData;
83 bool m_loadScheduled;
Nate Chapin 2014/08/14 17:33:06 Should m_loadScheduled and m_loadInitiated be merg
Kunihiko Sakamoto 2014/08/15 01:30:23 Done.
80 bool m_loadInitiated; 84 bool m_loadInitiated;
81 bool m_exceedsFontLoadWaitLimit; 85 bool m_exceedsFontLoadWaitLimit;
82 bool m_corsFailed; 86 bool m_corsFailed;
83 Timer<FontResource> m_fontLoadWaitLimitTimer; 87 Timer<FontResource> m_fontLoadWaitLimitTimer;
84 88
85 #if ENABLE(SVG_FONTS) 89 #if ENABLE(SVG_FONTS)
86 RefPtrWillBeMember<Document> m_externalSVGDocument; 90 RefPtrWillBeMember<Document> m_externalSVGDocument;
87 #endif 91 #endif
88 92
89 friend class MemoryCache; 93 friend class MemoryCache;
90 }; 94 };
91 95
92 DEFINE_RESOURCE_TYPE_CASTS(Font); 96 DEFINE_RESOURCE_TYPE_CASTS(Font);
93 97
94 class FontResourceClient : public ResourceClient { 98 class FontResourceClient : public ResourceClient {
95 public: 99 public:
96 virtual ~FontResourceClient() { } 100 virtual ~FontResourceClient() { }
97 static ResourceClientType expectedType() { return FontType; } 101 static ResourceClientType expectedType() { return FontType; }
98 virtual ResourceClientType resourceClientType() const OVERRIDE FINAL { retur n expectedType(); } 102 virtual ResourceClientType resourceClientType() const OVERRIDE FINAL { retur n expectedType(); }
99 virtual void fontLoaded(FontResource*) { } 103 virtual void fontLoaded(FontResource*) { }
100 virtual void didStartFontLoad(FontResource*) { } 104 virtual void didStartFontLoad(FontResource*) { }
101 virtual void fontLoadWaitLimitExceeded(FontResource*) { } 105 virtual void fontLoadWaitLimitExceeded(FontResource*) { }
102 }; 106 };
103 107
104 } 108 }
105 109
106 #endif 110 #endif
OLDNEW
« no previous file with comments | « Source/core/css/FontLoader.cpp ('k') | Source/core/fetch/FontResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698