| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 204 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
| 205 void initialize() | 205 void initialize() |
| 206 { | 206 { |
| 207 TraceCallback traceCallback = TraceMethodDelegate<PersistentBase<T, weak
nessConfiguration, crossThreadnessConfiguration>, &PersistentBase<T, weaknessCon
figuration, crossThreadnessConfiguration>::trace>::trampoline; | 207 TraceCallback traceCallback = TraceMethodDelegate<PersistentBase<T, weak
nessConfiguration, crossThreadnessConfiguration>, &PersistentBase<T, weaknessCon
figuration, crossThreadnessConfiguration>::trace>::trampoline; |
| 208 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration)
{ | 208 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration)
{ |
| 209 m_persistentNode = ThreadState::crossThreadPersistentRegion().alloca
tePersistentNode(this, traceCallback); | 209 m_persistentNode = ThreadState::crossThreadPersistentRegion().alloca
tePersistentNode(this, traceCallback); |
| 210 } else { | 210 } else { |
| 211 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::st
ate(); | 211 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::st
ate(); |
| 212 ASSERT(state->checkThread()); | 212 ASSERT(state->checkThread()); |
| 213 m_persistentNode = state->persistentRegion()->allocatePersistentNode
(this, traceCallback); | 213 m_persistentNode = state->persistentRegion()->allocatePersistentNode
(this, traceCallback); |
| 214 state->persistentAllocated(); | |
| 215 #if ENABLE(ASSERT) | 214 #if ENABLE(ASSERT) |
| 216 m_state = state; | 215 m_state = state; |
| 217 #endif | 216 #endif |
| 218 } | 217 } |
| 219 } | 218 } |
| 220 | 219 |
| 221 void uninitialize() | 220 void uninitialize() |
| 222 { | 221 { |
| 223 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration)
{ | 222 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration)
{ |
| 224 ThreadState::crossThreadPersistentRegion().freePersistentNode(m_pers
istentNode); | 223 ThreadState::crossThreadPersistentRegion().freePersistentNode(m_pers
istentNode); |
| 225 } else { | 224 } else { |
| 226 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::st
ate(); | 225 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::st
ate(); |
| 227 ASSERT(state->checkThread()); | 226 ASSERT(state->checkThread()); |
| 228 // Persistent handle must be created and destructed in the same thre
ad. | 227 // Persistent handle must be created and destructed in the same thre
ad. |
| 229 ASSERT(m_state == state); | 228 ASSERT(m_state == state); |
| 230 state->persistentRegion()->freePersistentNode(m_persistentNode); | 229 state->persistentRegion()->freePersistentNode(m_persistentNode); |
| 231 state->persistentFreed(); | |
| 232 } | 230 } |
| 233 } | 231 } |
| 234 | 232 |
| 235 void checkPointer() | 233 void checkPointer() |
| 236 { | 234 { |
| 237 #if ENABLE(ASSERT) | 235 #if ENABLE(ASSERT) |
| 238 if (!m_raw) | 236 if (!m_raw) |
| 239 return; | 237 return; |
| 240 | 238 |
| 241 // Heap::isHeapObjectAlive(m_raw) checks that m_raw is a traceable | 239 // Heap::isHeapObjectAlive(m_raw) checks that m_raw is a traceable |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 // TODO(sof): extend WTF::FunctionWrapper call overloading to also handle (C
rossThread)WeakPersistent. | 1198 // TODO(sof): extend WTF::FunctionWrapper call overloading to also handle (C
rossThread)WeakPersistent. |
| 1201 static T* unwrap(const StorageType& value) { return value.get(); } | 1199 static T* unwrap(const StorageType& value) { return value.get(); } |
| 1202 }; | 1200 }; |
| 1203 | 1201 |
| 1204 template<typename T> | 1202 template<typename T> |
| 1205 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; | 1203 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; |
| 1206 | 1204 |
| 1207 } // namespace WTF | 1205 } // namespace WTF |
| 1208 | 1206 |
| 1209 #endif | 1207 #endif |
| OLD | NEW |