| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef Persistent_h | 5 #ifndef Persistent_h |
| 6 #define Persistent_h | 6 #define Persistent_h |
| 7 | 7 |
| 8 #include "platform/heap/Heap.h" | 8 #include "platform/heap/Heap.h" |
| 9 #include "platform/heap/Member.h" | 9 #include "platform/heap/Member.h" |
| 10 #include "platform/heap/PersistentNode.h" | 10 #include "platform/heap/PersistentNode.h" |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 CrossThreadPersistent(const CrossThreadPersistent& other) : Parent(other) {} | 447 CrossThreadPersistent(const CrossThreadPersistent& other) : Parent(other) {} |
| 448 template <typename U> | 448 template <typename U> |
| 449 CrossThreadPersistent(const CrossThreadPersistent<U>& other) | 449 CrossThreadPersistent(const CrossThreadPersistent<U>& other) |
| 450 : Parent(other) {} | 450 : Parent(other) {} |
| 451 template <typename U> | 451 template <typename U> |
| 452 CrossThreadPersistent(const Member<U>& other) : Parent(other) {} | 452 CrossThreadPersistent(const Member<U>& other) : Parent(other) {} |
| 453 CrossThreadPersistent(WTF::HashTableDeletedValueType x) : Parent(x) {} | 453 CrossThreadPersistent(WTF::HashTableDeletedValueType x) : Parent(x) {} |
| 454 | 454 |
| 455 T* atomicGet() { return Parent::atomicGet(); } | 455 T* atomicGet() { return Parent::atomicGet(); } |
| 456 | 456 |
| 457 // Instead of using release(), assign then clear() instead. |
| 458 // Using release() with per thread heap enabled can cause the object to be |
| 459 // destroyed before assigning it to a new handle. |
| 460 T* release() = delete; |
| 461 |
| 457 template <typename U> | 462 template <typename U> |
| 458 CrossThreadPersistent& operator=(U* other) { | 463 CrossThreadPersistent& operator=(U* other) { |
| 459 Parent::operator=(other); | 464 Parent::operator=(other); |
| 460 return *this; | 465 return *this; |
| 461 } | 466 } |
| 462 | 467 |
| 463 CrossThreadPersistent& operator=(std::nullptr_t) { | 468 CrossThreadPersistent& operator=(std::nullptr_t) { |
| 464 Parent::operator=(nullptr); | 469 Parent::operator=(nullptr); |
| 465 return *this; | 470 return *this; |
| 466 } | 471 } |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 static blink::CrossThreadPersistent<T> Unwrap( | 808 static blink::CrossThreadPersistent<T> Unwrap( |
| 804 const blink::CrossThreadWeakPersistent<T>& wrapped) { | 809 const blink::CrossThreadWeakPersistent<T>& wrapped) { |
| 805 blink::CrossThreadPersistentRegion::LockScope persistentLock( | 810 blink::CrossThreadPersistentRegion::LockScope persistentLock( |
| 806 blink::ProcessHeap::crossThreadPersistentRegion()); | 811 blink::ProcessHeap::crossThreadPersistentRegion()); |
| 807 return blink::CrossThreadPersistent<T>(wrapped.get()); | 812 return blink::CrossThreadPersistent<T>(wrapped.get()); |
| 808 } | 813 } |
| 809 }; | 814 }; |
| 810 } | 815 } |
| 811 | 816 |
| 812 #endif // Persistent_h | 817 #endif // Persistent_h |
| OLD | NEW |