| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 void RemoteFontFaceSource::beginLoadIfNeeded() { | 243 void RemoteFontFaceSource::beginLoadIfNeeded() { |
| 244 if (m_fontSelector->document() && m_font->stillNeedsLoad()) { | 244 if (m_fontSelector->document() && m_font->stillNeedsLoad()) { |
| 245 if (!m_font->url().protocolIsData() && !m_font->isLoaded() && | 245 if (!m_font->url().protocolIsData() && !m_font->isLoaded() && |
| 246 m_display == FontDisplayAuto && | 246 m_display == FontDisplayAuto && |
| 247 m_font->isLowPriorityLoadingAllowedForRemoteFont()) { | 247 m_font->isLowPriorityLoadingAllowedForRemoteFont()) { |
| 248 // Set the loading priority to VeryLow since this font is not required | 248 // Set the loading priority to VeryLow since this font is not required |
| 249 // for painting the text. | 249 // for painting the text. |
| 250 m_font->didChangePriority(ResourceLoadPriorityVeryLow, 0); | 250 m_font->didChangePriority(ResourceLoadPriorityVeryLow, 0); |
| 251 } | 251 } |
| 252 m_fontSelector->document()->fetcher()->startLoad(m_font); | 252 if (m_fontSelector->document()->fetcher()->startLoad(m_font)) { |
| 253 if (!m_font->isLoaded()) | 253 // Start timers only when load is actually started asynchronously. |
| 254 m_font->startLoadLimitTimers(); | 254 if (!m_font->isLoaded()) |
| 255 m_histograms.loadStarted(); | 255 m_font->startLoadLimitTimers(); |
| 256 m_histograms.loadStarted(); |
| 257 } |
| 256 } | 258 } |
| 257 | 259 |
| 258 if (m_face) | 260 if (m_face) |
| 259 m_face->didBeginLoad(); | 261 m_face->didBeginLoad(); |
| 260 } | 262 } |
| 261 | 263 |
| 262 DEFINE_TRACE(RemoteFontFaceSource) { | 264 DEFINE_TRACE(RemoteFontFaceSource) { |
| 263 visitor->trace(m_font); | 265 visitor->trace(m_font); |
| 264 visitor->trace(m_fontSelector); | 266 visitor->trace(m_fontSelector); |
| 265 CSSFontFaceSource::trace(visitor); | 267 CSSFontFaceSource::trace(visitor); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 return Miss; | 466 return Miss; |
| 465 case FromUnknown: | 467 case FromUnknown: |
| 466 // Fall through. | 468 // Fall through. |
| 467 default: | 469 default: |
| 468 NOTREACHED(); | 470 NOTREACHED(); |
| 469 } | 471 } |
| 470 return Miss; | 472 return Miss; |
| 471 } | 473 } |
| 472 | 474 |
| 473 } // namespace blink | 475 } // namespace blink |
| OLD | NEW |