5#ifndef FLUTTER_FML_PLATFORM_DARWIN_WEAK_NSOBJECT_H_
6#define FLUTTER_FML_PLATFORM_DARWIN_WEAK_NSOBJECT_H_
8#import <Foundation/Foundation.h>
9#import <objc/runtime.h>
14#include "flutter/fml/compiler_specific.h"
15#include "flutter/fml/logging.h"
16#include "flutter/fml/memory/ref_counted.h"
17#include "flutter/fml/memory/ref_ptr.h"
18#include "flutter/fml/memory/thread_checker.h"
71template <
typename NST>
72class WeakNSObjectFactory;
91 __unsafe_unretained
id object_;
96#pragma clang diagnostic push
97#pragma clang diagnostic ignored "-Wunused-private-field"
99#pragma clang diagnostic pop
110+ (
fml::RefPtr<fml::WeakContainer>)containerForObject:(
id)object
111 threadChecker:(
debug::DebugThreadChecker)checker;
117template <
typename NST>
151 return get() == that;
156 return get() != that;
161 operator NST()
const {
184 return p1 == p2.
get();
189 return p1 != p2.
get();
192template <
typename NST>
254template <
typename NST>
WeakContainer(id object, const debug::DebugThreadChecker &checker)
WeakNSObjectFactory(NST *object)
WeakNSObject< NST > GetWeakNSObject() const
WeakNSObject(const WeakNSObject< id > &that)
WeakNSObject & operator=(const WeakNSObject< id > &that)
WeakNSObject & operator=(const WeakNSObject< NST > &that)
WeakNSObject(const WeakNSObject< NST > &that)
bool operator==(NST that) const
~WeakNSProtocol()=default
void CheckThreadSafety() const
RefPtr< fml::WeakContainer > container_
WeakNSProtocol(const WeakNSProtocol< NST > &that)
WeakNSProtocol(RefPtr< fml::WeakContainer > container, const debug::DebugThreadChecker &checker)
debug::DebugThreadChecker checker_
bool operator!=(NST that) const
WeakNSProtocol & operator=(const WeakNSProtocol< NST > &that)
#define FML_DCHECK(condition)
fml::RefPtr< fml::WeakContainer > containerForObject:threadChecker:(id object,[threadChecker] debug::DebugThreadChecker checker)
bool operator==(C p1, const scoped_nsprotocol< C > &p2)
bool operator!=(C p1, const scoped_nsprotocol< C > &p2)
FML_DECLARE_THREAD_CHECKER(checker)
#define FML_DCHECK_CREATION_THREAD_IS_CURRENT(c)