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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) | 208 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) |
209 releaseStore(reinterpret_cast<void* volatile*>(&m_raw), ptr); | 209 releaseStore(reinterpret_cast<void* volatile*>(&m_raw), ptr); |
210 else | 210 else |
211 m_raw = ptr; | 211 m_raw = ptr; |
212 checkPointer(); | 212 checkPointer(); |
213 if (m_raw) { | 213 if (m_raw) { |
214 if (!m_persistentNode) | 214 if (!m_persistentNode) |
215 initialize(); | 215 initialize(); |
216 return; | 216 return; |
217 } | 217 } |
218 if (m_persistentNode && crossThreadnessConfiguration != CrossThreadPersi
stentConfiguration) | 218 uninitialize(); |
219 uninitialize(); | |
220 } | 219 } |
221 | 220 |
222 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 221 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
223 void initialize() | 222 void initialize() |
224 { | 223 { |
225 ASSERT(!m_persistentNode); | 224 ASSERT(!m_persistentNode); |
226 if (!m_raw) | 225 if (!m_raw) |
227 return; | 226 return; |
228 | 227 |
229 TraceCallback traceCallback = TraceMethodDelegate<PersistentBase<T, weak
nessConfiguration, crossThreadnessConfiguration>, &PersistentBase<T, weaknessCon
figuration, crossThreadnessConfiguration>::trace>::trampoline; | 228 TraceCallback traceCallback = TraceMethodDelegate<PersistentBase<T, weak
nessConfiguration, crossThreadnessConfiguration>, &PersistentBase<T, weaknessCon
figuration, crossThreadnessConfiguration>::trace>::trampoline; |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 // into it. | 1213 // into it. |
1215 // | 1214 // |
1216 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty
pe like | 1215 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty
pe like |
1217 // CrossThreadWeakPersistent<>. | 1216 // CrossThreadWeakPersistent<>. |
1218 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR
eference<T>::create(value.get())); } | 1217 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR
eference<T>::create(value.get())); } |
1219 }; | 1218 }; |
1220 | 1219 |
1221 } // namespace WTF | 1220 } // namespace WTF |
1222 | 1221 |
1223 #endif | 1222 #endif |
OLD | NEW |