| 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 #include "core/css/RemoteFontFaceSource.h" | 5 #include "core/css/RemoteFontFaceSource.h" |
| 6 | 6 |
| 7 #include "core/css/CSSCustomFontData.h" | 7 #include "core/css/CSSCustomFontData.h" |
| 8 #include "core/css/CSSFontFace.h" | 8 #include "core/css/CSSFontFace.h" |
| 9 #include "core/css/CSSFontSelector.h" | 9 #include "core/css/CSSFontSelector.h" |
| 10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 , m_isInterventionTriggered(false) | 27 , m_isInterventionTriggered(false) |
| 28 { | 28 { |
| 29 ThreadState::current()->registerPreFinalizer(this); | 29 ThreadState::current()->registerPreFinalizer(this); |
| 30 m_font->addClient(this); | 30 m_font->addClient(this); |
| 31 | 31 |
| 32 // TODO(crbug.com/578029): Connect NQE signal for V2 mode. | 32 // TODO(crbug.com/578029): Connect NQE signal for V2 mode. |
| 33 bool triggered = RuntimeEnabledFeatures::webFontsInterventionV2Enabled() ? f
alse : networkStateNotifier().connectionType() == WebConnectionTypeCellular2G; | 33 bool triggered = RuntimeEnabledFeatures::webFontsInterventionV2Enabled() ? f
alse : networkStateNotifier().connectionType() == WebConnectionTypeCellular2G; |
| 34 if (RuntimeEnabledFeatures::webFontsInterventionTriggerEnabled() || (trigger
ed && display == FontDisplayAuto)) { | 34 if (RuntimeEnabledFeatures::webFontsInterventionTriggerEnabled() || (trigger
ed && display == FontDisplayAuto)) { |
| 35 m_isInterventionTriggered = true; | 35 m_isInterventionTriggered = true; |
| 36 m_period = SwapPeriod; | 36 m_period = SwapPeriod; |
| 37 m_fontSelector->document()->addConsoleMessage(ConsoleMessage::create(Oth
erMessageSource, InfoMessageLevel, "Slow network is detected. Fallback font will
be used while loading: " + m_font->url().elidedString())); |
| 37 } | 38 } |
| 38 } | 39 } |
| 39 | 40 |
| 40 RemoteFontFaceSource::~RemoteFontFaceSource() | 41 RemoteFontFaceSource::~RemoteFontFaceSource() |
| 41 { | 42 { |
| 42 } | 43 } |
| 43 | 44 |
| 44 void RemoteFontFaceSource::dispose() | 45 void RemoteFontFaceSource::dispose() |
| 45 { | 46 { |
| 46 m_font->removeClient(this); | 47 m_font->removeClient(this); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 interventionResult |= 1 << 0; | 284 interventionResult |= 1 << 0; |
| 284 if (triggered) | 285 if (triggered) |
| 285 interventionResult |= 1 << 1; | 286 interventionResult |= 1 << 1; |
| 286 const int boundary = 1 << 2; | 287 const int boundary = 1 << 2; |
| 287 | 288 |
| 288 DEFINE_STATIC_LOCAL(EnumerationHistogram, interventionHistogram, ("WebFont.I
nterventionResult", boundary)); | 289 DEFINE_STATIC_LOCAL(EnumerationHistogram, interventionHistogram, ("WebFont.I
nterventionResult", boundary)); |
| 289 interventionHistogram.count(interventionResult); | 290 interventionHistogram.count(interventionResult); |
| 290 } | 291 } |
| 291 | 292 |
| 292 } // namespace blink | 293 } // namespace blink |
| OLD | NEW |