Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/FontFaceSet.h |
| diff --git a/third_party/WebKit/Source/core/css/FontFaceSet.h b/third_party/WebKit/Source/core/css/FontFaceSet.h |
| index fda6c9171e0ae44cbd4ed82cdf12b379849013f5..279e9a0162a6726445ced7e5a6acb14705178288 100644 |
| --- a/third_party/WebKit/Source/core/css/FontFaceSet.h |
| +++ b/third_party/WebKit/Source/core/css/FontFaceSet.h |
| @@ -26,6 +26,7 @@ |
| #ifndef FontFaceSet_h |
| #define FontFaceSet_h |
| +#include "bindings/core/v8/Iterable.h" |
| #include "bindings/core/v8/ScriptPromise.h" |
| #include "core/css/FontFace.h" |
| #include "core/css/FontFaceSetForEachCallback.h" |
| @@ -57,12 +58,14 @@ class FontFaceCache; |
| class FontResource; |
| class ExecutionContext; |
| +using FontFaceSetIterable = PairIterable<RefPtrWillBeMember<FontFace>, RefPtrWillBeMember<FontFace>>; |
| + |
| #if ENABLE(OILPAN) |
| -class FontFaceSet final : public EventTargetWithInlineData, public HeapSupplement<Document>, public ActiveDOMObject { |
| +class FontFaceSet final : public EventTargetWithInlineData, public HeapSupplement<Document>, public ActiveDOMObject, public FontFaceSetIterable { |
| USING_GARBAGE_COLLECTED_MIXIN(FontFaceSet); |
| using SupplementType = HeapSupplement<Document>; |
| #else |
| -class FontFaceSet final : public EventTargetWithInlineData, public RefCountedSupplement<Document, FontFaceSet>, public ActiveDOMObject { |
| +class FontFaceSet final : public EventTargetWithInlineData, public RefCountedSupplement<Document, FontFaceSet>, public ActiveDOMObject, public FontFaceSetIterable { |
| REFCOUNTED_EVENT_TARGET(FontFaceSet); |
| using SupplementType = RefCountedSupplement<Document, FontFaceSet>; |
| #endif |
| @@ -81,11 +84,9 @@ public: |
| void add(FontFace*, ExceptionState&); |
| void clear(); |
| bool remove(FontFace*, ExceptionState&); |
| - void forEach(FontFaceSetForEachCallback*, const ScriptValue& thisArg) const; |
| - void forEach(FontFaceSetForEachCallback*) const; |
| - bool has(FontFace*, ExceptionState&) const; |
| + bool hasForBinding(ScriptState*, FontFace*, ExceptionState&) const; |
| - unsigned long size() const; |
| + size_t size() const; |
| AtomicString status() const; |
| ExecutionContext* executionContext() const override; |
| @@ -116,6 +117,26 @@ private: |
| return adoptRefWillBeNoop(new FontFaceSet(document)); |
| } |
| + FontFaceSetIterable::IterationSource* startIteration(ScriptState*, ExceptionState&) override; |
| + |
| + class IterationSource final : public FontFaceSetIterable::IterationSource { |
|
haraken
2015/10/19 07:13:08
Add WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED().
Takashi Toyoshima
2015/10/19 07:51:44
Done.
Any guideline to use the macro? Should I use
haraken
2015/10/19 07:56:05
Sorry, I noticed that FontFaceSetIterable::Iterati
|
| + public: |
| + explicit IterationSource(const WillBeHeapVector<RefPtrWillBeMember<FontFace>>& fontFaces) |
| + : m_index(0) |
| + , m_fontFaces(fontFaces) { } |
| + bool next(ScriptState*, RefPtrWillBeMember<FontFace>&, RefPtrWillBeMember<FontFace>&, ExceptionState&) override; |
| + |
| + DEFINE_INLINE_VIRTUAL_TRACE() |
| + { |
| + visitor->trace(m_fontFaces); |
| + FontFaceSetIterable::IterationSource::trace(visitor); |
| + } |
| + |
| + private: |
| + size_t m_index; |
| + WillBeHeapVector<RefPtrWillBeMember<FontFace>> m_fontFaces; |
| + }; |
| + |
| class FontLoadHistogram { |
| DISALLOW_ALLOCATION(); |
| public: |
| @@ -134,7 +155,6 @@ private: |
| FontFaceSet(Document&); |
| bool inActiveDocumentContext() const; |
| - void forEachInternal(FontFaceSetForEachCallback*, const ScriptValue* thisArg) const; |
| void addToLoadingFonts(PassRefPtrWillBeRawPtr<FontFace>); |
| void removeFromLoadingFonts(PassRefPtrWillBeRawPtr<FontFace>); |
| void fireLoadingEvent(); |