diff options
author | Kulanthaivel Palanichamy <kulanthaivel@codeaurora.org> | 2012-11-27 11:50:21 -0800 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2013-01-21 01:19:49 -0800 |
commit | 68e9c4e7cda8607f395a75781809fabbcc2bbeb8 (patch) | |
tree | f0821a7c1d6f2f4e1b38ec045efa5f875c7b8a02 /Source/WebCore/dom/Node.cpp | |
parent | 4bb8cc2e30240dd477bdb3fa20c16c9208ad7292 (diff) | |
download | external_webkit-68e9c4e7cda8607f395a75781809fabbcc2bbeb8.zip external_webkit-68e9c4e7cda8607f395a75781809fabbcc2bbeb8.tar.gz external_webkit-68e9c4e7cda8607f395a75781809fabbcc2bbeb8.tar.bz2 |
[WebKit] Fix for the memory leak
Memory leak was introduced by "DOM traversal optimizations DOM
Core optimizations Prefetch optimization for DOM Tree Traversal"
Cachelist was being mismanaged. Removing it.
Change-Id: I8abb2b6b30b1fbeb931a19be3567c78c3f697d77
Diffstat (limited to 'Source/WebCore/dom/Node.cpp')
-rw-r--r-- | Source/WebCore/dom/Node.cpp | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp index 5b173bf..facb694 100644 --- a/Source/WebCore/dom/Node.cpp +++ b/Source/WebCore/dom/Node.cpp @@ -628,12 +628,8 @@ void Node::setNodeValue(const String& /*nodeValue*/, ExceptionCode& ec) PassRefPtr<NodeList> Node::childNodes() { NodeListsNodeData* data = ensureRareData()->ensureNodeLists(this); - if (data->m_childNodeListCache) - return PassRefPtr<ChildNodeList>(data->m_childNodeListCache); - RefPtr<ChildNodeList> childNodeList = ChildNodeList::create(this); - data->m_childNodeListCache = childNodeList.get(); - return childNodeList.release(); + return ChildNodeList::create(this, data->m_childNodeListCaches.get()); } Node *Node::lastDescendant() const @@ -1149,16 +1145,6 @@ void Node::removeCachedLabelsNodeList(DynamicNodeList* list) data->m_labelsNodeListCache = 0; } -void Node::removeCachedChildNodeList(DynamicNodeList* list) -{ - ASSERT(rareData()); - ASSERT(rareData()->nodeLists()); - ASSERT_UNUSED(list, list->hasOwnCaches()); - - NodeListsNodeData* data = rareData()->nodeLists(); - data->m_childNodeListCache = 0; -} - Node* Node::traverseNextNode(const Node* stayWithin) const { prefetchTarget(); @@ -2504,8 +2490,7 @@ void Node::formatForDebugger(char* buffer, unsigned length) const void NodeListsNodeData::invalidateCaches() { - if (m_childNodeListCache) - m_childNodeListCache->invalidateCache(); + m_childNodeListCaches->reset(); if (m_labelsNodeListCache) m_labelsNodeListCache->invalidateCache(); @@ -2536,7 +2521,7 @@ bool NodeListsNodeData::isEmpty() const if (!m_listsWithCaches.isEmpty()) return false; - if (m_childNodeListCache) + if (m_childNodeListCaches->refCount()) return false; TagNodeListCacheNS::const_iterator tagCacheEndNS = m_tagNodeListCacheNS.end(); |