-
Notifications
You must be signed in to change notification settings - Fork 6k
Migrate darwin common "framework_shared" target to ARC #37049
Changes from 5 commits
425aea4
3f5368c
a92065a
1265796
3f8c2fb
7b6a5a4
6157ddf
35559e1
ea06e4e
1fde705
700da71
0dd00d5
12a7fd7
0a5aec4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -230,7 +230,7 @@ FLUTTER_DARWIN_EXPORT | |
| /** | ||
| * The method name. | ||
| */ | ||
| @property(readonly, nonatomic) NSString* method; | ||
| @property(readonly, nonatomic, copy) NSString* method; | ||
|
||
|
|
||
| /** | ||
| * The arguments. | ||
|
|
@@ -257,12 +257,12 @@ FLUTTER_DARWIN_EXPORT | |
| /** | ||
| The error code. | ||
| */ | ||
| @property(readonly, nonatomic) NSString* code; | ||
| @property(readonly, nonatomic, copy) NSString* code; | ||
|
|
||
| /** | ||
| The error message. | ||
| */ | ||
| @property(readonly, nonatomic, nullable) NSString* message; | ||
| @property(readonly, nonatomic, nullable, copy) NSString* message; | ||
|
|
||
| /** | ||
| The error details. | ||
|
|
@@ -344,17 +344,17 @@ FLUTTER_DARWIN_EXPORT | |
| /** | ||
| * The type of the encoded values. | ||
| */ | ||
| @property(readonly, nonatomic) FlutterStandardDataType type; | ||
| @property(readonly, nonatomic, assign) FlutterStandardDataType type; | ||
|
|
||
| /** | ||
| * The number of value items encoded. | ||
| */ | ||
| @property(readonly, nonatomic) UInt32 elementCount; | ||
| @property(readonly, nonatomic, assign) UInt32 elementCount; | ||
|
|
||
| /** | ||
| * The number of bytes used by the encoding of a single value item. | ||
| */ | ||
| @property(readonly, nonatomic) UInt8 elementSize; | ||
| @property(readonly, nonatomic, assign) UInt8 elementSize; | ||
| @end | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -51,9 +51,9 @@ + (instancetype)messageChannelWithName:(NSString*)name | |||||||||||||
| + (instancetype)messageChannelWithName:(NSString*)name | ||||||||||||||
| binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger | ||||||||||||||
| codec:(NSObject<FlutterMessageCodec>*)codec { | ||||||||||||||
| return [[[FlutterBasicMessageChannel alloc] initWithName:name | ||||||||||||||
| binaryMessenger:messenger | ||||||||||||||
| codec:codec] autorelease]; | ||||||||||||||
| return [[FlutterBasicMessageChannel alloc] initWithName:name | ||||||||||||||
| binaryMessenger:messenger | ||||||||||||||
| codec:codec]; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| - (instancetype)initWithName:(NSString*)name | ||||||||||||||
|
|
@@ -69,21 +69,13 @@ - (instancetype)initWithName:(NSString*)name | |||||||||||||
| taskQueue:(NSObject<FlutterTaskQueue>*)taskQueue { | ||||||||||||||
| self = [super init]; | ||||||||||||||
| NSAssert(self, @"Super init cannot be nil"); | ||||||||||||||
| _name = [name retain]; | ||||||||||||||
| _messenger = [messenger retain]; | ||||||||||||||
| _codec = [codec retain]; | ||||||||||||||
| _taskQueue = [taskQueue retain]; | ||||||||||||||
| _name = name; | ||||||||||||||
|
||||||||||||||
| _name = name; | |
| _name = [name copy]; |
Also all the FlutterBasicMessageChannel ivars should be properties... but that doesn't need to be done here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong, codec needs to be captured by the block to live longer than the channel object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe just early return if codec is nil? if codec is nil, should this handler be called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked into the implementation details. But just looking at this method without context, the behavior is different if we early return when codec is nil. The current behavior is that the handler is always called regardless of the codec's value. So I'd say we should keep it the same behavior and maybe update the code later if we think that's a bug.
Edit: we probably shouldn't even support a nil codec, maybe we can add an FML_DCHECK. But it is probably a good idea doing it in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed there's not real-world case where a nil codec makes sense. Asserting it's not nil sgtm in a followup patch.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And these properties are copy but you only get that on the property setter, not when you set the synthesized ivar.
| _code = code; | |
| _message = message; | |
| _details = details; | |
| _code = [code copy]; | |
| _message = [message copy]; | |
| _details = [details copy]; |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| _method = method; | |
| _method = [method copy]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same q here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong, codec needs to be captured by the block to live longer than the channel object. _codec was actually nil in some scenarios if not captured strongly.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other deps aren't necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. They were probably initially necessary but was forgotten to be removed at some point when refactoring the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if some of these were copy-pasted from the macOS embedder initially? I can't imagine why we'd depend on flow, for example, given the current code. Either way, nice catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They were added 6 years ago so I guess the code structure was a lot different.