| OLD | NEW |
| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 static bool equal(const std::pair<unsigned char, StringImpl*>& a, const
std::pair<unsigned char, StringImpl*>& b) { return a == b; } | 87 static bool equal(const std::pair<unsigned char, StringImpl*>& a, const
std::pair<unsigned char, StringImpl*>& b) { return a == b; } |
| 88 static const bool safeToCompareToEmptyOrDeleted = DefaultHash<StringImpl
*>::Hash::safeToCompareToEmptyOrDeleted; | 88 static const bool safeToCompareToEmptyOrDeleted = DefaultHash<StringImpl
*>::Hash::safeToCompareToEmptyOrDeleted; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 // Oilpan: keep a weak reference to the collection objects. | 91 // Oilpan: keep a weak reference to the collection objects. |
| 92 // Explicit object unregistration in a non-Oilpan setting | 92 // Explicit object unregistration in a non-Oilpan setting |
| 93 // on object destruction is replaced by the garbage collector | 93 // on object destruction is replaced by the garbage collector |
| 94 // clearing out their weak reference. | 94 // clearing out their weak reference. |
| 95 typedef WillBeHeapHashMap<std::pair<unsigned char, StringImpl*>, RawPtrWillB
eWeakMember<LiveNodeListBase>, NodeListAtomicCacheMapEntryHash> NodeListAtomicNa
meCacheMap; | 95 typedef WillBeHeapHashMap<std::pair<unsigned char, StringImpl*>, RawPtrWillB
eWeakMember<LiveNodeListBase>, NodeListAtomicCacheMapEntryHash> NodeListAtomicNa
meCacheMap; |
| 96 typedef WillBeHeapHashMap<QualifiedName, RawPtrWillBeWeakMember<TagCollectio
n> > TagCollectionCacheNS; | 96 typedef WillBeHeapHashMap<QualifiedName, RawPtrWillBeWeakMember<TagCollectio
n>> TagCollectionCacheNS; |
| 97 | 97 |
| 98 template<typename T> | 98 template<typename T> |
| 99 PassRefPtrWillBeRawPtr<T> addCache(ContainerNode& node, CollectionType colle
ctionType, const AtomicString& name) | 99 PassRefPtrWillBeRawPtr<T> addCache(ContainerNode& node, CollectionType colle
ctionType, const AtomicString& name) |
| 100 { | 100 { |
| 101 NodeListAtomicNameCacheMap::AddResult result = m_atomicNameCaches.add(na
medNodeListKey(collectionType, name), nullptr); | 101 NodeListAtomicNameCacheMap::AddResult result = m_atomicNameCaches.add(na
medNodeListKey(collectionType, name), nullptr); |
| 102 if (!result.isNewEntry) { | 102 if (!result.isNewEntry) { |
| 103 #if ENABLE(OILPAN) | 103 #if ENABLE(OILPAN) |
| 104 return static_cast<T*>(result.storedValue->value.get()); | 104 return static_cast<T*>(result.storedValue->value.get()); |
| 105 #else | 105 #else |
| 106 return static_cast<T*>(result.storedValue->value); | 106 return static_cast<T*>(result.storedValue->value); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 template <typename Collection> | 258 template <typename Collection> |
| 259 inline Collection* ContainerNode::cachedCollection(CollectionType type) | 259 inline Collection* ContainerNode::cachedCollection(CollectionType type) |
| 260 { | 260 { |
| 261 NodeListsNodeData* nodeLists = this->nodeLists(); | 261 NodeListsNodeData* nodeLists = this->nodeLists(); |
| 262 return nodeLists ? nodeLists->cached<Collection>(type) : 0; | 262 return nodeLists ? nodeLists->cached<Collection>(type) : 0; |
| 263 } | 263 } |
| 264 | 264 |
| 265 } // namespace blink | 265 } // namespace blink |
| 266 | 266 |
| 267 #endif // NodeListsNodeData_h | 267 #endif // NodeListsNodeData_h |
| OLD | NEW |