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

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

Issue 112953007: Make TreeScope::documentScope() return a reference and ensure m_documentScope is never NULL (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added FIXMEs Created 6 years, 11 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/Node.h ('k') | Source/core/dom/StyleSheetCollection.h » ('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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 bool isEmpty() const 169 bool isEmpty() const
170 { 170 {
171 return m_atomicNameCaches.isEmpty() && m_nameCaches.isEmpty() && m_tagNo deListCacheNS.isEmpty(); 171 return m_atomicNameCaches.isEmpty() && m_nameCaches.isEmpty() && m_tagNo deListCacheNS.isEmpty();
172 } 172 }
173 173
174 void adoptTreeScope() 174 void adoptTreeScope()
175 { 175 {
176 invalidateCaches(); 176 invalidateCaches();
177 } 177 }
178 178
179 void adoptDocument(Document* oldDocument, Document* newDocument) 179 void adoptDocument(Document& oldDocument, Document& newDocument)
180 { 180 {
181 invalidateCaches(); 181 invalidateCaches();
182 182
183 if (oldDocument != newDocument) { 183 if (oldDocument != newDocument) {
184 NodeListAtomicNameCacheMap::const_iterator atomicNameCacheEnd = m_at omicNameCaches.end(); 184 NodeListAtomicNameCacheMap::const_iterator atomicNameCacheEnd = m_at omicNameCaches.end();
185 for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCac hes.begin(); it != atomicNameCacheEnd; ++it) { 185 for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCac hes.begin(); it != atomicNameCacheEnd; ++it) {
186 LiveNodeListBase* list = it->value; 186 LiveNodeListBase* list = it->value;
187 oldDocument->unregisterNodeList(list); 187 oldDocument.unregisterNodeList(list);
188 newDocument->registerNodeList(list); 188 newDocument.registerNodeList(list);
189 } 189 }
190 190
191 NodeListNameCacheMap::const_iterator nameCacheEnd = m_nameCaches.end (); 191 NodeListNameCacheMap::const_iterator nameCacheEnd = m_nameCaches.end ();
192 for (NodeListNameCacheMap::const_iterator it = m_nameCaches.begin(); it != nameCacheEnd; ++it) { 192 for (NodeListNameCacheMap::const_iterator it = m_nameCaches.begin(); it != nameCacheEnd; ++it) {
193 LiveNodeListBase* list = it->value; 193 LiveNodeListBase* list = it->value;
194 oldDocument->unregisterNodeList(list); 194 oldDocument.unregisterNodeList(list);
195 newDocument->registerNodeList(list); 195 newDocument.registerNodeList(list);
196 } 196 }
197 197
198 TagNodeListCacheNS::const_iterator tagEnd = m_tagNodeListCacheNS.end (); 198 TagNodeListCacheNS::const_iterator tagEnd = m_tagNodeListCacheNS.end ();
199 for (TagNodeListCacheNS::const_iterator it = m_tagNodeListCacheNS.be gin(); it != tagEnd; ++it) { 199 for (TagNodeListCacheNS::const_iterator it = m_tagNodeListCacheNS.be gin(); it != tagEnd; ++it) {
200 LiveNodeListBase* list = it->value; 200 LiveNodeListBase* list = it->value;
201 ASSERT(!list->isRootedAtDocument()); 201 ASSERT(!list->isRootedAtDocument());
202 oldDocument->unregisterNodeList(list); 202 oldDocument.unregisterNodeList(list);
203 newDocument->registerNodeList(list); 203 newDocument.registerNodeList(list);
204 } 204 }
205 } 205 }
206 } 206 }
207 207
208 private: 208 private:
209 NodeListsNodeData() 209 NodeListsNodeData()
210 : m_childNodeList(0) 210 : m_childNodeList(0)
211 { } 211 { }
212 212
213 std::pair<unsigned char, AtomicString> namedNodeListKey(CollectionType type, const AtomicString& name) 213 std::pair<unsigned char, AtomicString> namedNodeListKey(CollectionType type, const AtomicString& name)
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 ownerNode->clearNodeLists(); 298 ownerNode->clearNodeLists();
299 return true; 299 return true;
300 } 300 }
301 301
302 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow 302 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow
303 COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_da ta_count); 303 COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_da ta_count);
304 304
305 } // namespace WebCore 305 } // namespace WebCore
306 306
307 #endif // NodeRareData_h 307 #endif // NodeRareData_h
OLDNEW
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/dom/StyleSheetCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698