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

Side by Side Diff: third_party/WebKit/Source/core/css/StyleSheetContents.h

Issue 2315923002: Lazy Parse CSS (Closed)
Patch Set: plug leaks Created 4 years, 3 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
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 bool hasMediaQueries() const { return m_hasMediaQueries; } 152 bool hasMediaQueries() const { return m_hasMediaQueries; }
153 153
154 bool didLoadErrorOccur() const { return m_didLoadErrorOccur; } 154 bool didLoadErrorOccur() const { return m_didLoadErrorOccur; }
155 155
156 RuleSet& ruleSet() { ASSERT(m_ruleSet); return *m_ruleSet.get(); } 156 RuleSet& ruleSet() { ASSERT(m_ruleSet); return *m_ruleSet.get(); }
157 RuleSet& ensureRuleSet(const MediaQueryEvaluator&, AddRuleFlags); 157 RuleSet& ensureRuleSet(const MediaQueryEvaluator&, AddRuleFlags);
158 void clearRuleSet(); 158 void clearRuleSet();
159 159
160 String sourceMapURL() const { return m_sourceMapURL; } 160 String sourceMapURL() const { return m_sourceMapURL; }
161 161
162 void takeEscapedStrings(std::unique_ptr<Vector<String>> strings)
163 {
164 m_escapedStrings.reset(strings.release());
165 }
166
162 DECLARE_TRACE(); 167 DECLARE_TRACE();
163 168
164 private: 169 private:
165 StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, co nst CSSParserContext&); 170 StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, co nst CSSParserContext&);
166 StyleSheetContents(const StyleSheetContents&); 171 StyleSheetContents(const StyleSheetContents&);
167 StyleSheetContents() = delete; 172 StyleSheetContents() = delete;
168 StyleSheetContents& operator=(const StyleSheetContents&) = delete; 173 StyleSheetContents& operator=(const StyleSheetContents&) = delete;
169 void notifyRemoveFontFaceRule(const StyleRuleFontFace*); 174 void notifyRemoveFontFaceRule(const StyleRuleFontFace*);
170 175
171 Document* clientSingleOwnerDocument() const; 176 Document* clientSingleOwnerDocument() const;
172 177
173 Member<StyleRuleImport> m_ownerRule; 178 Member<StyleRuleImport> m_ownerRule;
174 179
175 String m_originalURL; 180 String m_originalURL;
176 181
177 HeapVector<Member<StyleRuleImport>> m_importRules; 182 HeapVector<Member<StyleRuleImport>> m_importRules;
178 HeapVector<Member<StyleRuleNamespace>> m_namespaceRules; 183 HeapVector<Member<StyleRuleNamespace>> m_namespaceRules;
179 HeapVector<Member<StyleRuleBase>> m_childRules; 184 HeapVector<Member<StyleRuleBase>> m_childRules;
180 using PrefixNamespaceURIMap = HashMap<AtomicString, AtomicString>; 185 using PrefixNamespaceURIMap = HashMap<AtomicString, AtomicString>;
181 PrefixNamespaceURIMap m_namespaces; 186 PrefixNamespaceURIMap m_namespaces;
182 AtomicString m_defaultNamespace; 187 AtomicString m_defaultNamespace;
183 WeakMember<CSSStyleSheetResource> m_referencedFromResource; 188 WeakMember<CSSStyleSheetResource> m_referencedFromResource;
184 189
190 // Only initialized if using lazy parsing. Also referenced on the css resour ce.
191 String m_sheetText;
192
185 bool m_hasSyntacticallyValidCSSHeader : 1; 193 bool m_hasSyntacticallyValidCSSHeader : 1;
186 bool m_didLoadErrorOccur : 1; 194 bool m_didLoadErrorOccur : 1;
187 bool m_isMutable : 1; 195 bool m_isMutable : 1;
188 bool m_hasFontFaceRule : 1; 196 bool m_hasFontFaceRule : 1;
189 bool m_hasMediaQueries : 1; 197 bool m_hasMediaQueries : 1;
190 bool m_hasSingleOwnerDocument : 1; 198 bool m_hasSingleOwnerDocument : 1;
191 bool m_isUsedFromTextCache : 1; 199 bool m_isUsedFromTextCache : 1;
192 200
193 CSSParserContext m_parserContext; 201 CSSParserContext m_parserContext;
194 202
195 HeapHashSet<WeakMember<CSSStyleSheet>> m_loadingClients; 203 HeapHashSet<WeakMember<CSSStyleSheet>> m_loadingClients;
196 HeapHashSet<WeakMember<CSSStyleSheet>> m_completedClients; 204 HeapHashSet<WeakMember<CSSStyleSheet>> m_completedClients;
197 205
198 Member<RuleSet> m_ruleSet; 206 Member<RuleSet> m_ruleSet;
199 String m_sourceMapURL; 207 String m_sourceMapURL;
208
209 // Used for retaining references to escaped strings for lazy parsing. For
210 // non-lazy parsing these are only retained in the CSSTokenizer::Scope.
211 std::unique_ptr<Vector<String>> m_escapedStrings;
200 }; 212 };
201 213
202 } // namespace blink 214 } // namespace blink
203 215
204 #endif 216 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698