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

Side by Side Diff: third_party/WebKit/Source/core/dom/ElementData.cpp

Issue 1854423002: ASSERT -> {DCHECK|DCHECK_XX}, ENABLE(ASSERT) -> DCHECK_IS_ON() in dom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mark svg/as-image/svg-nested.html crash on win Created 4 years, 8 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) 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 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 ShareableElementData::~ShareableElementData() 145 ShareableElementData::~ShareableElementData()
146 { 146 {
147 for (unsigned i = 0; i < m_arraySize; ++i) 147 for (unsigned i = 0; i < m_arraySize; ++i)
148 m_attributeArray[i].~Attribute(); 148 m_attributeArray[i].~Attribute();
149 } 149 }
150 150
151 ShareableElementData::ShareableElementData(const UniqueElementData& other) 151 ShareableElementData::ShareableElementData(const UniqueElementData& other)
152 : ElementData(other, false) 152 : ElementData(other, false)
153 { 153 {
154 ASSERT(!other.m_presentationAttributeStyle); 154 DCHECK(!other.m_presentationAttributeStyle);
155 155
156 if (other.m_inlineStyle) { 156 if (other.m_inlineStyle) {
157 m_inlineStyle = other.m_inlineStyle->immutableCopyIfNeeded(); 157 m_inlineStyle = other.m_inlineStyle->immutableCopyIfNeeded();
158 } 158 }
159 159
160 for (unsigned i = 0; i < m_arraySize; ++i) 160 for (unsigned i = 0; i < m_arraySize; ++i)
161 new (&m_attributeArray[i]) Attribute(other.m_attributeVector.at(i)); 161 new (&m_attributeArray[i]) Attribute(other.m_attributeVector.at(i));
162 } 162 }
163 163
164 RawPtr<ShareableElementData> ShareableElementData::createWithAttributes(const Ve ctor<Attribute>& attributes) 164 RawPtr<ShareableElementData> ShareableElementData::createWithAttributes(const Ve ctor<Attribute>& attributes)
(...skipping 11 matching lines...) Expand all
176 , m_presentationAttributeStyle(other.m_presentationAttributeStyle) 176 , m_presentationAttributeStyle(other.m_presentationAttributeStyle)
177 , m_attributeVector(other.m_attributeVector) 177 , m_attributeVector(other.m_attributeVector)
178 { 178 {
179 m_inlineStyle = other.m_inlineStyle ? other.m_inlineStyle->mutableCopy() : n ullptr; 179 m_inlineStyle = other.m_inlineStyle ? other.m_inlineStyle->mutableCopy() : n ullptr;
180 } 180 }
181 181
182 UniqueElementData::UniqueElementData(const ShareableElementData& other) 182 UniqueElementData::UniqueElementData(const ShareableElementData& other)
183 : ElementData(other, true) 183 : ElementData(other, true)
184 { 184 {
185 // An ShareableElementData should never have a mutable inline StylePropertyS et attached. 185 // An ShareableElementData should never have a mutable inline StylePropertyS et attached.
186 ASSERT(!other.m_inlineStyle || !other.m_inlineStyle->isMutable()); 186 DCHECK(!other.m_inlineStyle || !other.m_inlineStyle->isMutable());
187 m_inlineStyle = other.m_inlineStyle; 187 m_inlineStyle = other.m_inlineStyle;
188 188
189 unsigned length = other.attributes().size(); 189 unsigned length = other.attributes().size();
190 m_attributeVector.reserveCapacity(length); 190 m_attributeVector.reserveCapacity(length);
191 for (unsigned i = 0; i < length; ++i) 191 for (unsigned i = 0; i < length; ++i)
192 m_attributeVector.uncheckedAppend(other.m_attributeArray[i]); 192 m_attributeVector.uncheckedAppend(other.m_attributeArray[i]);
193 } 193 }
194 194
195 RawPtr<UniqueElementData> UniqueElementData::create() 195 RawPtr<UniqueElementData> UniqueElementData::create()
196 { 196 {
197 return new UniqueElementData; 197 return new UniqueElementData;
198 } 198 }
199 199
200 RawPtr<ShareableElementData> UniqueElementData::makeShareableCopy() const 200 RawPtr<ShareableElementData> UniqueElementData::makeShareableCopy() const
201 { 201 {
202 void* slot = Heap::allocate<ElementData>(sizeForShareableElementDataWithAttr ibuteCount(m_attributeVector.size())); 202 void* slot = Heap::allocate<ElementData>(sizeForShareableElementDataWithAttr ibuteCount(m_attributeVector.size()));
203 return new (slot) ShareableElementData(*this); 203 return new (slot) ShareableElementData(*this);
204 } 204 }
205 205
206 DEFINE_TRACE_AFTER_DISPATCH(UniqueElementData) 206 DEFINE_TRACE_AFTER_DISPATCH(UniqueElementData)
207 { 207 {
208 visitor->trace(m_presentationAttributeStyle); 208 visitor->trace(m_presentationAttributeStyle);
209 ElementData::traceAfterDispatch(visitor); 209 ElementData::traceAfterDispatch(visitor);
210 } 210 }
211 211
212 } // namespace blink 212 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.cpp ('k') | third_party/WebKit/Source/core/dom/ElementDataCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698