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

Side by Side Diff: third_party/WebKit/Source/core/dom/PresentationAttributeStyle.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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // Attribute order doesn't matter. Sort for easy equality comparison. 141 // Attribute order doesn't matter. Sort for easy equality comparison.
142 std::sort(result.attributesAndValues.begin(), result.attributesAndValues.end (), attributeNameSort); 142 std::sort(result.attributesAndValues.begin(), result.attributesAndValues.end (), attributeNameSort);
143 // The cache key is non-null when the tagName is set. 143 // The cache key is non-null when the tagName is set.
144 result.tagName = element.localName().impl(); 144 result.tagName = element.localName().impl();
145 } 145 }
146 146
147 static unsigned computePresentationAttributeCacheHash(const PresentationAttribut eCacheKey& key) 147 static unsigned computePresentationAttributeCacheHash(const PresentationAttribut eCacheKey& key)
148 { 148 {
149 if (!key.tagName) 149 if (!key.tagName)
150 return 0; 150 return 0;
151 ASSERT(key.attributesAndValues.size()); 151 DCHECK(key.attributesAndValues.size());
152 unsigned attributeHash = StringHasher::hashMemory(key.attributesAndValues.da ta(), key.attributesAndValues.size() * sizeof(key.attributesAndValues[0])); 152 unsigned attributeHash = StringHasher::hashMemory(key.attributesAndValues.da ta(), key.attributesAndValues.size() * sizeof(key.attributesAndValues[0]));
153 return WTF::hashInts(key.tagName->existingHash(), attributeHash); 153 return WTF::hashInts(key.tagName->existingHash(), attributeHash);
154 } 154 }
155 155
156 RawPtr<StylePropertySet> computePresentationAttributeStyle(Element& element) 156 RawPtr<StylePropertySet> computePresentationAttributeStyle(Element& element)
157 { 157 {
158 DEFINE_STATIC_LOCAL(PresentationAttributeCacheCleaner, cacheCleaner, ()); 158 DEFINE_STATIC_LOCAL(PresentationAttributeCacheCleaner, cacheCleaner, ());
159 159
160 ASSERT(element.isStyledElement()); 160 DCHECK(element.isStyledElement());
161 161
162 PresentationAttributeCacheKey cacheKey; 162 PresentationAttributeCacheKey cacheKey;
163 makePresentationAttributeCacheKey(element, cacheKey); 163 makePresentationAttributeCacheKey(element, cacheKey);
164 164
165 unsigned cacheHash = computePresentationAttributeCacheHash(cacheKey); 165 unsigned cacheHash = computePresentationAttributeCacheHash(cacheKey);
166 166
167 PresentationAttributeCache::ValueType* cacheValue; 167 PresentationAttributeCache::ValueType* cacheValue;
168 if (cacheHash) { 168 if (cacheHash) {
169 cacheValue = presentationAttributeCache().add(cacheHash, nullptr).stored Value; 169 cacheValue = presentationAttributeCache().add(cacheHash, nullptr).stored Value;
170 if (cacheValue->value && cacheValue->value->key != cacheKey) 170 if (cacheValue->value && cacheValue->value->key != cacheKey)
(...skipping 27 matching lines...) Expand all
198 presentationAttributeCache().clear(); 198 presentationAttributeCache().clear();
199 presentationAttributeCache().set(cacheHash, newEntry.release()); 199 presentationAttributeCache().set(cacheHash, newEntry.release());
200 } else { 200 } else {
201 cacheValue->value = newEntry.release(); 201 cacheValue->value = newEntry.release();
202 } 202 }
203 203
204 return style; 204 return style;
205 } 205 }
206 206
207 } // namespace blink 207 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/PendingScript.cpp ('k') | third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698