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

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

Issue 280123002: Oilpan: move LiveNodeList collections to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Make NodeListsNodeData::m_owner a strong ref Created 6 years, 7 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 it->value->invalidateCacheForAttribute(attrName); 51 it->value->invalidateCacheForAttribute(attrName);
52 52
53 if (attrName) 53 if (attrName)
54 return; 54 return;
55 55
56 TagCollectionCacheNS::iterator tagCacheEnd = m_tagCollectionCacheNS.end(); 56 TagCollectionCacheNS::iterator tagCacheEnd = m_tagCollectionCacheNS.end();
57 for (TagCollectionCacheNS::iterator it = m_tagCollectionCacheNS.begin(); it != tagCacheEnd; ++it) 57 for (TagCollectionCacheNS::iterator it = m_tagCollectionCacheNS.begin(); it != tagCacheEnd; ++it)
58 it->value->invalidateCache(); 58 it->value->invalidateCache();
59 } 59 }
60 60
61 #if ENABLE(OILPAN)
62 void NodeListsNodeData::clearWeakMembers(Visitor* visitor)
63 {
64 if (m_childNodeList && !visitor->isAlive(m_childNodeList))
haraken 2014/05/20 09:27:33 Nit: You don't need to check m_childNodeList.
65 m_childNodeList.clear();
66 if (!m_childNodeList && !m_atomicNameCaches.size() && !m_tagCollectionCacheN S.size())
67 m_owner->clearNodeLists();
68 }
69 #endif
70
71 void NodeListsNodeData::trace(Visitor* visitor)
72 {
73 #if ENABLE(OILPAN)
Erik Corry 2014/05/20 09:09:48 An alternative (I think simpler) way to do this wo
sof 2014/05/20 09:54:57 I like this,it just fits better all around to move
74 visitor->trace(m_atomicNameCaches);
75 visitor->trace(m_tagCollectionCacheNS);
76 visitor->trace(m_owner);
77 // NOTE: The m_childNodeList weak member is manually updated in
78 // clearWeakMembers() above hence not traced as a weak member
79 // here.
80 visitor->registerWeakMembers<NodeListsNodeData, &NodeListsNodeData::clearWea kMembers>(this);
81 #endif
82 }
83
61 void NodeRareData::traceAfterDispatch(Visitor* visitor) 84 void NodeRareData::traceAfterDispatch(Visitor* visitor)
62 { 85 {
63 visitor->trace(m_mutationObserverData); 86 visitor->trace(m_mutationObserverData);
87 visitor->trace(m_nodeLists);
64 } 88 }
65 89
66 void NodeRareData::trace(Visitor* visitor) 90 void NodeRareData::trace(Visitor* visitor)
67 { 91 {
68 if (m_isElementRareData) 92 if (m_isElementRareData)
69 static_cast<ElementRareData*>(this)->traceAfterDispatch(visitor); 93 static_cast<ElementRareData*>(this)->traceAfterDispatch(visitor);
70 else 94 else
71 traceAfterDispatch(visitor); 95 traceAfterDispatch(visitor);
72 } 96 }
73 97
74 void NodeRareData::finalizeGarbageCollectedObject() 98 void NodeRareData::finalizeGarbageCollectedObject()
75 { 99 {
76 RELEASE_ASSERT(!renderer()); 100 RELEASE_ASSERT(!renderer());
77 if (m_isElementRareData) 101 if (m_isElementRareData)
78 static_cast<ElementRareData*>(this)->~ElementRareData(); 102 static_cast<ElementRareData*>(this)->~ElementRareData();
79 else 103 else
80 this->~NodeRareData(); 104 this->~NodeRareData();
81 } 105 }
82 106
83 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow 107 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow
84 COMPILE_ASSERT(Page::maxNumberOfFrames < (1 << NodeRareData::ConnectedFrameCount Bits), Frame_limit_should_fit_in_rare_data_count); 108 COMPILE_ASSERT(Page::maxNumberOfFrames < (1 << NodeRareData::ConnectedFrameCount Bits), Frame_limit_should_fit_in_rare_data_count);
85 109
86 } // namespace WebCore 110 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698