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

Side by Side Diff: sky/engine/core/css/RemoteFontFaceSource.h

Issue 1223843003: Remove support for loading remote font faces (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « sky/engine/core/css/FontLoader.cpp ('k') | sky/engine/core/css/RemoteFontFaceSource.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef SKY_ENGINE_CORE_CSS_REMOTEFONTFACESOURCE_H_
6 #define SKY_ENGINE_CORE_CSS_REMOTEFONTFACESOURCE_H_
7
8 #include "sky/engine/core/css/CSSFontFaceSource.h"
9 #include "sky/engine/core/fetch/FontResource.h"
10 #include "sky/engine/core/fetch/ResourcePtr.h"
11
12 namespace blink {
13
14 class FontLoader;
15
16 class RemoteFontFaceSource : public CSSFontFaceSource, public FontResourceClient {
17 public:
18 explicit RemoteFontFaceSource(FontResource*, PassRefPtr<FontLoader>);
19 virtual ~RemoteFontFaceSource();
20
21 virtual FontResource* resource() override { return m_font.get(); }
22 virtual bool isLoading() const override;
23 virtual bool isLoaded() const override;
24 virtual bool isValid() const override;
25
26 void beginLoadIfNeeded() override;
27 virtual bool ensureFontData();
28
29 virtual void didStartFontLoad(FontResource*) override;
30 virtual void fontLoaded(FontResource*) override;
31 virtual void fontLoadWaitLimitExceeded(FontResource*) override;
32
33 // For UMA reporting
34 virtual bool hadBlankText() override { return m_histograms.hadBlankText(); }
35 void paintRequested() { m_histograms.fallbackFontPainted(); }
36
37 protected:
38 virtual PassRefPtr<SimpleFontData> createFontData(const FontDescription&) ov erride;
39 PassRefPtr<SimpleFontData> createLoadingFallbackFontData(const FontDescripti on&);
40 void pruneTable();
41
42 private:
43 class FontLoadHistograms {
44 public:
45 FontLoadHistograms() : m_loadStartTime(0), m_fallbackPaintTime(0) { }
46 void loadStarted();
47 void fallbackFontPainted();
48 void recordRemoteFont(const FontResource*);
49 void recordFallbackTime(const FontResource*);
50 bool hadBlankText() { return m_fallbackPaintTime; }
51 private:
52 const char* histogramName(const FontResource*);
53 double m_loadStartTime;
54 double m_fallbackPaintTime;
55 };
56
57 ResourcePtr<FontResource> m_font;
58 RefPtr<FontLoader> m_fontLoader;
59 FontLoadHistograms m_histograms;
60 };
61
62 } // namespace blink
63
64 #endif // SKY_ENGINE_CORE_CSS_REMOTEFONTFACESOURCE_H_
OLDNEW
« no previous file with comments | « sky/engine/core/css/FontLoader.cpp ('k') | sky/engine/core/css/RemoteFontFaceSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698