| 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 "core/fetch/ResourcePtr.h" | 10 #include "core/fetch/ResourcePtr.h" |
| 11 #include "wtf/Allocator.h" |
| 11 | 12 |
| 12 namespace blink { | 13 namespace blink { |
| 13 | 14 |
| 14 class FontLoader; | 15 class FontLoader; |
| 15 | 16 |
| 16 class RemoteFontFaceSource final : public CSSFontFaceSource, public FontResource
Client { | 17 class RemoteFontFaceSource final : public CSSFontFaceSource, public FontResource
Client { |
| 17 public: | 18 public: |
| 18 explicit RemoteFontFaceSource(FontResource*, PassRefPtrWillBeRawPtr<FontLoad
er>); | 19 explicit RemoteFontFaceSource(FontResource*, PassRefPtrWillBeRawPtr<FontLoad
er>); |
| 19 ~RemoteFontFaceSource() override; | 20 ~RemoteFontFaceSource() override; |
| 20 | 21 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 35 | 36 |
| 36 DECLARE_VIRTUAL_TRACE(); | 37 DECLARE_VIRTUAL_TRACE(); |
| 37 | 38 |
| 38 protected: | 39 protected: |
| 39 PassRefPtr<SimpleFontData> createFontData(const FontDescription&) override; | 40 PassRefPtr<SimpleFontData> createFontData(const FontDescription&) override; |
| 40 PassRefPtr<SimpleFontData> createLoadingFallbackFontData(const FontDescripti
on&); | 41 PassRefPtr<SimpleFontData> createLoadingFallbackFontData(const FontDescripti
on&); |
| 41 void pruneTable(); | 42 void pruneTable(); |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 class FontLoadHistograms { | 45 class FontLoadHistograms { |
| 46 DISALLOW_ALLOCATION(); |
| 45 public: | 47 public: |
| 46 FontLoadHistograms() : m_loadStartTime(0), m_fallbackPaintTime(0) { } | 48 FontLoadHistograms() : m_loadStartTime(0), m_fallbackPaintTime(0) { } |
| 47 void loadStarted(); | 49 void loadStarted(); |
| 48 void fallbackFontPainted(); | 50 void fallbackFontPainted(); |
| 49 void recordRemoteFont(const FontResource*); | 51 void recordRemoteFont(const FontResource*); |
| 50 void recordFallbackTime(const FontResource*); | 52 void recordFallbackTime(const FontResource*); |
| 51 bool hadBlankText() { return m_fallbackPaintTime; } | 53 bool hadBlankText() { return m_fallbackPaintTime; } |
| 52 private: | 54 private: |
| 53 const char* histogramName(const FontResource*); | 55 const char* histogramName(const FontResource*); |
| 54 double m_loadStartTime; | 56 double m_loadStartTime; |
| 55 double m_fallbackPaintTime; | 57 double m_fallbackPaintTime; |
| 56 }; | 58 }; |
| 57 | 59 |
| 58 ResourcePtr<FontResource> m_font; | 60 ResourcePtr<FontResource> m_font; |
| 59 RefPtrWillBeMember<FontLoader> m_fontLoader; | 61 RefPtrWillBeMember<FontLoader> m_fontLoader; |
| 60 FontLoadHistograms m_histograms; | 62 FontLoadHistograms m_histograms; |
| 61 }; | 63 }; |
| 62 | 64 |
| 63 } // namespace blink | 65 } // namespace blink |
| 64 | 66 |
| 65 #endif | 67 #endif |
| OLD | NEW |