Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Instance Methods | Class Methods | Properties | List of all members
CRBWeakNSProtocolSentinel Class Reference

#include <weak_nsobject.h>

Inheritance diagram for CRBWeakNSProtocolSentinel:

Instance Methods

(id- initWithContainer: [implementation]
 
(void) - dealloc [implementation]
 

Class Methods

(fml::RefPtr< fml::WeakContainer >) + containerForObject:threadChecker:
 

Properties

fml::RefPtr< fml::WeakContainercontainer [implementation]
 

Detailed Description

Definition at line 107 of file weak_nsobject.h.

Method Documentation

◆ containerForObject:threadChecker:

+ (RefPtr<) fml: (id object
threadChecker: (debug::DebugThreadChecker checker 

Definition at line 25 of file weak_nsobject.mm.

32 :(id)object
33 threadChecker:(debug::DebugThreadChecker)checker {
34 if (object == nil) {
35 return nullptr;
36 }
37 // The autoreleasePool is needed here as the call to objc_getAssociatedObject
38 // returns an autoreleased object which is better released sooner than later.
40 CRBWeakNSProtocolSentinel* sentinel = objc_getAssociatedObject(object, &sentinelObserverKey_);
41 if (!sentinel) {
43 initWithContainer:AdoptRef(new fml::WeakContainer(object, checker))]);
44 sentinel = newSentinel;
45 objc_setAssociatedObject(object, &sentinelObserverKey_, sentinel, OBJC_ASSOCIATION_RETAIN);
46 // The retain count is 2. One retain is due to the alloc, the other to the
47 // association with the weak object.
48 FML_DCHECK(2u == [sentinel retainCount]);
49 }
50 return [sentinel container];
51}
AutoreleasePool pool
if(end==-1)
#define FML_DCHECK(condition)
Definition logging.h:103
fml::RefPtr< fml::WeakContainer > container
RefPtr< T > AdoptRef(T *ptr)
Definition ref_ptr.h:222
const uintptr_t id

◆ dealloc

- (void) dealloc
implementation

Definition at line 25 of file weak_nsobject.mm.

62 {
63 _container->nullify();
64 [super dealloc];
65}

◆ initWithContainer:

- (id) initWithContainer: (fml::RefPtr<fml::WeakContainer>)  container
implementation

Definition at line 25 of file weak_nsobject.mm.

54 FML_DCHECK(container.get());
55 self = [super init];
56 if (self) {
57 _container = container;
58 }
59 return self;
60}
T * get() const
Definition ref_ptr.h:116

Property Documentation

◆ container

- (RefPtr<)fml:
readatomicassignimplementation

Provided by category CRBWeakNSProtocolSentinel().

Definition at line 25 of file weak_nsobject.mm.


The documentation for this class was generated from the following files: