OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 template<typename T> class HeapTerminatedArray; | 49 template<typename T> class HeapTerminatedArray; |
50 | 50 |
51 class PersistentNode { | 51 class PersistentNode { |
52 public: | 52 public: |
53 explicit PersistentNode(TraceCallback trace) | 53 explicit PersistentNode(TraceCallback trace) |
54 : m_trace(trace) | 54 : m_trace(trace) |
55 { | 55 { |
56 } | 56 } |
57 | 57 |
58 NO_LAZY_SWEEP_SANITIZE_ADDRESS | |
59 bool isHeapObjectAlive() { return m_trace; } | 58 bool isHeapObjectAlive() { return m_trace; } |
60 | 59 |
61 virtual ~PersistentNode() | 60 virtual ~PersistentNode() |
62 { | 61 { |
63 ASSERT(isHeapObjectAlive()); | 62 ASSERT(isHeapObjectAlive()); |
64 m_trace = nullptr; | 63 m_trace = nullptr; |
65 } | 64 } |
66 | 65 |
67 // Ideally the trace method should be virtual and automatically dispatch | 66 // Ideally the trace method should be virtual and automatically dispatch |
68 // to the most specific implementation. However having a virtual method | 67 // to the most specific implementation. However having a virtual method |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 MutexLocker m_locker; | 119 MutexLocker m_locker; |
121 }; | 120 }; |
122 }; | 121 }; |
123 | 122 |
124 // Base class for persistent handles. RootsAccessor specifies which list to | 123 // Base class for persistent handles. RootsAccessor specifies which list to |
125 // link resulting handle into. Owner specifies the class containing trace | 124 // link resulting handle into. Owner specifies the class containing trace |
126 // method. | 125 // method. |
127 template<typename RootsAccessor, typename Owner> | 126 template<typename RootsAccessor, typename Owner> |
128 class PersistentBase : public PersistentNode { | 127 class PersistentBase : public PersistentNode { |
129 public: | 128 public: |
130 NO_LAZY_SWEEP_SANITIZE_ADDRESS | |
131 ~PersistentBase() | 129 ~PersistentBase() |
132 { | 130 { |
133 typename RootsAccessor::Lock lock; | 131 typename RootsAccessor::Lock lock; |
134 ASSERT(m_roots == RootsAccessor::roots()); // Check that the thread is u
sing the same roots list. | 132 ASSERT(m_roots == RootsAccessor::roots()); // Check that the thread is u
sing the same roots list. |
135 ASSERT(isHeapObjectAlive()); | 133 ASSERT(isHeapObjectAlive()); |
136 ASSERT(m_next->isHeapObjectAlive()); | 134 ASSERT(m_next->isHeapObjectAlive()); |
137 ASSERT(m_prev->isHeapObjectAlive()); | 135 ASSERT(m_prev->isHeapObjectAlive()); |
138 m_next->m_prev = m_prev; | 136 m_next->m_prev = m_prev; |
139 m_prev->m_next = m_next; | 137 m_prev->m_next = m_next; |
140 } | 138 } |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { | 1067 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { |
1070 static_assert(sizeof(T), "T must be fully defined"); | 1068 static_assert(sizeof(T), "T must be fully defined"); |
1071 }; | 1069 }; |
1072 | 1070 |
1073 template<typename T> | 1071 template<typename T> |
1074 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; | 1072 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; |
1075 | 1073 |
1076 } // namespace WTF | 1074 } // namespace WTF |
1077 | 1075 |
1078 #endif | 1076 #endif |
OLD | NEW |