Changeset 77159 in webkit
- Timestamp:
- Jan 31, 2011 2:24:27 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r77151 r77159 1 2011-01-31 Michael Saboff <msaboff@apple.com> 2 3 Reviewed by Geoffrey Garen. 4 5 Potentially Unsafe HashSet of RuntimeObject* in RootObject definition 6 https://bugs.webkit.org/show_bug.cgi?id=53271 7 8 Reapplying this change again. 9 Changed isValid() to use .get() as a result of change r77151. 10 11 Added new isValid() methods to check if a contained object in 12 a WeakGCMap is valid when using an unchecked iterator. 13 14 * runtime/WeakGCMap.h: 15 (JSC::WeakGCMap::isValid): 16 1 17 2011-01-31 Oliver Hunt <oliver@apple.com> 2 18 -
trunk/Source/JavaScriptCore/runtime/WeakGCMap.h
r77151 r77159 77 77 const_iterator uncheckedEnd() const { return m_map.end(); } 78 78 79 bool isValid(iterator it) const { return Heap::isCellMarked(it->second.get()); } 80 bool isValid(const_iterator it) const { return Heap::isCellMarked(it->second.get()); } 81 79 82 private: 80 83 HashMap<KeyType, DeprecatedPtr<MappedType> > m_map; -
trunk/Source/WebCore/ChangeLog
r77156 r77159 1 2011-01-31 Michael Saboff <msaboff@apple.com> 2 3 Reviewed by Geoffrey Garen. 4 5 Potentially Unsafe HashSet of RuntimeObject* in RootObject definition 6 https://bugs.webkit.org/show_bug.cgi?id=53271 7 8 Reapplying this patch again. 9 The removal of this patch in <http://trac.webkit.org/changeset/77125> 10 as part of https://bugs.webkit.org/show_bug.cgi?id=53418, 11 removed the both the first (failing) patch (r76893) and this fixed 12 patch (r76969). This patch includes slight changes necessitated by 13 r77151. 14 15 Reapplying this patch with the change that the second ASSERT in 16 RootObject::removeRuntimeObject was changed to use 17 .uncheckedGet() instead of the failing .get(). The object in question 18 could be in the process of being GC'ed. The get() call will not return 19 such an object while the uncheckedGet() call will return the (unsafe) 20 object. This is the behavior we want. 21 22 Precautionary change. 23 Changed RootObject to use WeakGCMap instead of HashSet. 24 Found will looking for another issue, but can't produce a test case 25 that is problematic. THerefore there aren't any new tests. 26 27 * bridge/runtime_root.cpp: 28 (JSC::Bindings::RootObject::invalidate): 29 (JSC::Bindings::RootObject::addRuntimeObject): 30 (JSC::Bindings::RootObject::removeRuntimeObject): 31 * bridge/runtime_root.h: 32 1 33 2011-01-31 Andreas Kling <kling@webkit.org> 2 34 -
trunk/Source/WebCore/bridge/runtime_root.cpp
r77125 r77159 102 102 103 103 { 104 HashSet<RuntimeObject*>::iterator end = m_runtimeObjects.end(); 105 for (HashSet<RuntimeObject*>::iterator it = m_runtimeObjects.begin(); it != end; ++it) 106 (*it)->invalidate(); 107 104 WeakGCMap<RuntimeObject*, RuntimeObject>::iterator end = m_runtimeObjects.uncheckedEnd(); 105 for (WeakGCMap<RuntimeObject*, RuntimeObject>::iterator it = m_runtimeObjects.uncheckedBegin(); it != end; ++it) { 106 if (m_runtimeObjects.isValid(it)) 107 it->second->invalidate(); 108 } 109 108 110 m_runtimeObjects.clear(); 109 111 } 110 112 111 113 m_isValid = false; 112 114 … … 177 179 { 178 180 ASSERT(m_isValid); 179 ASSERT(!m_runtimeObjects. contains(object));180 181 m_runtimeObjects. add(object);182 } 183 181 ASSERT(!m_runtimeObjects.get(object)); 182 183 m_runtimeObjects.set(object, object); 184 } 185 184 186 void RootObject::removeRuntimeObject(RuntimeObject* object) 185 187 { 186 188 ASSERT(m_isValid); 187 ASSERT(m_runtimeObjects. contains(object));188 189 m_runtimeObjects. remove(object);189 ASSERT(m_runtimeObjects.uncheckedGet(object)); 190 191 m_runtimeObjects.take(object); 190 192 } 191 193 -
trunk/Source/WebCore/bridge/runtime_root.h
r77125 r77159 32 32 #include <runtime/Protect.h> 33 33 34 #include <runtime/WeakGCMap.h> 34 35 #include <wtf/Forward.h> 35 #include <wtf/HashSet.h>36 36 #include <wtf/Noncopyable.h> 37 37 #include <wtf/PassRefPtr.h> … … 90 90 91 91 ProtectCountSet m_protectCountSet; 92 HashSet<RuntimeObject*> m_runtimeObjects;92 WeakGCMap<RuntimeObject*, RuntimeObject> m_runtimeObjects; // Really need a WeakGCSet, but this will do. 93 93 94 94 HashSet<InvalidationCallback*> m_invalidationCallbacks;
Note: See TracChangeset
for help on using the changeset viewer.