| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 DEFINE_TRACE(LoadFontPromiseResolver) { | 109 DEFINE_TRACE(LoadFontPromiseResolver) { |
| 110 visitor->trace(m_fontFaces); | 110 visitor->trace(m_fontFaces); |
| 111 visitor->trace(m_resolver); | 111 visitor->trace(m_resolver); |
| 112 LoadFontCallback::trace(visitor); | 112 LoadFontCallback::trace(visitor); |
| 113 } | 113 } |
| 114 | 114 |
| 115 FontFaceSet::FontFaceSet(Document& document) | 115 FontFaceSet::FontFaceSet(Document& document) |
| 116 : ActiveDOMObject(&document), | 116 : SuspendableObject(&document), |
| 117 m_shouldFireLoadingEvent(false), | 117 m_shouldFireLoadingEvent(false), |
| 118 m_isLoading(false), | 118 m_isLoading(false), |
| 119 m_ready( | 119 m_ready( |
| 120 new ReadyProperty(getExecutionContext(), this, ReadyProperty::Ready)), | 120 new ReadyProperty(getExecutionContext(), this, ReadyProperty::Ready)), |
| 121 m_asyncRunner(AsyncMethodRunner<FontFaceSet>::create( | 121 m_asyncRunner(AsyncMethodRunner<FontFaceSet>::create( |
| 122 this, | 122 this, |
| 123 &FontFaceSet::handlePendingEventsAndPromises)) { | 123 &FontFaceSet::handlePendingEventsAndPromises)) { |
| 124 suspendIfNeeded(); | 124 suspendIfNeeded(); |
| 125 } | 125 } |
| 126 | 126 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 139 CSSFontSelector* fontSelector) { | 139 CSSFontSelector* fontSelector) { |
| 140 for (const auto& fontFace : m_nonCSSConnectedFaces) | 140 for (const auto& fontFace : m_nonCSSConnectedFaces) |
| 141 fontFaceCache->addFontFace(fontSelector, fontFace, false); | 141 fontFaceCache->addFontFace(fontSelector, fontFace, false); |
| 142 } | 142 } |
| 143 | 143 |
| 144 const AtomicString& FontFaceSet::interfaceName() const { | 144 const AtomicString& FontFaceSet::interfaceName() const { |
| 145 return EventTargetNames::FontFaceSet; | 145 return EventTargetNames::FontFaceSet; |
| 146 } | 146 } |
| 147 | 147 |
| 148 ExecutionContext* FontFaceSet::getExecutionContext() const { | 148 ExecutionContext* FontFaceSet::getExecutionContext() const { |
| 149 return ActiveDOMObject::getExecutionContext(); | 149 return SuspendableObject::getExecutionContext(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 AtomicString FontFaceSet::status() const { | 152 AtomicString FontFaceSet::status() const { |
| 153 DEFINE_STATIC_LOCAL(AtomicString, loading, ("loading")); | 153 DEFINE_STATIC_LOCAL(AtomicString, loading, ("loading")); |
| 154 DEFINE_STATIC_LOCAL(AtomicString, loaded, ("loaded")); | 154 DEFINE_STATIC_LOCAL(AtomicString, loaded, ("loaded")); |
| 155 return m_isLoading ? loading : loaded; | 155 return m_isLoading ? loading : loaded; |
| 156 } | 156 } |
| 157 | 157 |
| 158 void FontFaceSet::handlePendingEventsAndPromisesSoon() { | 158 void FontFaceSet::handlePendingEventsAndPromisesSoon() { |
| 159 // m_asyncRunner will be automatically stopped on destruction. | 159 // m_asyncRunner will be automatically stopped on destruction. |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 | 554 |
| 555 DEFINE_TRACE(FontFaceSet) { | 555 DEFINE_TRACE(FontFaceSet) { |
| 556 visitor->trace(m_ready); | 556 visitor->trace(m_ready); |
| 557 visitor->trace(m_loadingFonts); | 557 visitor->trace(m_loadingFonts); |
| 558 visitor->trace(m_loadedFonts); | 558 visitor->trace(m_loadedFonts); |
| 559 visitor->trace(m_failedFonts); | 559 visitor->trace(m_failedFonts); |
| 560 visitor->trace(m_nonCSSConnectedFaces); | 560 visitor->trace(m_nonCSSConnectedFaces); |
| 561 visitor->trace(m_asyncRunner); | 561 visitor->trace(m_asyncRunner); |
| 562 EventTargetWithInlineData::trace(visitor); | 562 EventTargetWithInlineData::trace(visitor); |
| 563 Supplement<Document>::trace(visitor); | 563 Supplement<Document>::trace(visitor); |
| 564 ActiveDOMObject::trace(visitor); | 564 SuspendableObject::trace(visitor); |
| 565 FontFace::LoadFontCallback::trace(visitor); | 565 FontFace::LoadFontCallback::trace(visitor); |
| 566 } | 566 } |
| 567 | 567 |
| 568 } // namespace blink | 568 } // namespace blink |
| OLD | NEW |