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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 RefPtrWillBeRawPtr<T> list; |
102 if (!result.isNewEntry) { | 102 { |
103 NodeListAtomicNameCacheMap::AddResult result = m_atomicNameCaches.ad d(namedNodeListKey(collectionType, name), nullptr); | |
104 if (!result.isNewEntry) { | |
103 #if ENABLE(OILPAN) | 105 #if ENABLE(OILPAN) |
104 return static_cast<T*>(result.storedValue->value.get()); | 106 return static_cast<T*>(result.storedValue->value.get()); |
105 #else | 107 #else |
106 return static_cast<T*>(result.storedValue->value); | 108 return static_cast<T*>(result.storedValue->value); |
107 #endif | 109 #endif |
110 } | |
111 | |
112 fprintf(stderr, "a %ld %ld %p %p\n", result.m_containerModifications , result.m_container->modifications(), result.m_container, &m_atomicNameCaches.m _impl); | |
113 Heap::collectAllGarbage(); | |
114 fprintf(stderr, "b %ld %ld %p %p\n", result.m_containerModifications , result.m_container->modifications(), result.m_container, &m_atomicNameCaches.m _impl); | |
115 fprintf(stderr, "c\n"); | |
116 list = T::create(node, collectionType, name); | |
117 fprintf(stderr, "d\n"); | |
118 result.storedValue->value = list.get(); | |
119 fprintf(stderr, "e\n"); | |
108 } | 120 } |
109 | 121 fprintf(stderr, "f\n"); |
haraken
2014/08/13 07:54:32
This code prints the following crash log. The cras
| |
110 RefPtrWillBeRawPtr<T> list = T::create(node, collectionType, name); | |
111 result.storedValue->value = list.get(); | |
112 return list.release(); | 122 return list.release(); |
113 } | 123 } |
114 | 124 |
115 template<typename T> | 125 template<typename T> |
116 PassRefPtrWillBeRawPtr<T> addCache(ContainerNode& node, CollectionType colle ctionType) | 126 PassRefPtrWillBeRawPtr<T> addCache(ContainerNode& node, CollectionType colle ctionType) |
117 { | 127 { |
118 NodeListAtomicNameCacheMap::AddResult result = m_atomicNameCaches.add(na medNodeListKey(collectionType, starAtom), nullptr); | 128 NodeListAtomicNameCacheMap::AddResult result = m_atomicNameCaches.add(na medNodeListKey(collectionType, starAtom), nullptr); |
119 if (!result.isNewEntry) { | 129 if (!result.isNewEntry) { |
120 #if ENABLE(OILPAN) | 130 #if ENABLE(OILPAN) |
121 return static_cast<T*>(result.storedValue->value.get()); | 131 return static_cast<T*>(result.storedValue->value.get()); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 template <typename Collection> | 268 template <typename Collection> |
259 inline Collection* ContainerNode::cachedCollection(CollectionType type) | 269 inline Collection* ContainerNode::cachedCollection(CollectionType type) |
260 { | 270 { |
261 NodeListsNodeData* nodeLists = this->nodeLists(); | 271 NodeListsNodeData* nodeLists = this->nodeLists(); |
262 return nodeLists ? nodeLists->cached<Collection>(type) : 0; | 272 return nodeLists ? nodeLists->cached<Collection>(type) : 0; |
263 } | 273 } |
264 | 274 |
265 } // namespace blink | 275 } // namespace blink |
266 | 276 |
267 #endif // NodeListsNodeData_h | 277 #endif // NodeListsNodeData_h |
OLD | NEW |