| OLD | NEW |
| 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. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. |
| 4 * All rights reserved. | 4 * All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // and good filtering performance. | 104 // and good filtering performance. |
| 105 static const unsigned maximumIdentifierCount = 4; | 105 static const unsigned maximumIdentifierCount = 4; |
| 106 const unsigned* descendantSelectorIdentifierHashes() const { | 106 const unsigned* descendantSelectorIdentifierHashes() const { |
| 107 return m_descendantSelectorIdentifierHashes; | 107 return m_descendantSelectorIdentifierHashes; |
| 108 } | 108 } |
| 109 | 109 |
| 110 DECLARE_TRACE(); | 110 DECLARE_TRACE(); |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 Member<StyleRule> m_rule; | 113 Member<StyleRule> m_rule; |
| 114 unsigned m_selectorIndex : 13; | 114 // This number is picked fairly arbitrary. If lowered, be aware that there |
| 115 // We store an array of RuleData objects in a primitive array. | 115 // might be sites and extensions using style rules with selector lists |
| 116 unsigned m_isLastInArray : 1; | 116 // exceeding the number of simple selectors to fit in this bitfield. |
| 117 // See https://crbug.com/312913 and https://crbug.com/704562 |
| 118 unsigned m_selectorIndex : 14; |
| 117 // This number was picked fairly arbitrarily. We can probably lower it if we | 119 // This number was picked fairly arbitrarily. We can probably lower it if we |
| 118 // need to. Some simple testing showed <100,000 RuleData's on large sites. | 120 // need to. Some simple testing showed <100,000 RuleData's on large sites. |
| 119 unsigned m_position : 18; | 121 unsigned m_position : 18; |
| 122 // 32 bits above |
| 120 unsigned m_specificity : 24; | 123 unsigned m_specificity : 24; |
| 121 unsigned m_containsUncommonAttributeSelector : 1; | 124 unsigned m_containsUncommonAttributeSelector : 1; |
| 122 unsigned m_linkMatchType : 2; // CSSSelector::LinkMatchMask | 125 unsigned m_linkMatchType : 2; // CSSSelector::LinkMatchMask |
| 123 unsigned m_hasDocumentSecurityOrigin : 1; | 126 unsigned m_hasDocumentSecurityOrigin : 1; |
| 124 unsigned m_propertyWhitelist : 2; | 127 unsigned m_propertyWhitelist : 2; |
| 128 // We store an array of RuleData objects in a primitive array. |
| 129 unsigned m_isLastInArray : 1; |
| 130 // 31 bits above |
| 125 // Use plain array instead of a Vector to minimize memory overhead. | 131 // Use plain array instead of a Vector to minimize memory overhead. |
| 126 unsigned m_descendantSelectorIdentifierHashes[maximumIdentifierCount]; | 132 unsigned m_descendantSelectorIdentifierHashes[maximumIdentifierCount]; |
| 127 }; | 133 }; |
| 128 | 134 |
| 129 } // namespace blink | 135 } // namespace blink |
| 130 | 136 |
| 131 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::RuleData); | 137 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::RuleData); |
| 132 | 138 |
| 133 namespace blink { | 139 namespace blink { |
| 134 | 140 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 Member<PendingRuleMaps> m_pendingRules; | 318 Member<PendingRuleMaps> m_pendingRules; |
| 313 | 319 |
| 314 #ifndef NDEBUG | 320 #ifndef NDEBUG |
| 315 HeapVector<RuleData> m_allRules; | 321 HeapVector<RuleData> m_allRules; |
| 316 #endif | 322 #endif |
| 317 }; | 323 }; |
| 318 | 324 |
| 319 } // namespace blink | 325 } // namespace blink |
| 320 | 326 |
| 321 #endif // RuleSet_h | 327 #endif // RuleSet_h |
| OLD | NEW |