OLD | NEW |
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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 TagNodeListCacheNS::const_iterator tagEnd = m_tagNodeListCacheNS.end
(); | 202 TagNodeListCacheNS::const_iterator tagEnd = m_tagNodeListCacheNS.end
(); |
203 for (TagNodeListCacheNS::const_iterator it = m_tagNodeListCacheNS.be
gin(); it != tagEnd; ++it) { | 203 for (TagNodeListCacheNS::const_iterator it = m_tagNodeListCacheNS.be
gin(); it != tagEnd; ++it) { |
204 LiveNodeListBase* list = it->value; | 204 LiveNodeListBase* list = it->value; |
205 ASSERT(!list->isRootedAtDocument()); | 205 ASSERT(!list->isRootedAtDocument()); |
206 oldDocument->unregisterNodeList(list); | 206 oldDocument->unregisterNodeList(list); |
207 newDocument->registerNodeList(list); | 207 newDocument->registerNodeList(list); |
208 } | 208 } |
209 } | 209 } |
210 } | 210 } |
211 | 211 |
212 void reportMemoryUsage(MemoryObjectInfo*) const; | |
213 | |
214 private: | 212 private: |
215 NodeListsNodeData() | 213 NodeListsNodeData() |
216 : m_childNodeList(0) | 214 : m_childNodeList(0) |
217 { } | 215 { } |
218 | 216 |
219 std::pair<unsigned char, AtomicString> namedNodeListKey(CollectionType type,
const AtomicString& name) | 217 std::pair<unsigned char, AtomicString> namedNodeListKey(CollectionType type,
const AtomicString& name) |
220 { | 218 { |
221 return std::pair<unsigned char, AtomicString>(type, name); | 219 return std::pair<unsigned char, AtomicString>(type, name); |
222 } | 220 } |
223 | 221 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 { | 273 { |
276 m_connectedFrameCount += amount; | 274 m_connectedFrameCount += amount; |
277 } | 275 } |
278 void decrementConnectedSubframeCount(unsigned amount) | 276 void decrementConnectedSubframeCount(unsigned amount) |
279 { | 277 { |
280 ASSERT(m_connectedFrameCount); | 278 ASSERT(m_connectedFrameCount); |
281 ASSERT(amount <= m_connectedFrameCount); | 279 ASSERT(amount <= m_connectedFrameCount); |
282 m_connectedFrameCount -= amount; | 280 m_connectedFrameCount -= amount; |
283 } | 281 } |
284 | 282 |
285 // This member function is intentionally not virtual to avoid adding a vtabl
e pointer. | |
286 void reportMemoryUsage(MemoryObjectInfo*) const; | |
287 | |
288 protected: | 283 protected: |
289 NodeRareData(RenderObject* renderer) | 284 NodeRareData(RenderObject* renderer) |
290 : NodeRareDataBase(renderer) | 285 : NodeRareDataBase(renderer) |
291 , m_connectedFrameCount(0) | 286 , m_connectedFrameCount(0) |
292 { } | 287 { } |
293 | 288 |
294 private: | 289 private: |
295 unsigned m_connectedFrameCount : 10; // Must fit Page::maxNumberOfFrames. | 290 unsigned m_connectedFrameCount : 10; // Must fit Page::maxNumberOfFrames. |
296 | 291 |
297 OwnPtr<NodeListsNodeData> m_nodeLists; | 292 OwnPtr<NodeListsNodeData> m_nodeLists; |
298 OwnPtr<NodeMutationObserverData> m_mutationObserverData; | 293 OwnPtr<NodeMutationObserverData> m_mutationObserverData; |
299 }; | 294 }; |
300 | 295 |
301 inline bool NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLas
tList(Node* ownerNode) | 296 inline bool NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLas
tList(Node* ownerNode) |
302 { | 297 { |
303 ASSERT(ownerNode); | 298 ASSERT(ownerNode); |
304 ASSERT(ownerNode->nodeLists() == this); | 299 ASSERT(ownerNode->nodeLists() == this); |
305 if ((m_childNodeList ? 1 : 0) + m_atomicNameCaches.size() + m_nameCaches.siz
e() + m_tagNodeListCacheNS.size() != 1) | 300 if ((m_childNodeList ? 1 : 0) + m_atomicNameCaches.size() + m_nameCaches.siz
e() + m_tagNodeListCacheNS.size() != 1) |
306 return false; | 301 return false; |
307 ownerNode->clearNodeLists(); | 302 ownerNode->clearNodeLists(); |
308 return true; | 303 return true; |
309 } | 304 } |
310 | 305 |
311 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow | 306 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow |
312 COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_da
ta_count); | 307 COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_da
ta_count); |
313 | 308 |
314 } // namespace WebCore | 309 } // namespace WebCore |
315 | 310 |
316 #endif // NodeRareData_h | 311 #endif // NodeRareData_h |
OLD | NEW |