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

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

Issue 1304623002: Make blink classes and structures in core/css fast-allocated (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 unsigned m_specificity : 24; 103 unsigned m_specificity : 24;
104 unsigned m_containsUncommonAttributeSelector : 1; 104 unsigned m_containsUncommonAttributeSelector : 1;
105 unsigned m_linkMatchType : 2; // CSSSelector::LinkMatchMask 105 unsigned m_linkMatchType : 2; // CSSSelector::LinkMatchMask
106 unsigned m_hasDocumentSecurityOrigin : 1; 106 unsigned m_hasDocumentSecurityOrigin : 1;
107 unsigned m_propertyWhitelistType : 2; 107 unsigned m_propertyWhitelistType : 2;
108 // Use plain array instead of a Vector to minimize memory overhead. 108 // Use plain array instead of a Vector to minimize memory overhead.
109 unsigned m_descendantSelectorIdentifierHashes[maximumIdentifierCount]; 109 unsigned m_descendantSelectorIdentifierHashes[maximumIdentifierCount];
110 }; 110 };
111 111
112 struct SameSizeAsRuleData { 112 struct SameSizeAsRuleData {
113 DISALLOW_ALLOCATION();
113 void* a; 114 void* a;
114 unsigned b; 115 unsigned b;
115 unsigned c; 116 unsigned c;
116 unsigned d[4]; 117 unsigned d[4];
117 }; 118 };
118 119
119 static_assert(sizeof(RuleData) == sizeof(SameSizeAsRuleData), "RuleData should s tay small"); 120 static_assert(sizeof(RuleData) == sizeof(SameSizeAsRuleData), "RuleData should s tay small");
120 121
121 class CORE_EXPORT RuleSet : public NoBaseWillBeGarbageCollectedFinalized<RuleSet > { 122 class CORE_EXPORT RuleSet : public NoBaseWillBeGarbageCollectedFinalized<RuleSet > {
122 WTF_MAKE_NONCOPYABLE(RuleSet); 123 WTF_MAKE_NONCOPYABLE(RuleSet);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 void addFontFaceRule(StyleRuleFontFace*); 178 void addFontFaceRule(StyleRuleFontFace*);
178 void addKeyframesRule(StyleRuleKeyframes*); 179 void addKeyframesRule(StyleRuleKeyframes*);
179 180
180 void addChildRules(const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>> &, const MediaQueryEvaluator& medium, AddRuleFlags); 181 void addChildRules(const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>> &, const MediaQueryEvaluator& medium, AddRuleFlags);
181 bool findBestRuleSetAndAdd(const CSSSelector&, RuleData&); 182 bool findBestRuleSetAndAdd(const CSSSelector&, RuleData&);
182 183
183 void compactRules(); 184 void compactRules();
184 static void compactPendingRules(PendingRuleMap&, CompactRuleMap&); 185 static void compactPendingRules(PendingRuleMap&, CompactRuleMap&);
185 186
186 class PendingRuleMaps : public NoBaseWillBeGarbageCollected<PendingRuleMaps> { 187 class PendingRuleMaps : public NoBaseWillBeGarbageCollected<PendingRuleMaps> {
188 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(PendingRuleMaps);
187 public: 189 public:
188 static PassOwnPtrWillBeRawPtr<PendingRuleMaps> create() { return adoptPt rWillBeNoop(new PendingRuleMaps); } 190 static PassOwnPtrWillBeRawPtr<PendingRuleMaps> create() { return adoptPt rWillBeNoop(new PendingRuleMaps); }
189 191
190 PendingRuleMap idRules; 192 PendingRuleMap idRules;
191 PendingRuleMap classRules; 193 PendingRuleMap classRules;
192 PendingRuleMap tagRules; 194 PendingRuleMap tagRules;
193 PendingRuleMap shadowPseudoElementRules; 195 PendingRuleMap shadowPseudoElementRules;
194 196
195 DECLARE_TRACE(); 197 DECLARE_TRACE();
196 198
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 WillBeHeapVector<RuleData> m_allRules; 233 WillBeHeapVector<RuleData> m_allRules;
232 #endif 234 #endif
233 }; 235 };
234 236
235 } // namespace blink 237 } // namespace blink
236 238
237 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::RuleData); 239 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::RuleData);
238 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::MinimalRuleData); 240 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::MinimalRuleData);
239 241
240 #endif // RuleSet_h 242 #endif // RuleSet_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698