| OLD | NEW |
| 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All r
ights reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All r
ights reserved. |
| 5 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 5 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 return adoptPtrWillBeNoop(new NamedItemCache); | 77 return adoptPtrWillBeNoop(new NamedItemCache); |
| 78 } | 78 } |
| 79 | 79 |
| 80 WillBeHeapVector<RawPtrWillBeMember<Element> >* getElementsById(const At
omicString& id) const { return m_idCache.get(id.impl()); } | 80 WillBeHeapVector<RawPtrWillBeMember<Element> >* getElementsById(const At
omicString& id) const { return m_idCache.get(id.impl()); } |
| 81 WillBeHeapVector<RawPtrWillBeMember<Element> >* getElementsByName(const
AtomicString& name) const { return m_nameCache.get(name.impl()); } | 81 WillBeHeapVector<RawPtrWillBeMember<Element> >* getElementsByName(const
AtomicString& name) const { return m_nameCache.get(name.impl()); } |
| 82 void addElementWithId(const AtomicString& id, Element* element) { addEle
mentToMap(m_idCache, id, element); } | 82 void addElementWithId(const AtomicString& id, Element* element) { addEle
mentToMap(m_idCache, id, element); } |
| 83 void addElementWithName(const AtomicString& name, Element* element) { ad
dElementToMap(m_nameCache, name, element); } | 83 void addElementWithName(const AtomicString& name, Element* element) { ad
dElementToMap(m_nameCache, name, element); } |
| 84 | 84 |
| 85 void trace(Visitor* visitor) | 85 void trace(Visitor* visitor) |
| 86 { | 86 { |
| 87 #if ENABLE(OILPAN) |
| 87 visitor->trace(m_idCache); | 88 visitor->trace(m_idCache); |
| 88 visitor->trace(m_nameCache); | 89 visitor->trace(m_nameCache); |
| 90 #endif |
| 89 } | 91 } |
| 90 | 92 |
| 91 private: | 93 private: |
| 92 NamedItemCache(); | 94 NamedItemCache(); |
| 93 typedef WillBeHeapHashMap<StringImpl*, OwnPtrWillBeMember<WillBeHeapVect
or<RawPtrWillBeMember<Element> > > > StringToElementsMap; | 95 typedef WillBeHeapHashMap<StringImpl*, OwnPtrWillBeMember<WillBeHeapVect
or<RawPtrWillBeMember<Element> > > > StringToElementsMap; |
| 94 static void addElementToMap(StringToElementsMap& map, const AtomicString
& key, Element* element) | 96 static void addElementToMap(StringToElementsMap& map, const AtomicString
& key, Element* element) |
| 95 { | 97 { |
| 96 OwnPtrWillBeMember<WillBeHeapVector<RawPtrWillBeMember<Element> > >&
vector = map.add(key.impl(), nullptr).storedValue->value; | 98 OwnPtrWillBeMember<WillBeHeapVector<RawPtrWillBeMember<Element> > >&
vector = map.add(key.impl(), nullptr).storedValue->value; |
| 97 if (!vector) | 99 if (!vector) |
| 98 vector = adoptPtrWillBeNoop(new WillBeHeapVector<RawPtrWillBeMem
ber<Element> >); | 100 vector = adoptPtrWillBeNoop(new WillBeHeapVector<RawPtrWillBeMem
ber<Element> >); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 { | 158 { |
| 157 if (!attrName || shouldInvalidateTypeOnAttributeChange(invalidationType(), *
attrName)) | 159 if (!attrName || shouldInvalidateTypeOnAttributeChange(invalidationType(), *
attrName)) |
| 158 invalidateCache(); | 160 invalidateCache(); |
| 159 else if (*attrName == HTMLNames::idAttr || *attrName == HTMLNames::nameAttr) | 161 else if (*attrName == HTMLNames::idAttr || *attrName == HTMLNames::nameAttr) |
| 160 invalidateIdNameCacheMaps(); | 162 invalidateIdNameCacheMaps(); |
| 161 } | 163 } |
| 162 | 164 |
| 163 } // namespace | 165 } // namespace |
| 164 | 166 |
| 165 #endif | 167 #endif |
| OLD | NEW |