| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 233 |
| 234 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 234 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
| 235 void initialize() | 235 void initialize() |
| 236 { | 236 { |
| 237 ASSERT(!m_persistentNode); | 237 ASSERT(!m_persistentNode); |
| 238 if (!m_raw) | 238 if (!m_raw) |
| 239 return; | 239 return; |
| 240 | 240 |
| 241 TraceCallback traceCallback = TraceMethodDelegate<PersistentBase<T, weak
nessConfiguration, crossThreadnessConfiguration>, &PersistentBase<T, weaknessCon
figuration, crossThreadnessConfiguration>::trace>::trampoline; | 241 TraceCallback traceCallback = TraceMethodDelegate<PersistentBase<T, weak
nessConfiguration, crossThreadnessConfiguration>, &PersistentBase<T, weaknessCon
figuration, crossThreadnessConfiguration>::trace>::trampoline; |
| 242 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration)
{ | 242 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration)
{ |
| 243 m_persistentNode = Heap::crossThreadPersistentRegion().allocatePersi
stentNode(this, traceCallback); | 243 m_persistentNode = ProcessHeap::crossThreadPersistentRegion().alloca
tePersistentNode(this, traceCallback); |
| 244 } else { | 244 } else { |
| 245 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::st
ate(); | 245 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::st
ate(); |
| 246 ASSERT(state->checkThread()); | 246 ASSERT(state->checkThread()); |
| 247 m_persistentNode = state->getPersistentRegion()->allocatePersistentN
ode(this, traceCallback); | 247 m_persistentNode = state->getPersistentRegion()->allocatePersistentN
ode(this, traceCallback); |
| 248 #if ENABLE(ASSERT) | 248 #if ENABLE(ASSERT) |
| 249 m_state = state; | 249 m_state = state; |
| 250 #endif | 250 #endif |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 | 253 |
| 254 void uninitialize() | 254 void uninitialize() |
| 255 { | 255 { |
| 256 if (!m_persistentNode) | 256 if (!m_persistentNode) |
| 257 return; | 257 return; |
| 258 | 258 |
| 259 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration)
{ | 259 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration)
{ |
| 260 Heap::crossThreadPersistentRegion().freePersistentNode(m_persistentN
ode); | 260 ProcessHeap::crossThreadPersistentRegion().freePersistentNode(m_pers
istentNode); |
| 261 } else { | 261 } else { |
| 262 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::st
ate(); | 262 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::st
ate(); |
| 263 ASSERT(state->checkThread()); | 263 ASSERT(state->checkThread()); |
| 264 // Persistent handle must be created and destructed in the same thre
ad. | 264 // Persistent handle must be created and destructed in the same thre
ad. |
| 265 ASSERT(m_state == state); | 265 ASSERT(m_state == state); |
| 266 state->getPersistentRegion()->freePersistentNode(m_persistentNode); | 266 state->getPersistentRegion()->freePersistentNode(m_persistentNode); |
| 267 } | 267 } |
| 268 m_persistentNode = nullptr; | 268 m_persistentNode = nullptr; |
| 269 } | 269 } |
| 270 | 270 |
| (...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 // into it. | 1491 // into it. |
| 1492 // | 1492 // |
| 1493 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty
pe like | 1493 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty
pe like |
| 1494 // CrossThreadWeakPersistent<>. | 1494 // CrossThreadWeakPersistent<>. |
| 1495 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR
eference<T>::create(value.get())); } | 1495 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR
eference<T>::create(value.get())); } |
| 1496 }; | 1496 }; |
| 1497 | 1497 |
| 1498 } // namespace WTF | 1498 } // namespace WTF |
| 1499 | 1499 |
| 1500 #endif | 1500 #endif |
| OLD | NEW |