Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Dec 10, 2020

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:

  • Shell::Spawn unit test
  • FlutterEngineGroup spawn test

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.

  • I read the contributor guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the C++, Objective-C, Java style guides for the engine.
  • I read the tree hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation.
  • All existing and new tests are passing.
  • I am willing to follow-up on review comments in a timely manner.

Reviewer Checklist

Breaking Change

Did any tests fail when you ran them? Please read handling breaking changes.

@google-cla google-cla bot added the cla: yes label Dec 10, 2020
@gaaclarke gaaclarke force-pushed the lfe-api branch 6 times, most recently from 2745d0a to be38ab2 Compare December 10, 2020 21:03
@gaaclarke gaaclarke marked this pull request as ready for review December 10, 2020 21:03
@gaaclarke gaaclarke requested a review from xster December 10, 2020 21:04
@gaaclarke gaaclarke marked this pull request as draft December 10, 2020 21:06
@gaaclarke
Copy link
Member Author

Sorry, prematurely put this up for review, i'll implement FlutterEngineGroup here too before review.

@gaaclarke gaaclarke force-pushed the lfe-api branch 2 times, most recently from 14d06cb to 3c594ce Compare December 10, 2020 21:55
@gaaclarke
Copy link
Member Author

This is hung up until flutter/flutter#72107 is resolved.

@gaaclarke gaaclarke marked this pull request as ready for review December 11, 2020 19:50
@gaaclarke
Copy link
Member Author

This is ready for review, it can't merge probably until the aforementioned unit test fixes have landed.

@gaaclarke gaaclarke requested a review from xster December 11, 2020 23:12
project:_dartProject.get()
allowHeadlessExecution:_allowHeadlessExecution];

flutter::Settings settings = _shell->GetSettings();
Copy link
Member

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?

Copy link
Member Author

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);
}

Copy link
Member

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?

Copy link
Member Author

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);
}
Copy link
Member

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

Copy link
Member Author

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
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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.

@gaaclarke gaaclarke requested a review from xster December 14, 2020 23:13
FlutterCallbackInformation.html
FlutterDartProject.html
FlutterEngine.html
FlutterEngineGroup.html
Copy link
Member

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
Copy link
Member

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.

Copy link
Member

@xster xster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gaaclarke gaaclarke merged commit f37c8c5 into flutter:master Dec 15, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 15, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 15, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 15, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 15, 2020
gspencergoog pushed a commit to gspencergoog/engine that referenced this pull request Jan 5, 2021
@xster xster mentioned this pull request Jan 15, 2021
13 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shared Engine Components API - iOS - Lightweight Flutter Engines

2 participants