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

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

Issue 983973004: Provide user friendly messages for OTS parsing of fonts (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Comment fixes Created 5 years, 7 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 void beginLoadIfNeeded(ResourceFetcher* dl); 53 void beginLoadIfNeeded(ResourceFetcher* dl);
54 virtual bool stillNeedsLoad() const override { return m_state != LoadInitiat ed; } 54 virtual bool stillNeedsLoad() const override { return m_state != LoadInitiat ed; }
55 bool exceedsFontLoadWaitLimit() const { return m_exceedsFontLoadWaitLimit; } 55 bool exceedsFontLoadWaitLimit() const { return m_exceedsFontLoadWaitLimit; }
56 56
57 bool loadScheduled() const { return m_state != Unloaded; } 57 bool loadScheduled() const { return m_state != Unloaded; }
58 void didScheduleLoad(); 58 void didScheduleLoad();
59 void didUnscheduleLoad(); 59 void didUnscheduleLoad();
60 60
61 void setCORSFailed() { m_corsFailed = true; } 61 void setCORSFailed() { 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 64
64 bool ensureCustomFontData(); 65 bool ensureCustomFontData();
65 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);
66 67
67 protected: 68 protected:
68 virtual bool isSafeToUnlock() const override; 69 virtual bool isSafeToUnlock() const override;
69 70
70 private: 71 private:
71 virtual void checkNotify() override; 72 virtual void checkNotify() override;
72 void fontLoadWaitLimitCallback(Timer<FontResource>*); 73 void fontLoadWaitLimitCallback(Timer<FontResource>*);
73 74
74 enum State { Unloaded, LoadScheduled, LoadInitiated }; 75 enum State { Unloaded, LoadScheduled, LoadInitiated };
75 76
76 OwnPtr<FontCustomPlatformData> m_fontData; 77 OwnPtr<FontCustomPlatformData> m_fontData;
78 String m_otsParsingMessage;
77 State m_state; 79 State m_state;
78 bool m_exceedsFontLoadWaitLimit; 80 bool m_exceedsFontLoadWaitLimit;
79 bool m_corsFailed; 81 bool m_corsFailed;
80 Timer<FontResource> m_fontLoadWaitLimitTimer; 82 Timer<FontResource> m_fontLoadWaitLimitTimer;
81 83
82 friend class MemoryCache; 84 friend class MemoryCache;
83 }; 85 };
84 86
85 DEFINE_RESOURCE_TYPE_CASTS(Font); 87 DEFINE_RESOURCE_TYPE_CASTS(Font);
86 88
87 class FontResourceClient : public ResourceClient { 89 class FontResourceClient : public ResourceClient {
88 public: 90 public:
89 virtual ~FontResourceClient() { } 91 virtual ~FontResourceClient() { }
90 static ResourceClientType expectedType() { return FontType; } 92 static ResourceClientType expectedType() { return FontType; }
91 virtual ResourceClientType resourceClientType() const override final { retur n expectedType(); } 93 virtual ResourceClientType resourceClientType() const override final { retur n expectedType(); }
92 virtual void fontLoaded(FontResource*) { } 94 virtual void fontLoaded(FontResource*) { }
93 virtual void didStartFontLoad(FontResource*) { } 95 virtual void didStartFontLoad(FontResource*) { }
94 virtual void fontLoadWaitLimitExceeded(FontResource*) { } 96 virtual void fontLoadWaitLimitExceeded(FontResource*) { }
95 }; 97 };
96 98
97 } 99 }
98 100
99 #endif 101 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698