| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 static bool traceInCollection(VisitorDispatcher visitor, Member<CachedMatche
dProperties>& cachedProperties, WTF::ShouldWeakPointersBeMarkedStrongly strongif
y) | 58 static bool traceInCollection(VisitorDispatcher visitor, Member<CachedMatche
dProperties>& cachedProperties, WTF::ShouldWeakPointersBeMarkedStrongly strongif
y) |
| 59 { | 59 { |
| 60 // Only honor the cache's weakness semantics if the collection is traced | 60 // Only honor the cache's weakness semantics if the collection is traced |
| 61 // with WeakPointersActWeak. Otherwise just trace the cachedProperties | 61 // with WeakPointersActWeak. Otherwise just trace the cachedProperties |
| 62 // strongly, ie. call trace on it. | 62 // strongly, ie. call trace on it. |
| 63 if (cachedProperties && strongify == WTF::WeakPointersActWeak) { | 63 if (cachedProperties && strongify == WTF::WeakPointersActWeak) { |
| 64 // A given cache entry is only kept alive if none of the MatchedProp
erties | 64 // A given cache entry is only kept alive if none of the MatchedProp
erties |
| 65 // in the CachedMatchedProperties value contain a dead "properties"
field. | 65 // in the CachedMatchedProperties value contain a dead "properties"
field. |
| 66 // If there is a dead field the entire cache entry is removed. | 66 // If there is a dead field the entire cache entry is removed. |
| 67 for (const auto& matchedProperties : cachedProperties->matchedProper
ties) { | 67 for (const auto& matchedProperties : cachedProperties->matchedProper
ties) { |
| 68 if (!Heap::isHeapObjectAlive(matchedProperties.properties)) { | 68 if (!ThreadHeap::isHeapObjectAlive(matchedProperties.properties)
) { |
| 69 // For now report the cache entry as dead. This might not | 69 // For now report the cache entry as dead. This might not |
| 70 // be the final result if in a subsequent call for this entr
y, | 70 // be the final result if in a subsequent call for this entr
y, |
| 71 // the "properties" field has been marked via another path. | 71 // the "properties" field has been marked via another path. |
| 72 return true; | 72 return true; |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 // At this point none of the entries in the matchedProperties vector | 76 // At this point none of the entries in the matchedProperties vector |
| 77 // had a dead "properties" field so trace CachedMatchedProperties strong
ly. | 77 // had a dead "properties" field so trace CachedMatchedProperties strong
ly. |
| 78 // FIXME: traceInCollection is also called from WeakProcessing to check
if the entry is dead. | 78 // FIXME: traceInCollection is also called from WeakProcessing to check
if the entry is dead. |
| 79 // Avoid calling trace in that case by only calling trace when cachedPro
perties is not yet marked. | 79 // Avoid calling trace in that case by only calling trace when cachedPro
perties is not yet marked. |
| 80 if (!Heap::isHeapObjectAlive(cachedProperties)) | 80 if (!ThreadHeap::isHeapObjectAlive(cachedProperties)) |
| 81 visitor->trace(cachedProperties); | 81 visitor->trace(cachedProperties); |
| 82 return false; | 82 return false; |
| 83 } | 83 } |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 class MatchedPropertiesCache { | 86 class MatchedPropertiesCache { |
| 87 DISALLOW_NEW(); | 87 DISALLOW_NEW(); |
| 88 WTF_MAKE_NONCOPYABLE(MatchedPropertiesCache); | 88 WTF_MAKE_NONCOPYABLE(MatchedPropertiesCache); |
| 89 public: | 89 public: |
| 90 MatchedPropertiesCache(); | 90 MatchedPropertiesCache(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 104 DECLARE_TRACE(); | 104 DECLARE_TRACE(); |
| 105 | 105 |
| 106 private: | 106 private: |
| 107 using Cache = HeapHashMap<unsigned, Member<CachedMatchedProperties>, Default
Hash<unsigned>::Hash, HashTraits<unsigned>, CachedMatchedPropertiesHashTraits>; | 107 using Cache = HeapHashMap<unsigned, Member<CachedMatchedProperties>, Default
Hash<unsigned>::Hash, HashTraits<unsigned>, CachedMatchedPropertiesHashTraits>; |
| 108 Cache m_cache; | 108 Cache m_cache; |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 } // namespace blink | 111 } // namespace blink |
| 112 | 112 |
| 113 #endif | 113 #endif |
| OLD | NEW |