5
5
#import " flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngineGroup.h"
6
6
#import " flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h"
7
7
8
- @implementation FlutterEngineGroupOptions
9
-
10
- - (void )dealloc {
11
- [_entrypoint release ];
12
- [_libraryURI release ];
13
- [_initialRoute release ];
14
- [_entrypointArgs release ];
15
- [super dealloc ];
16
- }
8
+ FLUTTER_ASSERT_ARC
17
9
10
+ @implementation FlutterEngineGroupOptions
18
11
@end
19
12
20
13
@interface FlutterEngineGroup ()
21
14
@property (nonatomic , copy ) NSString * name;
22
- @property (nonatomic , retain ) NSMutableArray <NSValue*>* engines;
23
- @property (nonatomic , retain ) FlutterDartProject* project;
15
+ @property (nonatomic , strong ) NSMutableArray <NSValue*>* engines;
16
+ @property (nonatomic , copy ) FlutterDartProject* project;
17
+ @property (nonatomic , assign ) NSUInteger enginesCreatedCount;
24
18
@end
25
19
26
- @implementation FlutterEngineGroup {
27
- int _enginesCreatedCount;
28
- }
20
+ @implementation FlutterEngineGroup
29
21
30
22
- (instancetype )initWithName : (NSString *)name project : (nullable FlutterDartProject*)project {
31
23
self = [super init ];
32
24
if (self) {
33
25
_name = [name copy ];
34
26
_engines = [[NSMutableArray <NSValue *> alloc] init ];
35
- _project = [ project retain ] ;
27
+ _project = project;
36
28
}
37
29
return self;
38
30
}
39
31
40
- - (void )dealloc {
41
- [_name release ];
42
- [_engines release ];
43
- [_project release ];
44
- [super dealloc ];
45
- }
46
-
47
32
- (FlutterEngine*)makeEngineWithEntrypoint : (nullable NSString *)entrypoint
48
33
libraryURI : (nullable NSString *)libraryURI {
49
34
return [self makeEngineWithEntrypoint: entrypoint libraryURI: libraryURI initialRoute: nil ];
@@ -52,7 +37,7 @@ - (FlutterEngine*)makeEngineWithEntrypoint:(nullable NSString*)entrypoint
52
37
- (FlutterEngine*)makeEngineWithEntrypoint : (nullable NSString *)entrypoint
53
38
libraryURI : (nullable NSString *)libraryURI
54
39
initialRoute : (nullable NSString *)initialRoute {
55
- FlutterEngineGroupOptions* options = [[[ FlutterEngineGroupOptions alloc ] init ] autorelease ];
40
+ FlutterEngineGroupOptions* options = [[FlutterEngineGroupOptions alloc ] init ];
56
41
options.entrypoint = entrypoint;
57
42
options.libraryURI = libraryURI;
58
43
options.initialRoute = initialRoute;
@@ -79,7 +64,8 @@ - (FlutterEngine*)makeEngineWithOptions:(nullable FlutterEngineGroupOptions*)opt
79
64
initialRoute: initialRoute
80
65
entrypointArgs: entrypointArgs];
81
66
}
82
- [_engines addObject: [NSValue valueWithPointer: engine]];
67
+ // TODO(cbracken): https://github.com/flutter/flutter/issues/155943
68
+ [self .engines addObject: [NSValue valueWithPointer: (__bridge void *)engine]];
83
69
84
70
NSNotificationCenter * center = [NSNotificationCenter defaultCenter ];
85
71
[center addObserver: self
@@ -91,13 +77,14 @@ - (FlutterEngine*)makeEngineWithOptions:(nullable FlutterEngineGroupOptions*)opt
91
77
}
92
78
93
79
- (FlutterEngine*)makeEngine {
94
- NSString * engineName = [ NSString stringWithFormat: @" %@ . %d " , self .name, ++_enginesCreatedCount];
95
- FlutterEngine* result = [[FlutterEngine alloc ] initWithName: engineName project: self .project ];
96
- return [result autorelease ];
80
+ NSString * engineName =
81
+ [ NSString stringWithFormat: @" %@ . %lu " , self .name, ++ self .enginesCreatedCount ];
82
+ return [[FlutterEngine alloc ] initWithName: engineName project: self .project ];
97
83
}
98
84
99
85
- (void )onEngineWillBeDealloced : (NSNotification *)notification {
100
- [_engines removeObject: [NSValue valueWithPointer: notification.object]];
86
+ // TODO(cbracken): https://github.com/flutter/flutter/issues/155943
87
+ [self .engines removeObject: [NSValue valueWithPointer: (__bridge void *)notification.object]];
101
88
}
102
89
103
90
@end
0 commit comments