-
Notifications
You must be signed in to change notification settings - Fork 6k
[ios] add setting flag to enable embedder api. #40025
Conversation
e2f883d to
8942090
Compare
jmagman
left a comment
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.
Minor nits. Looks like the FlutterEngineTest are crashing though.
shell/common/switches.h
Outdated
| "requested sampling value, MSAA will be disabled.") | ||
| DEF_SWITCH(EnableIOSEmbedderAPI, | ||
| "enable-embedder-api", | ||
| "Enable the embedder api. Defaults to false. Ignored if the " |
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.
Alternatively you could say "iOS only" for now, up to you though.
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.
My first version was actually "iOS only" but wanted to keep it future proof for android. I will revert back to "iOS only", it's less confusing.
2d99212 to
b2f8505
Compare
|
|
||
| - (void)testCreate { | ||
| id project = OCMClassMock([FlutterDartProject class]); | ||
| FlutterDartProject* project = [[FlutterDartProject alloc] init]; |
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.
@jmagman The test failure was due to the mock project doesn't have the setting ivar mocked. For these tests, I either removed the project completely or used a real project object. There was no reason to mock the project at the first place.
draft draft fix fix test fix test revuew fix tests
| - (BOOL)enableEmbedderAPI { | ||
| return _enableEmbedderAPI; | ||
| } |
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 didn't get synthesized for you?
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 should. The getters were from the old implementation. I forgot to remove this and the below getters.
Will remove now.
| #pragma mark - Embedder API properties | ||
|
|
||
| // Function pointers for interacting with the embedder.h API. | ||
| @property(nonatomic, assign) BOOL enableEmbedderAPI; |
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.
| @property(nonatomic, assign) BOOL enableEmbedderAPI; | |
| @property(nonatomic, assign, readonly) BOOL enableEmbedderAPI; |
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.
probably also wanna remove assign if do readonly
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 think you still want to keep assign (as opposed to retain or copy) for the primitive? I don't think the readwrite/readonly impacts that.
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.
iirc assign/retain/copy etc only affect how the setters are synthesized. readonly won't synthesize the setter at all in the first place.
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 looked at it again. It is in the .mm file. So I will remove the readonly and keep the assign.
Can you clarify why do we need both flags and when to use which one? |
The tool flag would be for a single |
The info.plist is for running from XCode, the commandline flag is for running from terminal without the need to edit the info.plist. |
| /// Enable embedder api on the embedder. | ||
| /// | ||
| /// This is ignored on the platforms that use the embedder_api by default. | ||
| bool enable_embedder_api = false; |
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 more self-descriptive naming like enable_embedder_api_for_ios (or enable_embedder_api_for_mobile if wanna re-use for android)
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 tried to keep it generic so it could be reused by android.
I also wanted to keep it the same name as the command line flag. And I would like the command line flag to be short for easier typing when testing ;p
b624b14 to
99a48ca
Compare
First patch for iOS Embedder api migration.
The iOS Embedder API implementation is going to be hidden behind this flag during the migration.
This PR introduced:
enable-embedder-api, which can also be used for Android when we want to migrate it to embedder API.FLTEnableIOSEmbedderAPI, which is used on iOS.Both flag acts the same on iOS and either one of them being true should run iOS embedder with the embedder API.
This flag defaults to false.
First step of flutter/flutter#112232
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.