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

Side by Side Diff: Source/core/css/RemoteFontFaceSource.h

Issue 316353003: Remove font fetching fallback for CORS failures (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add/Update tests Created 6 years, 6 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 | « Source/core/css/CSSFontFaceSrcValue.cpp ('k') | Source/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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef RemoteFontFaceSource_h 5 #ifndef RemoteFontFaceSource_h
6 #define RemoteFontFaceSource_h 6 #define RemoteFontFaceSource_h
7 7
8 #include "core/css/CSSFontFaceSource.h" 8 #include "core/css/CSSFontFaceSource.h"
9 #include "core/fetch/FontResource.h" 9 #include "core/fetch/FontResource.h"
10 #include "core/fetch/ResourcePtr.h" 10 #include "core/fetch/ResourcePtr.h"
(...skipping 15 matching lines...) Expand all
26 void beginLoadIfNeeded() OVERRIDE; 26 void beginLoadIfNeeded() OVERRIDE;
27 virtual bool ensureFontData(); 27 virtual bool ensureFontData();
28 28
29 #if ENABLE(SVG_FONTS) 29 #if ENABLE(SVG_FONTS)
30 virtual bool isSVGFontFaceSource() const { return false; } 30 virtual bool isSVGFontFaceSource() const { return false; }
31 #endif 31 #endif
32 32
33 virtual void didStartFontLoad(FontResource*) OVERRIDE; 33 virtual void didStartFontLoad(FontResource*) OVERRIDE;
34 virtual void fontLoaded(FontResource*) OVERRIDE; 34 virtual void fontLoaded(FontResource*) OVERRIDE;
35 virtual void fontLoadWaitLimitExceeded(FontResource*) OVERRIDE; 35 virtual void fontLoadWaitLimitExceeded(FontResource*) OVERRIDE;
36 virtual void corsFailed(FontResource*) OVERRIDE;
37 36
38 // For UMA reporting 37 // For UMA reporting
39 virtual bool hadBlankText() OVERRIDE { return m_histograms.hadBlankText(); } 38 virtual bool hadBlankText() OVERRIDE { return m_histograms.hadBlankText(); }
40 void paintRequested() { m_histograms.fallbackFontPainted(); } 39 void paintRequested() { m_histograms.fallbackFontPainted(); }
41 40
42 virtual void trace(Visitor*) OVERRIDE; 41 virtual void trace(Visitor*) OVERRIDE;
43 42
44 protected: 43 protected:
45 virtual PassRefPtr<SimpleFontData> createFontData(const FontDescription&) OV ERRIDE; 44 virtual PassRefPtr<SimpleFontData> createFontData(const FontDescription&) OV ERRIDE;
46 PassRefPtr<SimpleFontData> createLoadingFallbackFontData(const FontDescripti on&); 45 PassRefPtr<SimpleFontData> createLoadingFallbackFontData(const FontDescripti on&);
47 void pruneTable(); 46 void pruneTable();
48 47
49 private: 48 private:
50 class FontLoadHistograms { 49 class FontLoadHistograms {
51 public: 50 public:
52 FontLoadHistograms() : m_loadStartTime(0), m_fallbackPaintTime(0), m_cor sFailed(false) { } 51 FontLoadHistograms() : m_loadStartTime(0), m_fallbackPaintTime(0) { }
53 void loadStarted(); 52 void loadStarted();
54 void fallbackFontPainted(); 53 void fallbackFontPainted();
55 void recordRemoteFont(const FontResource*); 54 void recordRemoteFont(const FontResource*);
56 void recordFallbackTime(const FontResource*); 55 void recordFallbackTime(const FontResource*);
57 void corsFailed() { m_corsFailed = true; }
58 bool hadBlankText() { return m_fallbackPaintTime; } 56 bool hadBlankText() { return m_fallbackPaintTime; }
59 private: 57 private:
60 const char* histogramName(const FontResource*); 58 const char* histogramName(const FontResource*);
61 double m_loadStartTime; 59 double m_loadStartTime;
62 double m_fallbackPaintTime; 60 double m_fallbackPaintTime;
63 bool m_corsFailed;
64 }; 61 };
65 62
66 ResourcePtr<FontResource> m_font; 63 ResourcePtr<FontResource> m_font;
67 RefPtrWillBeMember<FontLoader> m_fontLoader; 64 RefPtrWillBeMember<FontLoader> m_fontLoader;
68 FontLoadHistograms m_histograms; 65 FontLoadHistograms m_histograms;
69 }; 66 };
70 67
71 } // namespace WebCore 68 } // namespace WebCore
72 69
73 #endif 70 #endif
OLDNEW
« no previous file with comments | « Source/core/css/CSSFontFaceSrcValue.cpp ('k') | Source/core/css/RemoteFontFaceSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698