| 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" | |
| 11 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
| 12 | 11 |
| 13 namespace blink { | 12 namespace blink { |
| 14 | 13 |
| 15 class FontLoader; | 14 class FontLoader; |
| 16 | 15 |
| 17 enum FontDisplay { | 16 enum FontDisplay { |
| 18 FontDisplayAuto, | 17 FontDisplayAuto, |
| 19 FontDisplayBlock, | 18 FontDisplayBlock, |
| 20 FontDisplaySwap, | 19 FontDisplaySwap, |
| 21 FontDisplayFallback, | 20 FontDisplayFallback, |
| 22 FontDisplayOptional, | 21 FontDisplayOptional, |
| 23 FontDisplayEnumMax | 22 FontDisplayEnumMax |
| 24 }; | 23 }; |
| 25 | 24 |
| 26 class RemoteFontFaceSource final : public CSSFontFaceSource, public FontResource
Client { | 25 class RemoteFontFaceSource final : public CSSFontFaceSource, public FontResource
Client { |
| 27 WILL_BE_USING_PRE_FINALIZER(RemoteFontFaceSource, dispose); | 26 WILL_BE_USING_PRE_FINALIZER(RemoteFontFaceSource, dispose); |
| 28 public: | 27 public: |
| 29 enum DisplayPeriod { BlockPeriod, SwapPeriod, FailurePeriod }; | 28 enum DisplayPeriod { BlockPeriod, SwapPeriod, FailurePeriod }; |
| 30 | 29 |
| 31 explicit RemoteFontFaceSource(FontResource*, PassRefPtrWillBeRawPtr<FontLoad
er>, FontDisplay); | 30 explicit RemoteFontFaceSource(PassRefPtrWillBeRawPtr<FontResource>, PassRefP
trWillBeRawPtr<FontLoader>, FontDisplay); |
| 32 ~RemoteFontFaceSource() override; | 31 ~RemoteFontFaceSource() override; |
| 33 void dispose(); | 32 void dispose(); |
| 34 | 33 |
| 35 FontResource* resource() override { return m_font.get(); } | 34 FontResource* resource() override { return m_font.get(); } |
| 36 bool isLoading() const override; | 35 bool isLoading() const override; |
| 37 bool isLoaded() const override; | 36 bool isLoaded() const override; |
| 38 bool isValid() const override; | 37 bool isValid() const override; |
| 39 DisplayPeriod displayPeriod() const { return m_period; } | 38 DisplayPeriod displayPeriod() const { return m_period; } |
| 40 | 39 |
| 41 void beginLoadIfNeeded() override; | 40 void beginLoadIfNeeded() override; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 void recordLoadTimeHistogram(const FontResource*, int duration); | 72 void recordLoadTimeHistogram(const FontResource*, int duration); |
| 74 void recordInterventionResult(bool triggered); | 73 void recordInterventionResult(bool triggered); |
| 75 double m_loadStartTime; | 74 double m_loadStartTime; |
| 76 double m_fallbackPaintTime; | 75 double m_fallbackPaintTime; |
| 77 bool m_isLongLimitExceeded; | 76 bool m_isLongLimitExceeded; |
| 78 }; | 77 }; |
| 79 | 78 |
| 80 void switchToSwapPeriod(); | 79 void switchToSwapPeriod(); |
| 81 void switchToFailurePeriod(); | 80 void switchToFailurePeriod(); |
| 82 | 81 |
| 83 ResourcePtr<FontResource> m_font; | 82 RefPtrWillBeMember<FontResource> m_font; |
| 84 RefPtrWillBeMember<FontLoader> m_fontLoader; | 83 RefPtrWillBeMember<FontLoader> m_fontLoader; |
| 85 const FontDisplay m_display; | 84 const FontDisplay m_display; |
| 86 DisplayPeriod m_period; | 85 DisplayPeriod m_period; |
| 87 FontLoadHistograms m_histograms; | 86 FontLoadHistograms m_histograms; |
| 88 bool m_isInterventionTriggered; | 87 bool m_isInterventionTriggered; |
| 89 }; | 88 }; |
| 90 | 89 |
| 91 } // namespace blink | 90 } // namespace blink |
| 92 | 91 |
| 93 #endif | 92 #endif |
| OLD | NEW |