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

Side by Side Diff: third_party/WebKit/Source/core/css/invalidation/InvalidationSet.cpp

Issue 1389333003: Do not keep InvalidationSets on the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 for (const auto& tagName : *other.m_tagNames) 134 for (const auto& tagName : *other.m_tagNames)
135 addTagName(tagName); 135 addTagName(tagName);
136 } 136 }
137 137
138 if (other.m_attributes) { 138 if (other.m_attributes) {
139 for (const auto& attribute : *other.m_attributes) 139 for (const auto& attribute : *other.m_attributes)
140 addAttribute(attribute); 140 addAttribute(attribute);
141 } 141 }
142 } 142 }
143 143
144 WillBeHeapHashSet<AtomicString>& InvalidationSet::ensureClassSet() 144 HashSet<AtomicString>& InvalidationSet::ensureClassSet()
145 { 145 {
146 if (!m_classes) 146 if (!m_classes)
147 m_classes = adoptPtrWillBeNoop(new WillBeHeapHashSet<AtomicString>); 147 m_classes = adoptPtr(new HashSet<AtomicString>);
148 return *m_classes; 148 return *m_classes;
149 } 149 }
150 150
151 WillBeHeapHashSet<AtomicString>& InvalidationSet::ensureIdSet() 151 HashSet<AtomicString>& InvalidationSet::ensureIdSet()
152 { 152 {
153 if (!m_ids) 153 if (!m_ids)
154 m_ids = adoptPtrWillBeNoop(new WillBeHeapHashSet<AtomicString>); 154 m_ids = adoptPtr(new HashSet<AtomicString>);
155 return *m_ids; 155 return *m_ids;
156 } 156 }
157 157
158 WillBeHeapHashSet<AtomicString>& InvalidationSet::ensureTagNameSet() 158 HashSet<AtomicString>& InvalidationSet::ensureTagNameSet()
159 { 159 {
160 if (!m_tagNames) 160 if (!m_tagNames)
161 m_tagNames = adoptPtrWillBeNoop(new WillBeHeapHashSet<AtomicString>); 161 m_tagNames = adoptPtr(new HashSet<AtomicString>);
162 return *m_tagNames; 162 return *m_tagNames;
163 } 163 }
164 164
165 WillBeHeapHashSet<AtomicString>& InvalidationSet::ensureAttributeSet() 165 HashSet<AtomicString>& InvalidationSet::ensureAttributeSet()
166 { 166 {
167 if (!m_attributes) 167 if (!m_attributes)
168 m_attributes = adoptPtrWillBeNoop(new WillBeHeapHashSet<AtomicString>); 168 m_attributes = adoptPtr(new HashSet<AtomicString>);
169 return *m_attributes; 169 return *m_attributes;
170 } 170 }
171 171
172 void InvalidationSet::addClass(const AtomicString& className) 172 void InvalidationSet::addClass(const AtomicString& className)
173 { 173 {
174 if (wholeSubtreeInvalid()) 174 if (wholeSubtreeInvalid())
175 return; 175 return;
176 ensureClassSet().add(className); 176 ensureClassSet().add(className);
177 } 177 }
178 178
(...skipping 26 matching lines...) Expand all
205 m_allDescendantsMightBeInvalid = true; 205 m_allDescendantsMightBeInvalid = true;
206 m_customPseudoInvalid = false; 206 m_customPseudoInvalid = false;
207 m_treeBoundaryCrossing = false; 207 m_treeBoundaryCrossing = false;
208 m_insertionPointCrossing = false; 208 m_insertionPointCrossing = false;
209 m_classes = nullptr; 209 m_classes = nullptr;
210 m_ids = nullptr; 210 m_ids = nullptr;
211 m_tagNames = nullptr; 211 m_tagNames = nullptr;
212 m_attributes = nullptr; 212 m_attributes = nullptr;
213 } 213 }
214 214
215 DEFINE_TRACE(InvalidationSet)
216 {
217 #if ENABLE(OILPAN)
218 visitor->trace(m_classes);
219 visitor->trace(m_ids);
220 visitor->trace(m_tagNames);
221 visitor->trace(m_attributes);
222 #endif
223 }
224
225 void InvalidationSet::toTracedValue(TracedValue* value) const 215 void InvalidationSet::toTracedValue(TracedValue* value) const
226 { 216 {
227 value->beginDictionary(); 217 value->beginDictionary();
228 218
229 value->setString("id", descendantInvalidationSetToIdString(*this)); 219 value->setString("id", descendantInvalidationSetToIdString(*this));
230 220
231 if (m_allDescendantsMightBeInvalid) 221 if (m_allDescendantsMightBeInvalid)
232 value->setBoolean("allDescendantsMightBeInvalid", true); 222 value->setBoolean("allDescendantsMightBeInvalid", true);
233 if (m_customPseudoInvalid) 223 if (m_customPseudoInvalid)
234 value->setBoolean("customPseudoInvalid", true); 224 value->setBoolean("customPseudoInvalid", true);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 { 263 {
274 RefPtr<TracedValue> value = TracedValue::create(); 264 RefPtr<TracedValue> value = TracedValue::create();
275 value->beginArray("InvalidationSet"); 265 value->beginArray("InvalidationSet");
276 toTracedValue(value.get()); 266 toTracedValue(value.get());
277 value->endArray(); 267 value->endArray();
278 fprintf(stderr, "%s\n", value->asTraceFormat().ascii().data()); 268 fprintf(stderr, "%s\n", value->asTraceFormat().ascii().data());
279 } 269 }
280 #endif // NDEBUG 270 #endif // NDEBUG
281 271
282 } // namespace blink 272 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698