-
Notifications
You must be signed in to change notification settings - Fork 6k
Implemented FlutterEngineGroup and Spawn API. #22975
Conversation
2745d0a to
be38ab2
Compare
|
Sorry, prematurely put this up for review, i'll implement FlutterEngineGroup here too before review. |
14d06cb to
3c594ce
Compare
|
This is hung up until flutter/flutter#72107 is resolved. |
|
This is ready for review, it can't merge probably until the aforementioned unit test fixes have landed. |
shell/platform/darwin/ios/framework/Headers/FlutterEngineGroup.h
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterEngineGroup.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterEngineGroup.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Headers/FlutterEngineGroup.h
Outdated
Show resolved
Hide resolved
| project:_dartProject.get() | ||
| allowHeadlessExecution:_allowHeadlessExecution]; | ||
|
|
||
| flutter::Settings settings = _shell->GetSettings(); |
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.
Can we extract parts of this into a private method to share between here and createShell? To minimize the risk of someone updating one and not the other as much as possible?
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.
Yep, I did that in setupShell:withObservatoryPublication: and SetEntryPoint. There is very little happening here, mostly boilerplate around lambdas.
| FlutterEngine* spawnee = [group makeEngineWithEntrypoint:nil libraryURI:nil]; | ||
| XCTAssertNotNil(spawnee); | ||
| } | ||
|
|
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.
Can we test sequences of adds and deletes and make sure it's tracking correctly?
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.
If there is a sequence that would exercise new code let me know. I think deleting the last engine is the only interesting one that uses the code in a different way.
| [engine run]; | ||
| FlutterEngine* spawn = [engine spawnWithEntrypoint:nil libraryURI:nil]; | ||
| XCTAssertNotNil(spawn); | ||
| } |
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.
check that calling spawn accidentally before run doesn't crash or do something too weird
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.
It should crash which is typical for other methods that require an engine to have been run first.
| * Creates one FlutterEngine from another, sharing components between them. | ||
| * This results in a faster creation time and a smaller memory footprint engine. | ||
| * | ||
| * @see http://flutter.dev/go/multiple-engines |
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.
Lets make these all code comments
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 don't think that is appropriate. Docstrings are the proper place for documenting what a method does.
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.
It's not documentation though. i.e. we don't want our users to actually read the doc in a year. It's good context for engineers and maintainers to figure out the project scope and technical decisions.
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.
You talking about the link to the design doc? I've removed that.
| FlutterCallbackInformation.html | ||
| FlutterDartProject.html | ||
| FlutterEngine.html | ||
| FlutterEngineGroup.html |
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.
ha good catch. I always forget about this one.
| * Creates one FlutterEngine from another, sharing components between them. | ||
| * This results in a faster creation time and a smaller memory footprint engine. | ||
| * | ||
| * @see http://flutter.dev/go/multiple-engines |
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.
It's not documentation though. i.e. we don't want our users to actually read the doc in a year. It's good context for engineers and maintainers to figure out the project scope and technical decisions.
xster
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.
LGTM
Description
This implements the top level API for eventually will be engines sharing components. Currently they just share threads. Improvements will incrementally follow.
Related Issues
fixes flutter/flutter#72010
Tests
I added the following tests:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.Reviewer Checklist
Breaking Change
Did any tests fail when you ran them? Please read handling breaking changes.