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

Side by Side Diff: Source/core/css/FontLoader.cpp

Issue 321403003: Notify font loads via FontLoader (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/FontLoader.h ('k') | Source/core/css/RemoteFontFaceSource.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "core/css/FontLoader.h" 6 #include "core/css/FontLoader.h"
7 7
8 #include "core/css/CSSFontSelector.h"
8 #include "core/fetch/FontResource.h" 9 #include "core/fetch/FontResource.h"
9 #include "core/fetch/ResourceFetcher.h" 10 #include "core/fetch/ResourceFetcher.h"
10 11
11 namespace WebCore { 12 namespace WebCore {
12 13
13 FontLoader::FontLoader(ResourceFetcher* resourceFetcher) 14 FontLoader::FontLoader(CSSFontSelector* fontSelector, ResourceFetcher* resourceF etcher)
14 : m_beginLoadingTimer(this, &FontLoader::beginLoadTimerFired) 15 : m_beginLoadingTimer(this, &FontLoader::beginLoadTimerFired)
16 , m_fontSelector(fontSelector)
15 , m_resourceFetcher(resourceFetcher) 17 , m_resourceFetcher(resourceFetcher)
16 { 18 {
17 } 19 }
18 20
19 FontLoader::~FontLoader() 21 FontLoader::~FontLoader()
20 { 22 {
21 #if ENABLE(OILPAN) 23 #if ENABLE(OILPAN)
22 if (!m_resourceFetcher) { 24 if (!m_resourceFetcher) {
23 ASSERT(m_fontsToBeginLoading.isEmpty()); 25 ASSERT(m_fontsToBeginLoading.isEmpty());
24 return; 26 return;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 for (FontsToLoadVector::iterator it = fontsToBeginLoading.begin(); it != fon tsToBeginLoading.end(); ++it) { 58 for (FontsToLoadVector::iterator it = fontsToBeginLoading.begin(); it != fon tsToBeginLoading.end(); ++it) {
57 FontResource* fontResource = it->first.get(); 59 FontResource* fontResource = it->first.get();
58 fontResource->beginLoadIfNeeded(m_resourceFetcher); 60 fontResource->beginLoadIfNeeded(m_resourceFetcher);
59 } 61 }
60 62
61 // When the local fontsToBeginLoading vector goes out of scope it will 63 // When the local fontsToBeginLoading vector goes out of scope it will
62 // decrement the request counts on the ResourceFetcher for all the fonts 64 // decrement the request counts on the ResourceFetcher for all the fonts
63 // that were just loaded. 65 // that were just loaded.
64 } 66 }
65 67
68 void FontLoader::fontFaceInvalidated()
69 {
70 if (m_fontSelector)
71 m_fontSelector->fontFaceInvalidated();
72 }
73
66 #if !ENABLE(OILPAN) 74 #if !ENABLE(OILPAN)
67 void FontLoader::clearResourceFetcher() 75 void FontLoader::clearResourceFetcher()
bashi 2014/06/18 07:27:45 nit: we might want to rename this method.
Kunihiko Sakamoto 2014/06/18 08:21:25 Renamed to clearResourceFetcherAndFontSelector (co
68 { 76 {
69 if (!m_resourceFetcher) { 77 if (!m_resourceFetcher) {
70 ASSERT(m_fontsToBeginLoading.isEmpty()); 78 ASSERT(m_fontsToBeginLoading.isEmpty());
71 return; 79 return;
72 } 80 }
73 81
74 m_beginLoadingTimer.stop(); 82 m_beginLoadingTimer.stop();
75 m_fontsToBeginLoading.clear(); 83 m_fontsToBeginLoading.clear();
76 m_resourceFetcher = nullptr; 84 m_resourceFetcher = nullptr;
85 m_fontSelector = nullptr;
77 } 86 }
78 #endif 87 #endif
79 88
80 void FontLoader::trace(Visitor* visitor) 89 void FontLoader::trace(Visitor* visitor)
81 { 90 {
82 visitor->trace(m_resourceFetcher); 91 visitor->trace(m_resourceFetcher);
92 visitor->trace(m_fontSelector);
83 } 93 }
84 94
85 } // namespace WebCore 95 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/FontLoader.h ('k') | Source/core/css/RemoteFontFaceSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698