| OLD | NEW |
| 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 "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 void beginLoadIfNeeded() override; | 39 void beginLoadIfNeeded() override; |
| 40 | 40 |
| 41 void didStartFontLoad(FontResource*) override; | 41 void didStartFontLoad(FontResource*) override; |
| 42 void fontLoaded(FontResource*) override; | 42 void fontLoaded(FontResource*) override; |
| 43 void fontLoadShortLimitExceeded(FontResource*) override; | 43 void fontLoadShortLimitExceeded(FontResource*) override; |
| 44 void fontLoadLongLimitExceeded(FontResource*) override; | 44 void fontLoadLongLimitExceeded(FontResource*) override; |
| 45 String debugName() const override { return "RemoteFontFaceSource"; } | 45 String debugName() const override { return "RemoteFontFaceSource"; } |
| 46 | 46 |
| 47 // For UMA reporting | 47 // For UMA reporting |
| 48 bool hadBlankText() override { return m_histograms.hadBlankText(); } | 48 bool hadBlankText() override { return m_histograms.hadBlankText(); } |
| 49 void paintRequested() { m_histograms.fallbackFontPainted(); } | 49 void paintRequested() { m_histograms.fallbackFontPainted(m_period); } |
| 50 | 50 |
| 51 DECLARE_VIRTUAL_TRACE(); | 51 DECLARE_VIRTUAL_TRACE(); |
| 52 | 52 |
| 53 protected: | 53 protected: |
| 54 PassRefPtr<SimpleFontData> createFontData(const FontDescription&) override; | 54 PassRefPtr<SimpleFontData> createFontData(const FontDescription&) override; |
| 55 PassRefPtr<SimpleFontData> createLoadingFallbackFontData(const FontDescripti
on&); | 55 PassRefPtr<SimpleFontData> createLoadingFallbackFontData(const FontDescripti
on&); |
| 56 void pruneTable(); | 56 void pruneTable(); |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 class FontLoadHistograms { | 59 class FontLoadHistograms { |
| 60 DISALLOW_NEW(); | 60 DISALLOW_NEW(); |
| 61 public: | 61 public: |
| 62 FontLoadHistograms() : m_loadStartTime(0), m_fallbackPaintTime(0), m_isL
ongLimitExceeded(false) { } | 62 FontLoadHistograms() : m_loadStartTime(0), m_blankPaintTime(0), m_isLong
LimitExceeded(false) { } |
| 63 void loadStarted(); | 63 void loadStarted(); |
| 64 void fallbackFontPainted(); | 64 void fallbackFontPainted(DisplayPeriod); |
| 65 void fontLoaded(bool isInterventionTriggered); | 65 void fontLoaded(bool isInterventionTriggered); |
| 66 void longLimitExceeded(bool isInterventionTriggered); | 66 void longLimitExceeded(bool isInterventionTriggered); |
| 67 void recordFallbackTime(const FontResource*); | 67 void recordFallbackTime(const FontResource*); |
| 68 void recordRemoteFont(const FontResource*); | 68 void recordRemoteFont(const FontResource*); |
| 69 bool hadBlankText() { return m_fallbackPaintTime; } | 69 bool hadBlankText() { return m_blankPaintTime; } |
| 70 private: | 70 private: |
| 71 void recordLoadTimeHistogram(const FontResource*, int duration); | 71 void recordLoadTimeHistogram(const FontResource*, int duration); |
| 72 void recordInterventionResult(bool triggered); | 72 void recordInterventionResult(bool triggered); |
| 73 double m_loadStartTime; | 73 double m_loadStartTime; |
| 74 double m_fallbackPaintTime; | 74 double m_blankPaintTime; |
| 75 bool m_isLongLimitExceeded; | 75 bool m_isLongLimitExceeded; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 void switchToSwapPeriod(); | 78 void switchToSwapPeriod(); |
| 79 void switchToFailurePeriod(); | 79 void switchToFailurePeriod(); |
| 80 | 80 |
| 81 RefPtrWillBeMember<FontResource> m_font; | 81 RefPtrWillBeMember<FontResource> m_font; |
| 82 RefPtrWillBeMember<FontLoader> m_fontLoader; | 82 RefPtrWillBeMember<FontLoader> m_fontLoader; |
| 83 const FontDisplay m_display; | 83 const FontDisplay m_display; |
| 84 DisplayPeriod m_period; | 84 DisplayPeriod m_period; |
| 85 FontLoadHistograms m_histograms; | 85 FontLoadHistograms m_histograms; |
| 86 bool m_isInterventionTriggered; | 86 bool m_isInterventionTriggered; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 } // namespace blink | 89 } // namespace blink |
| 90 | 90 |
| 91 #endif | 91 #endif |
| OLD | NEW |