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

Side by Side Diff: Source/core/dom/NodeRareData.h

Issue 159503003: Do not cause unnecessary node lists invalidation on id/name attribute change (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/LiveNodeList.cpp ('k') | Source/core/html/HTMLAllCollection.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 David Smith <catfish.man@gmail.com> 3 * Copyright (C) 2008 David Smith <catfish.man@gmail.com>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 168
169 void adoptTreeScope() 169 void adoptTreeScope()
170 { 170 {
171 invalidateCaches(); 171 invalidateCaches();
172 } 172 }
173 173
174 void adoptDocument(Document& oldDocument, Document& newDocument) 174 void adoptDocument(Document& oldDocument, Document& newDocument)
175 { 175 {
176 ASSERT(oldDocument != newDocument); 176 ASSERT(oldDocument != newDocument);
177 invalidateCaches();
178 177
179 NodeListAtomicNameCacheMap::const_iterator atomicNameCacheEnd = m_atomic NameCaches.end(); 178 NodeListAtomicNameCacheMap::const_iterator atomicNameCacheEnd = m_atomic NameCaches.end();
180 for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCaches. begin(); it != atomicNameCacheEnd; ++it) { 179 for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCaches. begin(); it != atomicNameCacheEnd; ++it) {
181 LiveNodeListBase* list = it->value; 180 LiveNodeListBase* list = it->value;
182 oldDocument.unregisterNodeList(list); 181 list->didMoveToDocument(oldDocument, newDocument);
183 newDocument.registerNodeList(list);
184 } 182 }
185 183
186 TagCollectionCacheNS::const_iterator tagEnd = m_tagCollectionCacheNS.end (); 184 TagCollectionCacheNS::const_iterator tagEnd = m_tagCollectionCacheNS.end ();
187 for (TagCollectionCacheNS::const_iterator it = m_tagCollectionCacheNS.be gin(); it != tagEnd; ++it) { 185 for (TagCollectionCacheNS::const_iterator it = m_tagCollectionCacheNS.be gin(); it != tagEnd; ++it) {
188 LiveNodeListBase* list = it->value; 186 LiveNodeListBase* list = it->value;
189 ASSERT(!list->isRootedAtDocument()); 187 ASSERT(!list->isRootedAtDocument());
190 oldDocument.unregisterNodeList(list); 188 list->didMoveToDocument(oldDocument, newDocument);
191 newDocument.registerNodeList(list);
192 } 189 }
193 } 190 }
194 191
195 private: 192 private:
196 NodeListsNodeData() 193 NodeListsNodeData()
197 : m_childNodeList(0) 194 : m_childNodeList(0)
198 { } 195 { }
199 196
200 std::pair<unsigned char, StringImpl*> namedNodeListKey(CollectionType type, const AtomicString& name) 197 std::pair<unsigned char, StringImpl*> namedNodeListKey(CollectionType type, const AtomicString& name)
201 { 198 {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 ownerNode->clearNodeLists(); 277 ownerNode->clearNodeLists();
281 return true; 278 return true;
282 } 279 }
283 280
284 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow 281 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow
285 COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_da ta_count); 282 COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_da ta_count);
286 283
287 } // namespace WebCore 284 } // namespace WebCore
288 285
289 #endif // NodeRareData_h 286 #endif // NodeRareData_h
OLDNEW
« no previous file with comments | « Source/core/dom/LiveNodeList.cpp ('k') | Source/core/html/HTMLAllCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698