Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: third_party/WebKit/Source/core/css/RemoteFontFaceSource.cpp

Issue 1889973002: Refactoring starting a resource load (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/page/NetworkStateNotifier.h" 13 #include "core/page/NetworkStateNotifier.h"
13 #include "platform/Histogram.h" 14 #include "platform/Histogram.h"
14 #include "platform/RuntimeEnabledFeatures.h" 15 #include "platform/RuntimeEnabledFeatures.h"
15 #include "platform/fonts/FontCache.h" 16 #include "platform/fonts/FontCache.h"
16 #include "platform/fonts/FontDescription.h" 17 #include "platform/fonts/FontDescription.h"
17 #include "platform/fonts/SimpleFontData.h" 18 #include "platform/fonts/SimpleFontData.h"
18 #include "wtf/CurrentTime.h" 19 #include "wtf/CurrentTime.h"
19 20
20 namespace blink { 21 namespace blink {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 ASSERT_NOT_REACHED(); 168 ASSERT_NOT_REACHED();
168 return nullptr; 169 return nullptr;
169 } 170 }
170 RefPtr<CSSCustomFontData> cssFontData = CSSCustomFontData::create(this, m_pe riod == BlockPeriod ? CSSCustomFontData::InvisibleFallback : CSSCustomFontData:: VisibleFallback); 171 RefPtr<CSSCustomFontData> cssFontData = CSSCustomFontData::create(this, m_pe riod == BlockPeriod ? CSSCustomFontData::InvisibleFallback : CSSCustomFontData:: VisibleFallback);
171 return SimpleFontData::create(temporaryFont->platformData(), cssFontData); 172 return SimpleFontData::create(temporaryFont->platformData(), cssFontData);
172 } 173 }
173 174
174 void RemoteFontFaceSource::beginLoadIfNeeded() 175 void RemoteFontFaceSource::beginLoadIfNeeded()
175 { 176 {
176 if (m_fontSelector->document() && m_font->stillNeedsLoad()) { 177 if (m_fontSelector->document() && m_font->stillNeedsLoad()) {
177 m_font->load(m_fontSelector->document()->fetcher()); 178 m_fontSelector->document()->fetcher()->startLoad(m_font);
178 m_histograms.loadStarted(); 179 m_histograms.loadStarted();
179 } 180 }
180 m_font->startLoadLimitTimersIfNeeded(); 181 m_font->startLoadLimitTimersIfNeeded();
181 182
182 if (m_face) 183 if (m_face)
183 m_face->didBeginLoad(); 184 m_face->didBeginLoad();
184 } 185 }
185 186
186 DEFINE_TRACE(RemoteFontFaceSource) 187 DEFINE_TRACE(RemoteFontFaceSource)
187 { 188 {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 interventionResult |= 1 << 0; 289 interventionResult |= 1 << 0;
289 if (triggered) 290 if (triggered)
290 interventionResult |= 1 << 1; 291 interventionResult |= 1 << 1;
291 const int boundary = 1 << 2; 292 const int boundary = 1 << 2;
292 293
293 DEFINE_STATIC_LOCAL(EnumerationHistogram, interventionHistogram, ("WebFont.I nterventionResult", boundary)); 294 DEFINE_STATIC_LOCAL(EnumerationHistogram, interventionHistogram, ("WebFont.I nterventionResult", boundary));
294 interventionHistogram.count(interventionResult); 295 interventionHistogram.count(interventionResult);
295 } 296 }
296 297
297 } // namespace blink 298 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698