| 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) | |
| 88 visitor->trace(m_idCache); | 87 visitor->trace(m_idCache); |
| 89 visitor->trace(m_nameCache); | 88 visitor->trace(m_nameCache); |
| 90 #endif | |
| 91 } | 89 } |
| 92 | 90 |
| 93 private: | 91 private: |
| 94 NamedItemCache(); | 92 NamedItemCache(); |
| 95 typedef WillBeHeapHashMap<StringImpl*, OwnPtrWillBeMember<WillBeHeapVect
or<RawPtrWillBeMember<Element> > > > StringToElementsMap; | 93 typedef WillBeHeapHashMap<StringImpl*, OwnPtrWillBeMember<WillBeHeapVect
or<RawPtrWillBeMember<Element> > > > StringToElementsMap; |
| 96 static void addElementToMap(StringToElementsMap& map, const AtomicString
& key, Element* element) | 94 static void addElementToMap(StringToElementsMap& map, const AtomicString
& key, Element* element) |
| 97 { | 95 { |
| 98 OwnPtrWillBeMember<WillBeHeapVector<RawPtrWillBeMember<Element> > >&
vector = map.add(key.impl(), nullptr).storedValue->value; | 96 OwnPtrWillBeMember<WillBeHeapVector<RawPtrWillBeMember<Element> > >&
vector = map.add(key.impl(), nullptr).storedValue->value; |
| 99 if (!vector) | 97 if (!vector) |
| 100 vector = adoptPtrWillBeNoop(new WillBeHeapVector<RawPtrWillBeMem
ber<Element> >); | 98 vector = adoptPtrWillBeNoop(new WillBeHeapVector<RawPtrWillBeMem
ber<Element> >); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 { | 156 { |
| 159 if (!attrName || shouldInvalidateTypeOnAttributeChange(invalidationType(), *
attrName)) | 157 if (!attrName || shouldInvalidateTypeOnAttributeChange(invalidationType(), *
attrName)) |
| 160 invalidateCache(); | 158 invalidateCache(); |
| 161 else if (*attrName == HTMLNames::idAttr || *attrName == HTMLNames::nameAttr) | 159 else if (*attrName == HTMLNames::idAttr || *attrName == HTMLNames::nameAttr) |
| 162 invalidateIdNameCacheMaps(); | 160 invalidateIdNameCacheMaps(); |
| 163 } | 161 } |
| 164 | 162 |
| 165 } // namespace | 163 } // namespace |
| 166 | 164 |
| 167 #endif | 165 #endif |
| OLD | NEW |