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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 200 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
201 void initialize() | 201 void initialize() |
202 { | 202 { |
203 TraceCallback traceCallback = TraceMethodDelegate<PersistentBase<T, pers
istentConfiguration>, &PersistentBase<T, persistentConfiguration>::trace>::tramp
oline; | 203 TraceCallback traceCallback = TraceMethodDelegate<PersistentBase<T, pers
istentConfiguration>, &PersistentBase<T, persistentConfiguration>::trace>::tramp
oline; |
204 if (persistentConfiguration == CrossThreadPersistentConfiguration) { | 204 if (persistentConfiguration == CrossThreadPersistentConfiguration) { |
205 m_persistentNode = ThreadState::crossThreadPersistentRegion().alloca
tePersistentNode(this, traceCallback); | 205 m_persistentNode = ThreadState::crossThreadPersistentRegion().alloca
tePersistentNode(this, traceCallback); |
206 } else { | 206 } else { |
207 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::st
ate(); | 207 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::st
ate(); |
208 ASSERT(state->checkThread()); | 208 ASSERT(state->checkThread()); |
209 m_persistentNode = state->persistentRegion()->allocatePersistentNode
(this, traceCallback); | 209 m_persistentNode = state->persistentRegion()->allocatePersistentNode
(this, traceCallback); |
210 state->persistentAllocated(); | |
211 #if ENABLE(ASSERT) | 210 #if ENABLE(ASSERT) |
212 m_state = state; | 211 m_state = state; |
213 #endif | 212 #endif |
214 } | 213 } |
215 } | 214 } |
216 | 215 |
217 void uninitialize() | 216 void uninitialize() |
218 { | 217 { |
219 if (persistentConfiguration == CrossThreadPersistentConfiguration) { | 218 if (persistentConfiguration == CrossThreadPersistentConfiguration) { |
220 ThreadState::crossThreadPersistentRegion().freePersistentNode(m_pers
istentNode); | 219 ThreadState::crossThreadPersistentRegion().freePersistentNode(m_pers
istentNode); |
221 } else { | 220 } else { |
222 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::st
ate(); | 221 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::st
ate(); |
223 ASSERT(state->checkThread()); | 222 ASSERT(state->checkThread()); |
224 // Persistent handle must be created and destructed in the same thre
ad. | 223 // Persistent handle must be created and destructed in the same thre
ad. |
225 ASSERT(m_state == state); | 224 ASSERT(m_state == state); |
226 state->persistentRegion()->freePersistentNode(m_persistentNode); | 225 state->persistentRegion()->freePersistentNode(m_persistentNode); |
227 state->persistentFreed(); | |
228 } | 226 } |
229 } | 227 } |
230 | 228 |
231 void checkPointer() | 229 void checkPointer() |
232 { | 230 { |
233 #if ENABLE(ASSERT) | 231 #if ENABLE(ASSERT) |
234 if (!m_raw) | 232 if (!m_raw) |
235 return; | 233 return; |
236 | 234 |
237 // Heap::isHeapObjectAlive(m_raw) checks that m_raw is a traceable | 235 // Heap::isHeapObjectAlive(m_raw) checks that m_raw is a traceable |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 visitor->trace(*static_cast<Collection*>(this)); | 371 visitor->trace(*static_cast<Collection*>(this)); |
374 } | 372 } |
375 | 373 |
376 private: | 374 private: |
377 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 375 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
378 void initialize() | 376 void initialize() |
379 { | 377 { |
380 ThreadState* state = ThreadState::current(); | 378 ThreadState* state = ThreadState::current(); |
381 ASSERT(state->checkThread()); | 379 ASSERT(state->checkThread()); |
382 m_persistentNode = state->persistentRegion()->allocatePersistentNode(thi
s, TraceMethodDelegate<PersistentHeapCollectionBase<Collection>, &PersistentHeap
CollectionBase<Collection>::trace>::trampoline); | 380 m_persistentNode = state->persistentRegion()->allocatePersistentNode(thi
s, TraceMethodDelegate<PersistentHeapCollectionBase<Collection>, &PersistentHeap
CollectionBase<Collection>::trace>::trampoline); |
383 state->persistentAllocated(); | |
384 #if ENABLE(ASSERT) | 381 #if ENABLE(ASSERT) |
385 m_state = state; | 382 m_state = state; |
386 #endif | 383 #endif |
387 } | 384 } |
388 | 385 |
389 void uninitialize() | 386 void uninitialize() |
390 { | 387 { |
391 ThreadState* state = ThreadState::current(); | 388 ThreadState* state = ThreadState::current(); |
392 ASSERT(state->checkThread()); | 389 ASSERT(state->checkThread()); |
393 // Persistent handle must be created and destructed in the same thread. | 390 // Persistent handle must be created and destructed in the same thread. |
394 ASSERT(m_state == state); | 391 ASSERT(m_state == state); |
395 state->persistentRegion()->freePersistentNode(m_persistentNode); | 392 state->persistentRegion()->freePersistentNode(m_persistentNode); |
396 state->persistentFreed(); | |
397 } | 393 } |
398 | 394 |
399 PersistentNode* m_persistentNode; | 395 PersistentNode* m_persistentNode; |
400 #if ENABLE(ASSERT) | 396 #if ENABLE(ASSERT) |
401 ThreadState* m_state; | 397 ThreadState* m_state; |
402 #endif | 398 #endif |
403 }; | 399 }; |
404 | 400 |
405 template< | 401 template< |
406 typename KeyArg, | 402 typename KeyArg, |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { | 1152 struct ParamStorageTraits<RawPtr<T>> : public PointerParamStorageTraits<T*, blin
k::IsGarbageCollectedType<T>::value> { |
1157 static_assert(sizeof(T), "T must be fully defined"); | 1153 static_assert(sizeof(T), "T must be fully defined"); |
1158 }; | 1154 }; |
1159 | 1155 |
1160 template<typename T> | 1156 template<typename T> |
1161 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; | 1157 PassRefPtr<T> adoptRef(blink::RefCountedGarbageCollected<T>*) = delete; |
1162 | 1158 |
1163 } // namespace WTF | 1159 } // namespace WTF |
1164 | 1160 |
1165 #endif | 1161 #endif |
OLD | NEW |