diff options
Diffstat (limited to 'native/jni/src/utils/exclusive_ownership_pointer.h')
-rw-r--r-- | native/jni/src/utils/exclusive_ownership_pointer.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/native/jni/src/utils/exclusive_ownership_pointer.h b/native/jni/src/utils/exclusive_ownership_pointer.h index 6c67df28e..617b34968 100644 --- a/native/jni/src/utils/exclusive_ownership_pointer.h +++ b/native/jni/src/utils/exclusive_ownership_pointer.h @@ -25,22 +25,23 @@ template<class T> class ExclusiveOwnershipPointer { public: // This instance become an owner of the raw pointer. - ExclusiveOwnershipPointer(T *const rawPointer) + AK_FORCE_INLINE ExclusiveOwnershipPointer(T *const rawPointer) : mPointer(rawPointer), mSharedOwnerPtr(new (ExclusiveOwnershipPointer<T> *)(this)) {} // Move the ownership. - ExclusiveOwnershipPointer(const ExclusiveOwnershipPointer<T> &pointer) + AK_FORCE_INLINE ExclusiveOwnershipPointer(const ExclusiveOwnershipPointer<T> &pointer) : mPointer(pointer.mPointer), mSharedOwnerPtr(pointer.mSharedOwnerPtr) { transferOwnership(&pointer); } - ~ExclusiveOwnershipPointer() { + AK_FORCE_INLINE ~ExclusiveOwnershipPointer() { deletePointersIfHavingOwnership(); } // Move the ownership. - ExclusiveOwnershipPointer<T> &operator=(const ExclusiveOwnershipPointer<T> &pointer) { + AK_FORCE_INLINE ExclusiveOwnershipPointer<T> &operator=( + const ExclusiveOwnershipPointer<T> &pointer) { // Delete pointers when this is an owner of another pointer. deletePointersIfHavingOwnership(); mPointer = pointer.mPointer; @@ -49,7 +50,7 @@ class ExclusiveOwnershipPointer { return *this; } - T *get() const { + AK_FORCE_INLINE T *get() const { return mPointer; } |