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

[Multiwindow] Renderers receive view IDs as argument #36593

Merged
merged 22 commits into from
Nov 17, 2022

Conversation

dkwingsmt
Copy link
Contributor

@dkwingsmt dkwingsmt commented Oct 4, 2022

This PR changes FlutterRenderer so that it can no longer be assigned with a view, but instead the methods receive a view ID as an argument when called.

Part of the multiwindow project (design doc): There can only be one renderer, since the renderer is created when the engine is initialized. Therefore, the renderer must be able to handle multiple views.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@dkwingsmt dkwingsmt self-assigned this Nov 3, 2022
@flutter-dashboard flutter-dashboard bot added the embedder Related to the embedder API label Nov 8, 2022
@dkwingsmt dkwingsmt marked this pull request as ready for review November 8, 2022 20:36
@dkwingsmt dkwingsmt changed the title [Multiwindow] Isolate renderer from view [Multiwindow] Renderers receive view IDs as argument Nov 8, 2022
- (FlutterMetalTexture)createTextureForView:(uint64_t)viewId size:(CGSize)size {
FlutterView* view = [_viewProvider getView:viewId];
if (view == nil) {
FML_LOG(WARNING) << "Can't create texture on a non-existent view.";
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be an error? When can this happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When the caller sends a view ID that the engine does not recognize. When the engine is run as a whole, this should not happen.
(Yes, the same as #36392 (comment) )

Copy link
Member

Choose a reason for hiding this comment

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

If this shouldn't happen, is there any reason not to make it an assertion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope. I've converted it to an assertion.

@@ -406,7 +406,6 @@ - (void)loadAOTData:(NSString*)assetsDir {
- (void)setViewController:(FlutterViewController*)controller {
if (_viewController != controller) {
_viewController = controller;
[_renderer setFlutterView:controller.flutterView];
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is the view registered with the view provider?

Copy link
Contributor Author

@dkwingsmt dkwingsmt Nov 14, 2022

Choose a reason for hiding this comment

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

Any other places. The view provider is just a protocol/facade over other classes, and will have other methods to register views, which is not shown as a view provider.
In the real application the view provider is macos/FlutterEngine, which is the source-of-truth of the set of views.

@dkwingsmt dkwingsmt force-pushed the isolate-renderer-from-view branch from fbc4210 to 8e7c29e Compare November 14, 2022 19:39
@dkwingsmt
Copy link
Contributor Author

I've fixed all the comments. Thanks for pointing out kFlutterDefaultViewId. I forgot about this since this PR was created earlier than the born of it.

@dkwingsmt dkwingsmt added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 17, 2022
Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

LGTM stamp from a Japanese personal seal

@auto-submit auto-submit bot merged commit ac874d6 into flutter:main Nov 17, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 17, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 17, 2022
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Nov 17, 2022
…115592)

* ac874d676 [Multiwindow] Renderers receive view IDs as argument (flutter/engine#36593)

* bc86c1ff5 Roll Skia from d90917a1da6b to 89f8ba6f749d (10 revisions) (flutter/engine#37723)

* dd12a4058 delete fontface polyfill (flutter/engine#37652)

* 1e1a4ab3c Add call to Dart_NotifyDestroyed when the flutter view is destroyed. (flutter/engine#37539)
@dkwingsmt dkwingsmt deleted the isolate-renderer-from-view branch November 17, 2022 22:36
shogohida pushed a commit to shogohida/flutter that referenced this pull request Dec 7, 2022
…lutter#115592)

* ac874d676 [Multiwindow] Renderers receive view IDs as argument (flutter/engine#36593)

* bc86c1ff5 Roll Skia from d90917a1da6b to 89f8ba6f749d (10 revisions) (flutter/engine#37723)

* dd12a4058 delete fontface polyfill (flutter/engine#37652)

* 1e1a4ab3c Add call to Dart_NotifyDestroyed when the flutter view is destroyed. (flutter/engine#37539)
gspencergoog pushed a commit to gspencergoog/flutter that referenced this pull request Jan 19, 2023
…lutter#115592)

* ac874d676 [Multiwindow] Renderers receive view IDs as argument (flutter/engine#36593)

* bc86c1ff5 Roll Skia from d90917a1da6b to 89f8ba6f749d (10 revisions) (flutter/engine#37723)

* dd12a4058 delete fontface polyfill (flutter/engine#37652)

* 1e1a4ab3c Add call to Dart_NotifyDestroyed when the flutter view is destroyed. (flutter/engine#37539)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App embedder Related to the embedder API platform-macos
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants