| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are met: | 5 * modification, are permitted provided that the following conditions are met: |
| 6 * | 6 * |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 m_asyncRunner->stop(); | 199 m_asyncRunner->stop(); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void FontFaceSet::beginFontLoading(FontFace* fontFace) { | 202 void FontFaceSet::beginFontLoading(FontFace* fontFace) { |
| 203 m_histogram.incrementCount(); | 203 m_histogram.incrementCount(); |
| 204 addToLoadingFonts(fontFace); | 204 addToLoadingFonts(fontFace); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void FontFaceSet::notifyLoaded(FontFace* fontFace) { | 207 void FontFaceSet::notifyLoaded(FontFace* fontFace) { |
| 208 m_histogram.updateStatus(fontFace); | 208 m_histogram.updateStatus(fontFace); |
| 209 m_loadedFonts.append(fontFace); | 209 m_loadedFonts.push_back(fontFace); |
| 210 removeFromLoadingFonts(fontFace); | 210 removeFromLoadingFonts(fontFace); |
| 211 } | 211 } |
| 212 | 212 |
| 213 void FontFaceSet::notifyError(FontFace* fontFace) { | 213 void FontFaceSet::notifyError(FontFace* fontFace) { |
| 214 m_histogram.updateStatus(fontFace); | 214 m_histogram.updateStatus(fontFace); |
| 215 m_failedFonts.append(fontFace); | 215 m_failedFonts.push_back(fontFace); |
| 216 removeFromLoadingFonts(fontFace); | 216 removeFromLoadingFonts(fontFace); |
| 217 } | 217 } |
| 218 | 218 |
| 219 size_t FontFaceSet::approximateBlankCharacterCount() const { | 219 size_t FontFaceSet::approximateBlankCharacterCount() const { |
| 220 size_t count = 0; | 220 size_t count = 0; |
| 221 for (auto& fontFace : m_loadingFonts) | 221 for (auto& fontFace : m_loadingFonts) |
| 222 count += fontFace->approximateBlankCharacterCount(); | 222 count += fontFace->approximateBlankCharacterCount(); |
| 223 return count; | 223 return count; |
| 224 } | 224 } |
| 225 | 225 |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 // Setlike should iterate each item in insertion order, and items should | 529 // Setlike should iterate each item in insertion order, and items should |
| 530 // be keep on up to date. But since blink does not have a way to hook up CSS | 530 // be keep on up to date. But since blink does not have a way to hook up CSS |
| 531 // modification, take a snapshot here, and make it ordered as follows. | 531 // modification, take a snapshot here, and make it ordered as follows. |
| 532 HeapVector<Member<FontFace>> fontFaces; | 532 HeapVector<Member<FontFace>> fontFaces; |
| 533 if (inActiveDocumentContext()) { | 533 if (inActiveDocumentContext()) { |
| 534 const HeapListHashSet<Member<FontFace>>& cssConnectedFaces = | 534 const HeapListHashSet<Member<FontFace>>& cssConnectedFaces = |
| 535 cssConnectedFontFaceList(); | 535 cssConnectedFontFaceList(); |
| 536 fontFaces.reserveInitialCapacity(cssConnectedFaces.size() + | 536 fontFaces.reserveInitialCapacity(cssConnectedFaces.size() + |
| 537 m_nonCSSConnectedFaces.size()); | 537 m_nonCSSConnectedFaces.size()); |
| 538 for (const auto& fontFace : cssConnectedFaces) | 538 for (const auto& fontFace : cssConnectedFaces) |
| 539 fontFaces.append(fontFace); | 539 fontFaces.push_back(fontFace); |
| 540 for (const auto& fontFace : m_nonCSSConnectedFaces) | 540 for (const auto& fontFace : m_nonCSSConnectedFaces) |
| 541 fontFaces.append(fontFace); | 541 fontFaces.push_back(fontFace); |
| 542 } | 542 } |
| 543 return new IterationSource(fontFaces); | 543 return new IterationSource(fontFaces); |
| 544 } | 544 } |
| 545 | 545 |
| 546 bool FontFaceSet::IterationSource::next(ScriptState*, | 546 bool FontFaceSet::IterationSource::next(ScriptState*, |
| 547 Member<FontFace>& key, | 547 Member<FontFace>& key, |
| 548 Member<FontFace>& value, | 548 Member<FontFace>& value, |
| 549 ExceptionState&) { | 549 ExceptionState&) { |
| 550 if (m_fontFaces.size() <= m_index) | 550 if (m_fontFaces.size() <= m_index) |
| 551 return false; | 551 return false; |
| 552 key = value = m_fontFaces[m_index++]; | 552 key = value = m_fontFaces[m_index++]; |
| 553 return true; | 553 return true; |
| 554 } | 554 } |
| 555 | 555 |
| 556 DEFINE_TRACE(FontFaceSet) { | 556 DEFINE_TRACE(FontFaceSet) { |
| 557 visitor->trace(m_ready); | 557 visitor->trace(m_ready); |
| 558 visitor->trace(m_loadingFonts); | 558 visitor->trace(m_loadingFonts); |
| 559 visitor->trace(m_loadedFonts); | 559 visitor->trace(m_loadedFonts); |
| 560 visitor->trace(m_failedFonts); | 560 visitor->trace(m_failedFonts); |
| 561 visitor->trace(m_nonCSSConnectedFaces); | 561 visitor->trace(m_nonCSSConnectedFaces); |
| 562 visitor->trace(m_asyncRunner); | 562 visitor->trace(m_asyncRunner); |
| 563 EventTargetWithInlineData::trace(visitor); | 563 EventTargetWithInlineData::trace(visitor); |
| 564 Supplement<Document>::trace(visitor); | 564 Supplement<Document>::trace(visitor); |
| 565 SuspendableObject::trace(visitor); | 565 SuspendableObject::trace(visitor); |
| 566 FontFace::LoadFontCallback::trace(visitor); | 566 FontFace::LoadFontCallback::trace(visitor); |
| 567 } | 567 } |
| 568 | 568 |
| 569 } // namespace blink | 569 } // namespace blink |
| OLD | NEW |