| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 { | 55 { |
| 56 return adoptRef(new LoadFontPromiseResolver(faces, scriptState)); | 56 return adoptRef(new LoadFontPromiseResolver(faces, scriptState)); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void loadFonts(ExecutionContext*); | 59 void loadFonts(ExecutionContext*); |
| 60 ScriptPromise promise() { return m_resolver->promise(); } | 60 ScriptPromise promise() { return m_resolver->promise(); } |
| 61 | 61 |
| 62 virtual void notifyLoaded(FontFace*) override; | 62 virtual void notifyLoaded(FontFace*) override; |
| 63 virtual void notifyError(FontFace*) override; | 63 virtual void notifyError(FontFace*) override; |
| 64 | 64 |
| 65 virtual void trace(Visitor*) override; | |
| 66 | |
| 67 private: | 65 private: |
| 68 LoadFontPromiseResolver(FontFaceArray faces, ScriptState* scriptState) | 66 LoadFontPromiseResolver(FontFaceArray faces, ScriptState* scriptState) |
| 69 : m_numLoading(faces.size()) | 67 : m_numLoading(faces.size()) |
| 70 , m_errorOccured(false) | 68 , m_errorOccured(false) |
| 71 , m_resolver(ScriptPromiseResolver::create(scriptState)) | 69 , m_resolver(ScriptPromiseResolver::create(scriptState)) |
| 72 { | 70 { |
| 73 m_fontFaces.swap(faces); | 71 m_fontFaces.swap(faces); |
| 74 } | 72 } |
| 75 | 73 |
| 76 Vector<RefPtr<FontFace> > m_fontFaces; | 74 Vector<RefPtr<FontFace> > m_fontFaces; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 101 | 99 |
| 102 void LoadFontPromiseResolver::notifyError(FontFace* fontFace) | 100 void LoadFontPromiseResolver::notifyError(FontFace* fontFace) |
| 103 { | 101 { |
| 104 m_numLoading--; | 102 m_numLoading--; |
| 105 if (!m_errorOccured) { | 103 if (!m_errorOccured) { |
| 106 m_errorOccured = true; | 104 m_errorOccured = true; |
| 107 m_resolver->reject(fontFace->error()); | 105 m_resolver->reject(fontFace->error()); |
| 108 } | 106 } |
| 109 } | 107 } |
| 110 | 108 |
| 111 void LoadFontPromiseResolver::trace(Visitor* visitor) | |
| 112 { | |
| 113 visitor->trace(m_fontFaces); | |
| 114 LoadFontCallback::trace(visitor); | |
| 115 } | |
| 116 | |
| 117 class FontsReadyPromiseResolver { | 109 class FontsReadyPromiseResolver { |
| 118 public: | 110 public: |
| 119 static PassOwnPtr<FontsReadyPromiseResolver> create(ScriptState* scriptState
) | 111 static PassOwnPtr<FontsReadyPromiseResolver> create(ScriptState* scriptState
) |
| 120 { | 112 { |
| 121 return adoptPtr(new FontsReadyPromiseResolver(scriptState)); | 113 return adoptPtr(new FontsReadyPromiseResolver(scriptState)); |
| 122 } | 114 } |
| 123 | 115 |
| 124 void resolve(PassRefPtr<FontFaceSet> fontFaceSet) | 116 void resolve(PassRefPtr<FontFaceSet> fontFaceSet) |
| 125 { | 117 { |
| 126 m_resolver->resolve(fontFaceSet); | 118 m_resolver->resolve(fontFaceSet); |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 | 573 |
| 582 return fonts.release(); | 574 return fonts.release(); |
| 583 } | 575 } |
| 584 | 576 |
| 585 void FontFaceSet::didLayout(Document& document) | 577 void FontFaceSet::didLayout(Document& document) |
| 586 { | 578 { |
| 587 if (FontFaceSet* fonts = static_cast<FontFaceSet*>(SupplementType::from(docu
ment, supplementName()))) | 579 if (FontFaceSet* fonts = static_cast<FontFaceSet*>(SupplementType::from(docu
ment, supplementName()))) |
| 588 fonts->didLayout(); | 580 fonts->didLayout(); |
| 589 } | 581 } |
| 590 | 582 |
| 591 #if ENABLE(OILPAN) | |
| 592 void FontFaceSet::trace(Visitor* visitor) | |
| 593 { | |
| 594 visitor->trace(m_loadingFonts); | |
| 595 visitor->trace(m_loadedFonts); | |
| 596 visitor->trace(m_failedFonts); | |
| 597 visitor->trace(m_nonCSSConnectedFaces); | |
| 598 DocumentSupplement::trace(visitor); | |
| 599 EventTargetWithInlineData::trace(visitor); | |
| 600 } | |
| 601 #endif | |
| 602 | |
| 603 } // namespace blink | 583 } // namespace blink |
| OLD | NEW |