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

Side by Side Diff: Source/core/dom/TagCollection.h

Issue 280123002: Oilpan: move LiveNodeList collections to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Have NodeRareData clear out NodeListsNodeData instead. Created 6 years, 7 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
« no previous file with comments | « Source/core/dom/StaticNodeList.cpp ('k') | Source/core/dom/TagCollection.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 15 matching lines...) Expand all
26 26
27 #include "core/dom/Element.h" 27 #include "core/dom/Element.h"
28 #include "core/html/HTMLCollection.h" 28 #include "core/html/HTMLCollection.h"
29 #include "wtf/text/AtomicString.h" 29 #include "wtf/text/AtomicString.h"
30 30
31 namespace WebCore { 31 namespace WebCore {
32 32
33 // Collection that limits to a particular tag. 33 // Collection that limits to a particular tag.
34 class TagCollection : public HTMLCollection { 34 class TagCollection : public HTMLCollection {
35 public: 35 public:
36 static PassRefPtr<TagCollection> create(ContainerNode& rootNode, const Atomi cString& namespaceURI, const AtomicString& localName) 36 static PassRefPtrWillBeRawPtr<TagCollection> create(ContainerNode& rootNode, const AtomicString& namespaceURI, const AtomicString& localName)
37 { 37 {
38 ASSERT(namespaceURI != starAtom); 38 ASSERT(namespaceURI != starAtom);
39 return adoptRef(new TagCollection(rootNode, TagCollectionType, namespace URI, localName)); 39 return adoptRefWillBeNoop(new TagCollection(rootNode, TagCollectionType, namespaceURI, localName));
40 } 40 }
41 41
42 static PassRefPtr<TagCollection> create(ContainerNode& rootNode, CollectionT ype type, const AtomicString& localName) 42 static PassRefPtrWillBeRawPtr<TagCollection> create(ContainerNode& rootNode, CollectionType type, const AtomicString& localName)
43 { 43 {
44 ASSERT_UNUSED(type, type == TagCollectionType); 44 ASSERT_UNUSED(type, type == TagCollectionType);
45 return adoptRef(new TagCollection(rootNode, TagCollectionType, starAtom, localName)); 45 return adoptRefWillBeNoop(new TagCollection(rootNode, TagCollectionType, starAtom, localName));
46 } 46 }
47 47
48 virtual ~TagCollection(); 48 virtual ~TagCollection();
49 49
50 bool elementMatches(const Element&) const; 50 bool elementMatches(const Element&) const;
51 51
52 protected: 52 protected:
53 TagCollection(ContainerNode& rootNode, CollectionType, const AtomicString& n amespaceURI, const AtomicString& localName); 53 TagCollection(ContainerNode& rootNode, CollectionType, const AtomicString& n amespaceURI, const AtomicString& localName);
54 54
55 AtomicString m_namespaceURI; 55 AtomicString m_namespaceURI;
56 AtomicString m_localName; 56 AtomicString m_localName;
57 }; 57 };
58 58
59 class HTMLTagCollection FINAL : public TagCollection { 59 class HTMLTagCollection FINAL : public TagCollection {
60 public: 60 public:
61 static PassRefPtr<HTMLTagCollection> create(ContainerNode& rootNode, Collect ionType type, const AtomicString& localName) 61 static PassRefPtrWillBeRawPtr<HTMLTagCollection> create(ContainerNode& rootN ode, CollectionType type, const AtomicString& localName)
62 { 62 {
63 ASSERT_UNUSED(type, type == HTMLTagCollectionType); 63 ASSERT_UNUSED(type, type == HTMLTagCollectionType);
64 return adoptRef(new HTMLTagCollection(rootNode, localName)); 64 return adoptRefWillBeNoop(new HTMLTagCollection(rootNode, localName));
65 } 65 }
66 66
67 bool elementMatches(const Element&) const; 67 bool elementMatches(const Element&) const;
68 68
69 private: 69 private:
70 HTMLTagCollection(ContainerNode& rootNode, const AtomicString& localName); 70 HTMLTagCollection(ContainerNode& rootNode, const AtomicString& localName);
71 71
72 AtomicString m_loweredLocalName; 72 AtomicString m_loweredLocalName;
73 }; 73 };
74 74
75 inline bool HTMLTagCollection::elementMatches(const Element& testElement) const 75 inline bool HTMLTagCollection::elementMatches(const Element& testElement) const
76 { 76 {
77 // Implements http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#conce pt-getelementsbytagname 77 // Implements http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#conce pt-getelementsbytagname
78 if (m_localName != starAtom) { 78 if (m_localName != starAtom) {
79 const AtomicString& localName = testElement.isHTMLElement() ? m_loweredL ocalName : m_localName; 79 const AtomicString& localName = testElement.isHTMLElement() ? m_loweredL ocalName : m_localName;
80 if (localName != testElement.localName()) 80 if (localName != testElement.localName())
81 return false; 81 return false;
82 } 82 }
83 ASSERT(m_namespaceURI == starAtom); 83 ASSERT(m_namespaceURI == starAtom);
84 return true; 84 return true;
85 } 85 }
86 86
87 } // namespace WebCore 87 } // namespace WebCore
88 88
89 #endif // TagCollection_h 89 #endif // TagCollection_h
OLDNEW
« no previous file with comments | « Source/core/dom/StaticNodeList.cpp ('k') | Source/core/dom/TagCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698