Title: [120868] trunk/Source/WebCore
- Revision
- 120868
- Author
- [email protected]
- Date
- 2012-06-20 15:05:12 -0700 (Wed, 20 Jun 2012)
Log Message
Move m_listsInvalidatedAtDocument from NodeListsNodeData to Document
https://bugs.webkit.org/show_bug.cgi?id=89603
Reviewed by Andreas Kling.
Moved the variable. m_listsInvalidatedAtDocument is never used in non-Document nodes
so it was just wasting memory space.
* dom/Document.cpp:
(WebCore::Document::registerDynamicSubtreeNodeList):
(WebCore::Document::unregisterDynamicSubtreeNodeList):
(WebCore):
(WebCore::Document::clearNodeListCaches):
* dom/Document.h:
(Document):
* dom/DynamicNodeList.h:
(DynamicSubtreeNodeList):
* dom/Node.cpp:
(WebCore::Node::invalidateNodeListsCacheAfterAttributeChanged):
(WebCore::Node::invalidateNodeListsCacheAfterChildrenChanged):
(WebCore):
(WebCore::NodeListsNodeData::invalidateCachesThatDependOnAttributes): RadioNodeList
is invalidated at document level. No need to invalidate it again here.
(WebCore::NodeListsNodeData::isEmpty):
* dom/NodeRareData.h:
(NodeListsNodeData):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (120867 => 120868)
--- trunk/Source/WebCore/ChangeLog 2012-06-20 22:02:41 UTC (rev 120867)
+++ trunk/Source/WebCore/ChangeLog 2012-06-20 22:05:12 UTC (rev 120868)
@@ -1,3 +1,32 @@
+2012-06-20 Ryosuke Niwa <[email protected]>
+
+ Move m_listsInvalidatedAtDocument from NodeListsNodeData to Document
+ https://bugs.webkit.org/show_bug.cgi?id=89603
+
+ Reviewed by Andreas Kling.
+
+ Moved the variable. m_listsInvalidatedAtDocument is never used in non-Document nodes
+ so it was just wasting memory space.
+
+ * dom/Document.cpp:
+ (WebCore::Document::registerDynamicSubtreeNodeList):
+ (WebCore::Document::unregisterDynamicSubtreeNodeList):
+ (WebCore):
+ (WebCore::Document::clearNodeListCaches):
+ * dom/Document.h:
+ (Document):
+ * dom/DynamicNodeList.h:
+ (DynamicSubtreeNodeList):
+ * dom/Node.cpp:
+ (WebCore::Node::invalidateNodeListsCacheAfterAttributeChanged):
+ (WebCore::Node::invalidateNodeListsCacheAfterChildrenChanged):
+ (WebCore):
+ (WebCore::NodeListsNodeData::invalidateCachesThatDependOnAttributes): RadioNodeList
+ is invalidated at document level. No need to invalidate it again here.
+ (WebCore::NodeListsNodeData::isEmpty):
+ * dom/NodeRareData.h:
+ (NodeListsNodeData):
+
2012-06-20 Sheriff Bot <[email protected]>
Unreviewed, rolling out r120854.
Modified: trunk/Source/WebCore/dom/Document.cpp (120867 => 120868)
--- trunk/Source/WebCore/dom/Document.cpp 2012-06-20 22:02:41 UTC (rev 120867)
+++ trunk/Source/WebCore/dom/Document.cpp 2012-06-20 22:05:12 UTC (rev 120868)
@@ -3864,16 +3864,21 @@
void Document::registerDynamicSubtreeNodeList(DynamicSubtreeNodeList* list)
{
- ensureRareData()->ensureNodeLists(this)->m_listsInvalidatedAtDocument.add(list);
+ m_listsInvalidatedAtDocument.add(list);
}
void Document::unregisterDynamicSubtreeNodeList(DynamicSubtreeNodeList* list)
{
- ASSERT(hasRareData());
- ASSERT(rareData()->nodeLists());
- rareData()->nodeLists()->m_listsInvalidatedAtDocument.remove(list);
+ m_listsInvalidatedAtDocument.remove(list);
}
+void Document::clearNodeListCaches()
+{
+ HashSet<DynamicSubtreeNodeList*>::iterator end = m_listsInvalidatedAtDocument.end();
+ for (HashSet<DynamicSubtreeNodeList*>::iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it)
+ (*it)->invalidateCache();
+}
+
void Document::attachNodeIterator(NodeIterator* ni)
{
m_nodeIterators.add(ni);
Modified: trunk/Source/WebCore/dom/Document.h (120867 => 120868)
--- trunk/Source/WebCore/dom/Document.h 2012-06-20 22:02:41 UTC (rev 120867)
+++ trunk/Source/WebCore/dom/Document.h 2012-06-20 22:05:12 UTC (rev 120868)
@@ -714,6 +714,7 @@
void registerDynamicSubtreeNodeList(DynamicSubtreeNodeList*);
void unregisterDynamicSubtreeNodeList(DynamicSubtreeNodeList*);
+ void clearNodeListCaches();
void attachNodeIterator(NodeIterator*);
void detachNodeIterator(NodeIterator*);
@@ -1393,6 +1394,7 @@
OwnPtr<HTMLCollection> m_collections[NumUnnamedDocumentCachedTypes];
OwnPtr<HTMLAllCollection> m_allCollection;
+ HashSet<DynamicSubtreeNodeList*> m_listsInvalidatedAtDocument;
typedef HashMap<AtomicStringImpl*, OwnPtr<HTMLNameCollection> > NamedCollectionMap;
NamedCollectionMap m_documentNamedItemCollections;
Modified: trunk/Source/WebCore/dom/DynamicNodeList.h (120867 => 120868)
--- trunk/Source/WebCore/dom/DynamicNodeList.h 2012-06-20 22:02:41 UTC (rev 120867)
+++ trunk/Source/WebCore/dom/DynamicNodeList.h 2012-06-20 22:05:12 UTC (rev 120868)
@@ -104,9 +104,6 @@
DynamicSubtreeNodeList(PassRefPtr<Node>, RootType = RootedAtNode);
private:
- using DynamicNodeList::invalidateCache;
- friend struct NodeListsNodeData;
-
Node* itemForwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const;
Node* itemBackwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const;
};
Modified: trunk/Source/WebCore/dom/Node.cpp (120867 => 120868)
--- trunk/Source/WebCore/dom/Node.cpp 2012-06-20 22:02:41 UTC (rev 120867)
+++ trunk/Source/WebCore/dom/Node.cpp 2012-06-20 22:05:12 UTC (rev 120868)
@@ -967,10 +967,7 @@
&& (attrName != idAttr || !attributeOwnerElement->isFormControlElement()))
return;
- if (document()->hasRareData()) {
- if (NodeListsNodeData* nodeLists = document()->rareData()->nodeLists())
- nodeLists->invalidateCachesForDocument();
- }
+ document()->clearNodeListCaches();
if (!treeScope()->hasNodeListCaches())
return;
@@ -992,13 +989,11 @@
if (hasRareData())
rareData()->clearChildNodeListCache();
- if (document()->hasRareData()) {
- if (NodeListsNodeData* nodeLists = document()->rareData()->nodeLists())
- nodeLists->invalidateCachesForDocument();
- }
+ document()->clearNodeListCaches();
if (!treeScope()->hasNodeListCaches())
return;
+
for (Node* node = this; node; node = node->parentNode()) {
if (!node->hasRareData())
continue;
@@ -2325,13 +2320,6 @@
invalidateCachesThatDependOnAttributes();
}
-void NodeListsNodeData::invalidateCachesForDocument()
-{
- NodeListsNodeData::NodeListSet::iterator end = m_listsInvalidatedAtDocument.end();
- for (NodeListsNodeData::NodeListSet::iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it)
- (*it)->invalidateCache();
-}
-
void NodeListsNodeData::invalidateCachesThatDependOnAttributes()
{
ClassNodeListCache::iterator classCacheEnd = m_classNodeListCache.end();
@@ -2349,17 +2337,10 @@
for (MicroDataItemListCache::iterator it = m_microDataItemListCache.begin(); it != itemListCacheEnd; ++it)
it->second->invalidateCache();
#endif
-
- RadioNodeListCache::iterator radioNodeListCacheEnd = m_radioNodeListCache.end();
- for (RadioNodeListCache::iterator it = m_radioNodeListCache.begin(); it != radioNodeListCacheEnd; ++it)
- it->second->invalidateCache();
}
bool NodeListsNodeData::isEmpty() const
{
- if (!m_listsInvalidatedAtDocument.isEmpty())
- return false;
-
if (!m_tagNodeListCache.isEmpty())
return false;
if (!m_tagNodeListCacheNS.isEmpty())
Modified: trunk/Source/WebCore/dom/NodeRareData.h (120867 => 120868)
--- trunk/Source/WebCore/dom/NodeRareData.h 2012-06-20 22:02:41 UTC (rev 120867)
+++ trunk/Source/WebCore/dom/NodeRareData.h 2012-06-20 22:05:12 UTC (rev 120868)
@@ -51,9 +51,6 @@
struct NodeListsNodeData {
WTF_MAKE_NONCOPYABLE(NodeListsNodeData); WTF_MAKE_FAST_ALLOCATED;
public:
- typedef HashSet<DynamicSubtreeNodeList*> NodeListSet;
- NodeListSet m_listsInvalidatedAtDocument;
-
typedef HashMap<String, ClassNodeList*> ClassNodeListCache;
ClassNodeListCache m_classNodeListCache;
@@ -82,7 +79,6 @@
}
void invalidateCaches();
- void invalidateCachesForDocument();
void invalidateCachesThatDependOnAttributes();
bool isEmpty() const;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes