Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(666)

Unified Diff: third_party/WebKit/Source/core/css/FontFaceSet.h

Issue 1409433003: CSS Font Loading: make FontFaceSet Setlike (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert FastAlloc Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 {
+ 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();

Powered by Google App Engine
This is Rietveld 408576698