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 "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/css/CSSFontSelector.h" |
9 #include "core/fetch/FontResource.h" | 9 #include "core/fetch/FontResource.h" |
10 #include "core/fetch/ResourceFetcher.h" | 10 #include "core/fetch/ResourceFetcher.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 { | 48 { |
49 loadPendingFonts(); | 49 loadPendingFonts(); |
50 } | 50 } |
51 | 51 |
52 void FontLoader::loadPendingFonts() | 52 void FontLoader::loadPendingFonts() |
53 { | 53 { |
54 ASSERT(m_resourceFetcher); | 54 ASSERT(m_resourceFetcher); |
55 | 55 |
56 FontsToLoadVector fontsToBeginLoading; | 56 FontsToLoadVector fontsToBeginLoading; |
57 fontsToBeginLoading.swap(m_fontsToBeginLoading); | 57 fontsToBeginLoading.swap(m_fontsToBeginLoading); |
58 for (FontsToLoadVector::iterator it = fontsToBeginLoading.begin(); it != fon
tsToBeginLoading.end(); ++it) { | 58 for (const auto& item : fontsToBeginLoading) { |
59 FontResource* fontResource = it->first.get(); | 59 FontResource* fontResource = item.first.get(); |
60 fontResource->beginLoadIfNeeded(m_resourceFetcher); | 60 fontResource->beginLoadIfNeeded(m_resourceFetcher); |
61 } | 61 } |
62 | 62 |
63 // When the local fontsToBeginLoading vector goes out of scope it will | 63 // When the local fontsToBeginLoading vector goes out of scope it will |
64 // decrement the request counts on the ResourceFetcher for all the fonts | 64 // decrement the request counts on the ResourceFetcher for all the fonts |
65 // that were just loaded. | 65 // that were just loaded. |
66 } | 66 } |
67 | 67 |
68 void FontLoader::fontFaceInvalidated() | 68 void FontLoader::fontFaceInvalidated() |
69 { | 69 { |
(...skipping 11 matching lines...) Expand all Loading... |
81 | 81 |
82 m_beginLoadingTimer.stop(); | 82 m_beginLoadingTimer.stop(); |
83 clearPendingFonts(); | 83 clearPendingFonts(); |
84 m_resourceFetcher = nullptr; | 84 m_resourceFetcher = nullptr; |
85 m_fontSelector = nullptr; | 85 m_fontSelector = nullptr; |
86 } | 86 } |
87 #endif | 87 #endif |
88 | 88 |
89 void FontLoader::clearPendingFonts() | 89 void FontLoader::clearPendingFonts() |
90 { | 90 { |
91 for (FontsToLoadVector::iterator it = m_fontsToBeginLoading.begin(); it != m
_fontsToBeginLoading.end(); ++it) | 91 for (const auto& item : m_fontsToBeginLoading) |
92 it->first->didUnscheduleLoad(); | 92 item.first->didUnscheduleLoad(); |
93 m_fontsToBeginLoading.clear(); | 93 m_fontsToBeginLoading.clear(); |
94 } | 94 } |
95 | 95 |
96 void FontLoader::trace(Visitor* visitor) | 96 void FontLoader::trace(Visitor* visitor) |
97 { | 97 { |
98 visitor->trace(m_resourceFetcher); | 98 visitor->trace(m_resourceFetcher); |
99 visitor->trace(m_fontSelector); | 99 visitor->trace(m_fontSelector); |
100 } | 100 } |
101 | 101 |
102 } // namespace blink | 102 } // namespace blink |
OLD | NEW |