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

Side by Side Diff: Source/core/css/FontFaceSet.h

Issue 171333003: Pass implementation object to supplemental classes by reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 void didLayout(); 89 void didLayout();
90 void beginFontLoading(FontFace*); 90 void beginFontLoading(FontFace*);
91 void fontLoaded(FontFace*); 91 void fontLoaded(FontFace*);
92 void loadError(FontFace*); 92 void loadError(FontFace*);
93 93
94 // ActiveDOMObject 94 // ActiveDOMObject
95 virtual void suspend() OVERRIDE; 95 virtual void suspend() OVERRIDE;
96 virtual void resume() OVERRIDE; 96 virtual void resume() OVERRIDE;
97 virtual void stop() OVERRIDE; 97 virtual void stop() OVERRIDE;
98 98
99 static PassRefPtr<FontFaceSet> from(Document*); 99 static PassRefPtr<FontFaceSet> from(Document&);
100 static void didLayout(Document*); 100 static void didLayout(Document&);
101 101
102 void addFontFacesToFontFaceCache(FontFaceCache*, CSSFontSelector*); 102 void addFontFacesToFontFaceCache(FontFaceCache*, CSSFontSelector*);
103 103
104 private: 104 private:
105 typedef RefCountedSupplement<Document, FontFaceSet> SupplementType; 105 typedef RefCountedSupplement<Document, FontFaceSet> SupplementType;
106 106
107 static PassRefPtr<FontFaceSet> create(Document* document) 107 static PassRefPtr<FontFaceSet> create(Document& document)
108 { 108 {
109 return adoptRef<FontFaceSet>(new FontFaceSet(document)); 109 return adoptRef<FontFaceSet>(new FontFaceSet(document));
110 } 110 }
111 111
112 class FontLoadHistogram { 112 class FontLoadHistogram {
113 public: 113 public:
114 FontLoadHistogram() : m_count(0), m_recorded(false) { } 114 FontLoadHistogram() : m_count(0), m_recorded(false) { }
115 void incrementCount() { m_count++; } 115 void incrementCount() { m_count++; }
116 void record(); 116 void record();
117 117
118 private: 118 private:
119 int m_count; 119 int m_count;
120 bool m_recorded; 120 bool m_recorded;
121 }; 121 };
122 122
123 FontFaceSet(Document*); 123 FontFaceSet(Document&);
124 124
125 bool hasLoadedFonts() const { return !m_loadedFonts.isEmpty() || !m_failedFo nts.isEmpty(); } 125 bool hasLoadedFonts() const { return !m_loadedFonts.isEmpty() || !m_failedFo nts.isEmpty(); }
126 126
127 bool inActiveDocumentContext() const; 127 bool inActiveDocumentContext() const;
128 void forEachInternal(PassOwnPtr<FontFaceSetForEachCallback>, ScriptValue* th isArg) const; 128 void forEachInternal(PassOwnPtr<FontFaceSetForEachCallback>, ScriptValue* th isArg) const;
129 void incrementLoadingCount(); 129 void incrementLoadingCount();
130 void decrementLoadingCount(); 130 void decrementLoadingCount();
131 void fireLoadingEvent(); 131 void fireLoadingEvent();
132 void fireDoneEventIfPossible(); 132 void fireDoneEventIfPossible();
133 bool resolveFontStyle(const String&, Font&); 133 bool resolveFontStyle(const String&, Font&);
(...skipping 10 matching lines...) Expand all
144 ListHashSet<RefPtr<FontFace> > m_nonCSSConnectedFaces; 144 ListHashSet<RefPtr<FontFace> > m_nonCSSConnectedFaces;
145 145
146 AsyncMethodRunner<FontFaceSet> m_asyncRunner; 146 AsyncMethodRunner<FontFaceSet> m_asyncRunner;
147 147
148 FontLoadHistogram m_histogram; 148 FontLoadHistogram m_histogram;
149 }; 149 };
150 150
151 } // namespace WebCore 151 } // namespace WebCore
152 152
153 #endif // FontFaceSet_h 153 #endif // FontFaceSet_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698