| 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" |
| 11 #include "core/fetch/ResourceFetcher.h" |
| 11 #include "core/inspector/ConsoleMessage.h" | 12 #include "core/inspector/ConsoleMessage.h" |
| 12 #include "core/loader/FrameLoaderClient.h" | 13 #include "core/loader/FrameLoaderClient.h" |
| 13 #include "core/page/NetworkStateNotifier.h" | 14 #include "core/page/NetworkStateNotifier.h" |
| 14 #include "platform/Histogram.h" | 15 #include "platform/Histogram.h" |
| 15 #include "platform/RuntimeEnabledFeatures.h" | 16 #include "platform/RuntimeEnabledFeatures.h" |
| 16 #include "platform/fonts/FontCache.h" | 17 #include "platform/fonts/FontCache.h" |
| 17 #include "platform/fonts/FontDescription.h" | 18 #include "platform/fonts/FontDescription.h" |
| 18 #include "platform/fonts/SimpleFontData.h" | 19 #include "platform/fonts/SimpleFontData.h" |
| 19 #include "public/platform/WebEffectiveConnectionType.h" | 20 #include "public/platform/WebEffectiveConnectionType.h" |
| 20 #include "wtf/CurrentTime.h" | 21 #include "wtf/CurrentTime.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 ASSERT_NOT_REACHED(); | 199 ASSERT_NOT_REACHED(); |
| 199 return nullptr; | 200 return nullptr; |
| 200 } | 201 } |
| 201 RefPtr<CSSCustomFontData> cssFontData = CSSCustomFontData::create(this, m_pe
riod == BlockPeriod ? CSSCustomFontData::InvisibleFallback : CSSCustomFontData::
VisibleFallback); | 202 RefPtr<CSSCustomFontData> cssFontData = CSSCustomFontData::create(this, m_pe
riod == BlockPeriod ? CSSCustomFontData::InvisibleFallback : CSSCustomFontData::
VisibleFallback); |
| 202 return SimpleFontData::create(temporaryFont->platformData(), cssFontData); | 203 return SimpleFontData::create(temporaryFont->platformData(), cssFontData); |
| 203 } | 204 } |
| 204 | 205 |
| 205 void RemoteFontFaceSource::beginLoadIfNeeded() | 206 void RemoteFontFaceSource::beginLoadIfNeeded() |
| 206 { | 207 { |
| 207 if (m_fontSelector->document() && m_font->stillNeedsLoad()) { | 208 if (m_fontSelector->document() && m_font->stillNeedsLoad()) { |
| 208 m_font->load(m_fontSelector->document()->fetcher()); | 209 m_fontSelector->document()->fetcher()->startLoad(m_font); |
| 209 m_histograms.loadStarted(); | 210 m_histograms.loadStarted(); |
| 210 } | 211 } |
| 211 m_font->startLoadLimitTimersIfNeeded(); | 212 m_font->startLoadLimitTimersIfNeeded(); |
| 212 | 213 |
| 213 if (m_face) | 214 if (m_face) |
| 214 m_face->didBeginLoad(); | 215 m_face->didBeginLoad(); |
| 215 } | 216 } |
| 216 | 217 |
| 217 DEFINE_TRACE(RemoteFontFaceSource) | 218 DEFINE_TRACE(RemoteFontFaceSource) |
| 218 { | 219 { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 interventionResult |= 1 << 0; | 319 interventionResult |= 1 << 0; |
| 319 if (triggered) | 320 if (triggered) |
| 320 interventionResult |= 1 << 1; | 321 interventionResult |= 1 << 1; |
| 321 const int boundary = 1 << 2; | 322 const int boundary = 1 << 2; |
| 322 | 323 |
| 323 DEFINE_STATIC_LOCAL(EnumerationHistogram, interventionHistogram, ("WebFont.I
nterventionResult", boundary)); | 324 DEFINE_STATIC_LOCAL(EnumerationHistogram, interventionHistogram, ("WebFont.I
nterventionResult", boundary)); |
| 324 interventionHistogram.count(interventionResult); | 325 interventionHistogram.count(interventionResult); |
| 325 } | 326 } |
| 326 | 327 |
| 327 } // namespace blink | 328 } // namespace blink |
| OLD | NEW |