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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/html/HTMLDataListElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 David Smith <catfish.man@gmail.com> 3 * Copyright (C) 2008 David Smith <catfish.man@gmail.com>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 inline bool NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLas tList(Node& ownerNode) 229 inline bool NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLas tList(Node& ownerNode)
230 { 230 {
231 ASSERT(ownerNode.nodeLists() == this); 231 ASSERT(ownerNode.nodeLists() == this);
232 if ((m_childNodeList ? 1 : 0) + m_atomicNameCaches.size() + m_tagCollectionC acheNS.size() != 1) 232 if ((m_childNodeList ? 1 : 0) + m_atomicNameCaches.size() + m_tagCollectionC acheNS.size() != 1)
233 return false; 233 return false;
234 ownerNode.clearNodeLists(); 234 ownerNode.clearNodeLists();
235 return true; 235 return true;
236 } 236 }
237 #endif 237 #endif
238 238
239 template <typename Collection>
240 inline PassRefPtrWillBeRawPtr<Collection> ContainerNode::ensureCachedCollection( CollectionType type)
241 {
242 return ensureNodeLists().addCache<Collection>(*this, type);
243 }
244
245 template <typename Collection>
246 inline PassRefPtrWillBeRawPtr<Collection> ContainerNode::ensureCachedCollection( CollectionType type, const AtomicString& name)
247 {
248 return ensureNodeLists().addCache<Collection>(*this, type, name);
249 }
250
251 template <typename Collection>
252 PassRefPtrWillBeRawPtr<Collection> ContainerNode::ensureCachedCollection(Collect ionType type, const AtomicString& namespaceURI, const AtomicString& localName)
adamk 2014/07/30 20:54:04 Missing inline?
Inactive 2014/07/30 21:03:46 Done.
253 {
254 ASSERT_UNUSED(type, type == TagCollectionType);
255 return ensureNodeLists().addCache(*this, namespaceURI, localName);
256 }
257
258 template <typename Collection>
259 inline Collection* ContainerNode::cachedCollection(CollectionType type)
260 {
261 NodeListsNodeData* nodeLists = this->nodeLists();
262 return nodeLists ? nodeLists->cached<Collection>(type) : 0;
263 }
264
239 } // namespace blink 265 } // namespace blink
240 266
241 #endif // NodeListsNodeData_h 267 #endif // NodeListsNodeData_h
OLDNEW
« 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