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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSFontFace.h

Issue 2610593002: Make CSSFontFace::setLoadStatus post a task (Closed)
Patch Set: Change loading logic for fonts from array buffers Created 3 years, 11 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 class SimpleFontData; 44 class SimpleFontData;
45 45
46 class CORE_EXPORT CSSFontFace final 46 class CORE_EXPORT CSSFontFace final
47 : public GarbageCollectedFinalized<CSSFontFace> { 47 : public GarbageCollectedFinalized<CSSFontFace> {
48 WTF_MAKE_NONCOPYABLE(CSSFontFace); 48 WTF_MAKE_NONCOPYABLE(CSSFontFace);
49 49
50 public: 50 public:
51 CSSFontFace(FontFace* fontFace, Vector<UnicodeRange>& ranges) 51 CSSFontFace(FontFace* fontFace, Vector<UnicodeRange>& ranges)
52 : m_ranges(adoptRef(new UnicodeRangeSet(ranges))), 52 : m_ranges(adoptRef(new UnicodeRangeSet(ranges))),
53 m_segmentedFontFace(nullptr), 53 m_segmentedFontFace(nullptr),
54 m_fontFace(fontFace) { 54 m_fontFace(fontFace),
55 m_loadStatus(FontFace::Unloaded) {
55 ASSERT(m_fontFace); 56 ASSERT(m_fontFace);
56 } 57 }
57 58
58 FontFace* fontFace() const { return m_fontFace; } 59 FontFace* fontFace() const { return m_fontFace; }
59 60
60 PassRefPtr<UnicodeRangeSet> ranges() { return m_ranges; } 61 PassRefPtr<UnicodeRangeSet> ranges() { return m_ranges; }
61 62
62 void setSegmentedFontFace(CSSSegmentedFontFace*); 63 void setSegmentedFontFace(CSSSegmentedFontFace*);
63 void clearSegmentedFontFace() { m_segmentedFontFace = nullptr; } 64 void clearSegmentedFontFace() { m_segmentedFontFace = nullptr; }
64 65
65 bool isValid() const { return !m_sources.isEmpty(); } 66 bool isValid() const { return !m_sources.isEmpty(); }
66 size_t approximateBlankCharacterCount() const; 67 size_t approximateBlankCharacterCount() const;
67 68
68 void addSource(CSSFontFaceSource*); 69 void addSource(CSSFontFaceSource*);
69 70
70 void didBeginLoad(); 71 void didBeginLoad();
71 void fontLoaded(RemoteFontFaceSource*); 72 void fontLoaded(RemoteFontFaceSource*);
72 void didBecomeVisibleFallback(RemoteFontFaceSource*); 73 void didBecomeVisibleFallback(RemoteFontFaceSource*);
73 74
74 PassRefPtr<SimpleFontData> getFontData(const FontDescription&); 75 PassRefPtr<SimpleFontData> getFontData(const FontDescription&);
75 76
76 FontFace::LoadStatusType loadStatus() const { 77 FontFace::LoadStatusType loadStatus() const { return m_loadStatus; }
77 return m_fontFace->loadStatus();
78 }
79 bool maybeLoadFont(const FontDescription&, const String&); 78 bool maybeLoadFont(const FontDescription&, const String&);
80 bool maybeLoadFont(const FontDescription&, const FontDataForRangeSet&); 79 bool maybeLoadFont(const FontDescription&, const FontDataForRangeSet&);
81 void load(); 80 void load();
82 void load(const FontDescription&); 81 void load(const FontDescription&);
82 void setLoadStatus(FontFace::LoadStatusType);
83 83
84 bool hadBlankText() { return isValid() && m_sources.first()->hadBlankText(); } 84 bool hadBlankText() { return isValid() && m_sources.first()->hadBlankText(); }
85 85
86 DECLARE_TRACE(); 86 DECLARE_TRACE();
87 87
88 private: 88 private:
89 void setLoadStatus(FontFace::LoadStatusType); 89 void setLoadStatusHelper(FontFace::LoadStatusType);
90 90
91 RefPtr<UnicodeRangeSet> m_ranges; 91 RefPtr<UnicodeRangeSet> m_ranges;
92 Member<CSSSegmentedFontFace> m_segmentedFontFace; 92 Member<CSSSegmentedFontFace> m_segmentedFontFace;
93 HeapDeque<Member<CSSFontFaceSource>> m_sources; 93 HeapDeque<Member<CSSFontFaceSource>> m_sources;
94 Member<FontFace> m_fontFace; 94 Member<FontFace> m_fontFace;
95 FontFace::LoadStatusType m_loadStatus;
95 }; 96 };
96 97
97 } // namespace blink 98 } // namespace blink
98 99
99 #endif 100 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698