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

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: Stop including NodeListsNodeData.h in ContainerNode.h 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 8717d1ec0eca6af845f2d8e1477be06a566784d7..a601ab9475c2d7a96e8090143def2b480678763e 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>
+PassRefPtrWillBeRawPtr<Collection> ContainerNode::ensureCachedCollection(CollectionType type, const AtomicString& namespaceURI, const AtomicString& localName)
adamk 2014/07/30 20:54:04 Missing inline?
Inactive 2014/07/30 21:03:46 Done.
+{
+ 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