5 #ifndef FLUTTER_IMPELLER_TOOLKIT_INTEROP_OBJECT_H_
6 #define FLUTTER_IMPELLER_TOOLKIT_INTEROP_OBJECT_H_
11 #include "flutter/fml/logging.h"
32 if (ref_count_-- == 1u) {
52 std::atomic_uint64_t ref_count_ = {1u};
55 template <
typename Clasz,
typename CSibling>
66 template <
typename Object>
90 if (object_ == other.object_) {
97 FML_DCHECK(object_ ==
nullptr);
98 object_ = other.object_;
103 std::swap(object_, other.object_);
123 explicit operator bool()
const {
return !!object_; }
127 auto to_leak = object_;
133 Object* object_ =
nullptr;
145 template <
typename Object>
150 template <
typename Object>
155 template <
typename Object>
160 template <
typename Object,
typename... CtorArgs>
ObjectBase(const ObjectBase &)=delete
static void SafeRelease(void *ptr)
ObjectBase & operator=(ObjectBase &&)=delete
virtual ~ObjectBase()=default
ObjectBase & operator=(const ObjectBase &)=delete
uint64_t GetRefCountForTests() const
ObjectBase(ObjectBase &&)=delete
static void SafeRetain(void *ptr)
ScopedObject & operator=(ScopedObject &&other)
Object & operator*() const
Object::InteropCSibling * GetC() const
ScopedObject(Object *ptr, AdoptTag)
ScopedObject(std::nullptr_t)
ScopedObject & operator=(const ScopedObject &other)
ScopedObject(Object *ptr)
ScopedObject(const ScopedObject &other)
ScopedObject(ScopedObject &&other)
Object::InteropCSibling * Leak()
Object * operator->() const
ScopedObject< Object > Ref(Object *object)
ScopedObject< Object > Adopt(Object *object)
ScopedObject< Object > Create(CtorArgs &&... args)