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

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

Issue 159913004: Stop handling the case where oldDocument and newDocument are the same in adoptDocument() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | « no previous file | Source/core/dom/TreeScopeAdopter.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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 return m_atomicNameCaches.isEmpty() && m_tagCollectionCacheNS.isEmpty(); 166 return m_atomicNameCaches.isEmpty() && m_tagCollectionCacheNS.isEmpty();
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 invalidateCaches(); 177 invalidateCaches();
177 178
178 if (oldDocument != newDocument) { 179 NodeListAtomicNameCacheMap::const_iterator atomicNameCacheEnd = m_atomic NameCaches.end();
179 NodeListAtomicNameCacheMap::const_iterator atomicNameCacheEnd = m_at omicNameCaches.end(); 180 for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCaches. begin(); it != atomicNameCacheEnd; ++it) {
180 for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCac hes.begin(); it != atomicNameCacheEnd; ++it) { 181 LiveNodeListBase* list = it->value;
181 LiveNodeListBase* list = it->value; 182 oldDocument.unregisterNodeList(list);
182 oldDocument.unregisterNodeList(list); 183 newDocument.registerNodeList(list);
183 newDocument.registerNodeList(list); 184 }
184 }
185 185
186 TagCollectionCacheNS::const_iterator tagEnd = m_tagCollectionCacheNS .end(); 186 TagCollectionCacheNS::const_iterator tagEnd = m_tagCollectionCacheNS.end ();
187 for (TagCollectionCacheNS::const_iterator it = m_tagCollectionCacheN S.begin(); it != tagEnd; ++it) { 187 for (TagCollectionCacheNS::const_iterator it = m_tagCollectionCacheNS.be gin(); it != tagEnd; ++it) {
188 LiveNodeListBase* list = it->value; 188 LiveNodeListBase* list = it->value;
189 ASSERT(!list->isRootedAtDocument()); 189 ASSERT(!list->isRootedAtDocument());
190 oldDocument.unregisterNodeList(list); 190 oldDocument.unregisterNodeList(list);
191 newDocument.registerNodeList(list); 191 newDocument.registerNodeList(list);
192 }
193 } 192 }
194 } 193 }
195 194
196 private: 195 private:
197 NodeListsNodeData() 196 NodeListsNodeData()
198 : m_childNodeList(0) 197 : m_childNodeList(0)
199 { } 198 { }
200 199
201 std::pair<unsigned char, StringImpl*> namedNodeListKey(CollectionType type, const AtomicString& name) 200 std::pair<unsigned char, StringImpl*> namedNodeListKey(CollectionType type, const AtomicString& name)
202 { 201 {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 ownerNode->clearNodeLists(); 280 ownerNode->clearNodeLists();
282 return true; 281 return true;
283 } 282 }
284 283
285 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow 284 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow
286 COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_da ta_count); 285 COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_da ta_count);
287 286
288 } // namespace WebCore 287 } // namespace WebCore
289 288
290 #endif // NodeRareData_h 289 #endif // NodeRareData_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/TreeScopeAdopter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698