| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2014 Apple Inc. All rights reserved. | 3 * Copyright (C) 2014 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 bool isUnique() const { return m_isUnique; } | 80 bool isUnique() const { return m_isUnique; } |
| 81 | 81 |
| 82 DECLARE_TRACE_AFTER_DISPATCH(); | 82 DECLARE_TRACE_AFTER_DISPATCH(); |
| 83 DECLARE_TRACE(); | 83 DECLARE_TRACE(); |
| 84 | 84 |
| 85 protected: | 85 protected: |
| 86 ElementData(); | 86 ElementData(); |
| 87 explicit ElementData(unsigned arraySize); | 87 explicit ElementData(unsigned arraySize); |
| 88 ElementData(const ElementData&, bool isUnique); | 88 ElementData(const ElementData&, bool isUnique); |
| 89 | 89 |
| 90 // Keep the type in a bitfield instead of using virtual destructors to avoid a
dding a vtable. | 90 // Keep the type in a bitfield instead of using virtual destructors to avoid |
| 91 // adding a vtable. |
| 91 unsigned m_isUnique : 1; | 92 unsigned m_isUnique : 1; |
| 92 unsigned m_arraySize : 28; | 93 unsigned m_arraySize : 28; |
| 93 mutable unsigned m_presentationAttributeStyleIsDirty : 1; | 94 mutable unsigned m_presentationAttributeStyleIsDirty : 1; |
| 94 mutable unsigned m_styleAttributeIsDirty : 1; | 95 mutable unsigned m_styleAttributeIsDirty : 1; |
| 95 mutable unsigned m_animatedSVGAttributesAreDirty : 1; | 96 mutable unsigned m_animatedSVGAttributesAreDirty : 1; |
| 96 | 97 |
| 97 mutable Member<StylePropertySet> m_inlineStyle; | 98 mutable Member<StylePropertySet> m_inlineStyle; |
| 98 mutable SpaceSplitString m_classNames; | 99 mutable SpaceSplitString m_classNames; |
| 99 mutable AtomicString m_idForStyleResolution; | 100 mutable AtomicString m_idForStyleResolution; |
| 100 | 101 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 129 explicit ShareableElementData(const Vector<Attribute>&); | 130 explicit ShareableElementData(const Vector<Attribute>&); |
| 130 explicit ShareableElementData(const UniqueElementData&); | 131 explicit ShareableElementData(const UniqueElementData&); |
| 131 ~ShareableElementData(); | 132 ~ShareableElementData(); |
| 132 | 133 |
| 133 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { | 134 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { |
| 134 ElementData::traceAfterDispatch(visitor); | 135 ElementData::traceAfterDispatch(visitor); |
| 135 } | 136 } |
| 136 | 137 |
| 137 // Add support for placement new as ShareableElementData is not allocated | 138 // Add support for placement new as ShareableElementData is not allocated |
| 138 // with a fixed size. Instead the allocated memory size is computed based on | 139 // with a fixed size. Instead the allocated memory size is computed based on |
| 139 // the number of attributes. This requires us to use ThreadHeap::allocate dire
ctly | 140 // the number of attributes. This requires us to use ThreadHeap::allocate |
| 140 // with the computed size and subsequently call placement new with the | 141 // directly with the computed size and subsequently call placement new with |
| 141 // allocated memory address. | 142 // the allocated memory address. |
| 142 void* operator new(std::size_t, void* location) { return location; } | 143 void* operator new(std::size_t, void* location) { return location; } |
| 143 | 144 |
| 144 AttributeCollection attributes() const; | 145 AttributeCollection attributes() const; |
| 145 | 146 |
| 146 Attribute m_attributeArray[0]; | 147 Attribute m_attributeArray[0]; |
| 147 }; | 148 }; |
| 148 | 149 |
| 149 DEFINE_ELEMENT_DATA_TYPE_CASTS(ShareableElementData, | 150 DEFINE_ELEMENT_DATA_TYPE_CASTS(ShareableElementData, |
| 150 !data->isUnique(), | 151 !data->isUnique(), |
| 151 !data.isUnique()); | 152 !data.isUnique()); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 m_attributeVector.size()); | 208 m_attributeVector.size()); |
| 208 } | 209 } |
| 209 | 210 |
| 210 inline MutableAttributeCollection UniqueElementData::attributes() { | 211 inline MutableAttributeCollection UniqueElementData::attributes() { |
| 211 return MutableAttributeCollection(m_attributeVector); | 212 return MutableAttributeCollection(m_attributeVector); |
| 212 } | 213 } |
| 213 | 214 |
| 214 } // namespace blink | 215 } // namespace blink |
| 215 | 216 |
| 216 #endif // ElementData_h | 217 #endif // ElementData_h |
| OLD | NEW |