| 6 |
| 7 | #include "base/logging.h" |
| 8 | #include "base/memory/ptr_util.h" |
| 9 |
| 10 | namespace base { |
| 11 |
| 12 | //////////////////////////////////////////////////////////////////////////////// |
| 13 | // HeapHandle |
| 14 |
| 15 | // static |
| 16 | HeapHandle HeapHandle::Invalid() { |
| 17 | return HeapHandle(); |
| 18 | } |
| 19 |
| 20 | //////////////////////////////////////////////////////////////////////////////// |
| 21 | // InternalHeapHandleStorage |
| 22 |
| 23 | InternalHeapHandleStorage::InternalHeapHandleStorage() |
| 24 | : handle_(new HeapHandle()) {} |
| 25 |
| 26 | InternalHeapHandleStorage::InternalHeapHandleStorage( |
| 27 | InternalHeapHandleStorage&& other) noexcept |
| 28 | : handle_(std::move(other.handle_)) { |
| 29 | DCHECK(intrusive_heap::IsInvalid(other.handle_)); |
| 30 | } |
| 31 |
| 32 | InternalHeapHandleStorage::~InternalHeapHandleStorage() = default; |
| 33 |
| 34 | InternalHeapHandleStorage& InternalHeapHandleStorage::operator=( |
| 35 | InternalHeapHandleStorage&& other) noexcept { |
| 36 | handle_ = std::move(other.handle_); |
| 37 | DCHECK(intrusive_heap::IsInvalid(other.handle_)); |
| 38 | return *this; |
| 39 | } |
| 40 |
| 41 | void InternalHeapHandleStorage::swap( |
| 42 | InternalHeapHandleStorage& other) noexcept { |
| 43 | std::swap(handle_, other.handle_); |
| 44 | } |
| 45 |
| 46 | } // namespace base |
| 47 |