| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 : m_font(font), | 57 : m_font(font), |
| 58 m_fontSelector(fontSelector), | 58 m_fontSelector(fontSelector), |
| 59 m_display(display), | 59 m_display(display), |
| 60 m_period(display == FontDisplaySwap ? SwapPeriod : BlockPeriod), | 60 m_period(display == FontDisplaySwap ? SwapPeriod : BlockPeriod), |
| 61 m_histograms(font->url().protocolIsData() | 61 m_histograms(font->url().protocolIsData() |
| 62 ? FontLoadHistograms::FromDataURL | 62 ? FontLoadHistograms::FromDataURL |
| 63 : font->isLoaded() ? FontLoadHistograms::FromMemoryCache | 63 : font->isLoaded() ? FontLoadHistograms::FromMemoryCache |
| 64 : FontLoadHistograms::FromUnknown, | 64 : FontLoadHistograms::FromUnknown, |
| 65 m_display), | 65 m_display), |
| 66 m_isInterventionTriggered(false) { | 66 m_isInterventionTriggered(false) { |
| 67 ThreadState::current()->registerPreFinalizer(this); | |
| 68 m_font->addClient(this); | 67 m_font->addClient(this); |
| 69 | 68 |
| 70 if (shouldTriggerWebFontsIntervention()) { | 69 if (shouldTriggerWebFontsIntervention()) { |
| 71 m_isInterventionTriggered = true; | 70 m_isInterventionTriggered = true; |
| 72 m_period = SwapPeriod; | 71 m_period = SwapPeriod; |
| 73 m_fontSelector->document()->addConsoleMessage(ConsoleMessage::create( | 72 m_fontSelector->document()->addConsoleMessage(ConsoleMessage::create( |
| 74 OtherMessageSource, InfoMessageLevel, | 73 OtherMessageSource, InfoMessageLevel, |
| 75 "Slow network is detected. Fallback font will be used while loading: " + | 74 "Slow network is detected. Fallback font will be used while loading: " + |
| 76 m_font->url().elidedString())); | 75 m_font->url().elidedString())); |
| 77 } | 76 } |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 return Miss; | 465 return Miss; |
| 467 case FromUnknown: | 466 case FromUnknown: |
| 468 // Fall through. | 467 // Fall through. |
| 469 default: | 468 default: |
| 470 NOTREACHED(); | 469 NOTREACHED(); |
| 471 } | 470 } |
| 472 return Miss; | 471 return Miss; |
| 473 } | 472 } |
| 474 | 473 |
| 475 } // namespace blink | 474 } // namespace blink |
| OLD | NEW |