Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / css / FontLoader.h
bloba7e76342e925f878f587eee4bfc2732404102bd8
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef FontLoader_h
6 #define FontLoader_h
8 #include "core/fetch/ResourceLoader.h"
9 #include "core/fetch/ResourcePtr.h"
10 #include "platform/Timer.h"
11 #include "platform/heap/Handle.h"
12 #include "wtf/Vector.h"
14 namespace blink {
16 class CSSFontSelector;
17 class Document;
18 class FontResource;
20 class FontLoader : public RefCountedWillBeGarbageCollectedFinalized<FontLoader> {
21 public:
22 static PassRefPtrWillBeRawPtr<FontLoader> create(CSSFontSelector* fontSelector, Document* document)
24 return adoptRefWillBeNoop(new FontLoader(fontSelector, document));
26 ~FontLoader();
28 void addFontToBeginLoading(FontResource*);
29 void loadPendingFonts();
30 void fontFaceInvalidated();
31 void didFailToDecode(FontResource*);
33 #if !ENABLE(OILPAN)
34 void clearDocumentAndFontSelector();
35 #endif
37 DECLARE_TRACE();
39 private:
40 FontLoader(CSSFontSelector*, Document*);
41 void beginLoadTimerFired(Timer<FontLoader>*);
42 void clearPendingFonts();
44 Timer<FontLoader> m_beginLoadingTimer;
46 struct FontToLoad;
47 using FontsToLoadVector = Vector<OwnPtr<FontToLoad>>;
48 FontsToLoadVector m_fontsToBeginLoading;
49 RawPtrWillBeMember<CSSFontSelector> m_fontSelector;
50 RawPtrWillBeWeakMember<Document> m_document;
53 } // namespace blink
55 #endif // FontLoader_h