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

Unified Diff: Source/core/dom/NodeListsNodeData.h

Issue 342283005: Make collection caching code more consistent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nits Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/html/HTMLDataListElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/NodeListsNodeData.h
diff --git a/Source/core/dom/NodeListsNodeData.h b/Source/core/dom/NodeListsNodeData.h
index 1029929e5c96b0344a2d8d5808644f0ab2aff97b..66156ff8daa0d925037efad9808aedd413745fc9 100644
--- a/Source/core/dom/NodeListsNodeData.h
+++ b/Source/core/dom/NodeListsNodeData.h
@@ -236,6 +236,32 @@ inline bool NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLas
}
#endif
+template <typename Collection>
+inline PassRefPtrWillBeRawPtr<Collection> ContainerNode::ensureCachedCollection(CollectionType type)
+{
+ return ensureNodeLists().addCache<Collection>(*this, type);
+}
+
+template <typename Collection>
+inline PassRefPtrWillBeRawPtr<Collection> ContainerNode::ensureCachedCollection(CollectionType type, const AtomicString& name)
+{
+ return ensureNodeLists().addCache<Collection>(*this, type, name);
+}
+
+template <typename Collection>
+inline PassRefPtrWillBeRawPtr<Collection> ContainerNode::ensureCachedCollection(CollectionType type, const AtomicString& namespaceURI, const AtomicString& localName)
+{
+ ASSERT_UNUSED(type, type == TagCollectionType);
+ return ensureNodeLists().addCache(*this, namespaceURI, localName);
+}
+
+template <typename Collection>
+inline Collection* ContainerNode::cachedCollection(CollectionType type)
+{
+ NodeListsNodeData* nodeLists = this->nodeLists();
+ return nodeLists ? nodeLists->cached<Collection>(type) : 0;
+}
+
} // namespace blink
#endif // NodeListsNodeData_h
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/html/HTMLDataListElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698