| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 m_prev->m_next = m_next; | 172 m_prev->m_next = m_next; |
| 173 } | 173 } |
| 174 | 174 |
| 175 protected: | 175 protected: |
| 176 inline PersistentBase() | 176 inline PersistentBase() |
| 177 : PersistentNode(TraceMethodDelegate<Owner, &Owner::trace>::trampoline) | 177 : PersistentNode(TraceMethodDelegate<Owner, &Owner::trace>::trampoline) |
| 178 #if ENABLE(ASSERT) | 178 #if ENABLE(ASSERT) |
| 179 , m_roots(RootsAccessor::roots()) | 179 , m_roots(RootsAccessor::roots()) |
| 180 #endif | 180 #endif |
| 181 { | 181 { |
| 182 // Persistent must belong to a thread that will GC it. |
| 183 ASSERT(m_roots == GlobalPersistents::roots() || ThreadState::current()); |
| 182 typename RootsAccessor::Lock lock; | 184 typename RootsAccessor::Lock lock; |
| 183 m_prev = RootsAccessor::roots(); | 185 m_prev = RootsAccessor::roots(); |
| 184 m_next = m_prev->m_next; | 186 m_next = m_prev->m_next; |
| 185 m_prev->m_next = this; | 187 m_prev->m_next = this; |
| 186 m_next->m_prev = this; | 188 m_next->m_prev = this; |
| 187 } | 189 } |
| 188 | 190 |
| 189 inline explicit PersistentBase(const PersistentBase& otherref) | 191 inline explicit PersistentBase(const PersistentBase& otherref) |
| 190 : PersistentNode(otherref.m_trace) | 192 : PersistentNode(otherref.m_trace) |
| 191 #if ENABLE(ASSERT) | 193 #if ENABLE(ASSERT) |
| 192 , m_roots(RootsAccessor::roots()) | 194 , m_roots(RootsAccessor::roots()) |
| 193 #endif | 195 #endif |
| 194 { | 196 { |
| 197 ASSERT(m_roots == GlobalPersistents::roots() || ThreadState::current()); |
| 195 // We don't support allocation of thread local Persistents while doing | 198 // We don't support allocation of thread local Persistents while doing |
| 196 // thread shutdown/cleanup. | 199 // thread shutdown/cleanup. |
| 197 ASSERT(!ThreadState::current()->isTerminating()); | 200 ASSERT(!ThreadState::current()->isTerminating()); |
| 198 typename RootsAccessor::Lock lock; | 201 typename RootsAccessor::Lock lock; |
| 199 ASSERT(otherref.m_roots == m_roots); // Handles must belong to the same
list. | 202 ASSERT(otherref.m_roots == m_roots); // Handles must belong to the same
list. |
| 200 PersistentBase* other = const_cast<PersistentBase*>(&otherref); | 203 PersistentBase* other = const_cast<PersistentBase*>(&otherref); |
| 201 m_prev = other; | 204 m_prev = other; |
| 202 m_next = other->m_next; | 205 m_next = other->m_next; |
| 203 other->m_next = this; | 206 other->m_next = this; |
| 204 m_next->m_prev = this; | 207 m_next->m_prev = this; |
| (...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 template<typename T> | 1115 template<typename T> |
| 1113 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { | 1116 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { |
| 1114 }; | 1117 }; |
| 1115 | 1118 |
| 1116 template<typename T> | 1119 template<typename T> |
| 1117 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; | 1120 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; |
| 1118 | 1121 |
| 1119 } // namespace WTF | 1122 } // namespace WTF |
| 1120 | 1123 |
| 1121 #endif | 1124 #endif |
| OLD | NEW |