-
Notifications
You must be signed in to change notification settings - Fork 6k
Move Shell::Add/RemoveView to PlatformView and refine embedder API doc
#52003
Move Shell::Add/RemoveView to PlatformView and refine embedder API doc
#52003
Conversation
|
@chinmaygarde Can you take a look? I'm not sure whether this is a necessary change. I'm proposing this only because I supposed the |
| /// | ||
| class Delegate { | ||
| public: | ||
| using AddViewCallback = PlatformView::AddViewCallback; |
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.
Nit: Is this necessary? You can just use the typedef from the parent.
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 compiler requires PlatformView::AddViewCallback (for both the methods in Delegate and Shell) instead of simply AddViewCallback without it, which is definitely not necessary though, and I'm down to remove it. What do you think?
| /// | ||
| class PlatformView { | ||
| public: | ||
| using AddViewCallback = std::function<void(bool added)>; |
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.
What do the added and removed arguments to the callback mean? If added is false, why invoke the AddViewCallback? Perhaps document 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.
Both the add and the remove callbacks rely on the result. For example, in the Windows embedder as implemented in #51923
- After calling
AddView, the embedder blocks until a result is reported, which decides whether the returnedFlutterWindowsViewis null. (This eager blocking can be optimized in the future, but this is an easier approach for now.) - The embedder also pre-allocate resources after calling
AddViewbefore the callback, and if the result turns out a failure, then the resources are deallocated. The pre-allocation ensures that the framework can start operating the view as soon as they're aware of it. - After calling
RemoveView, embedder does not deallocate resources until the callback (successful or not). This allows handling any pending operations during this time.
|
I kept the statement "The embedder should prepare resources in advance but be ready to clean up on failure." since I think this is a very useful implementation suggestion. |
Shell::Add/RemoveView to PlatformViewShell::Add/RemoveView to PlatformView and refine embedder API doc
loic-sharma
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, thanks for cleaning this up!
…146663) flutter/engine@16b0cfd...2d85d12 2024-04-11 skia-flutter-autoroll@skia.org Roll Skia from 08940c2e0c44 to 5101cbe5a6bb (1 revision) (flutter/engine#52066) 2024-04-11 dkwingsmt@users.noreply.github.com Move `Shell::Add/RemoveView` to `PlatformView` and refine embedder API doc (flutter/engine#52003) 2024-04-11 chaopeng@chaopeng.me [Fuchsia] Support per app present latency tracing (flutter/engine#51503) 2024-04-11 jason-simmons@users.noreply.github.com Save and restore OpenGL bindings that are changed by fl_renderer_render (flutter/engine#51887) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC chinmaygarde@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…lutter#146663) flutter/engine@16b0cfd...2d85d12 2024-04-11 skia-flutter-autoroll@skia.org Roll Skia from 08940c2e0c44 to 5101cbe5a6bb (1 revision) (flutter/engine#52066) 2024-04-11 dkwingsmt@users.noreply.github.com Move `Shell::Add/RemoveView` to `PlatformView` and refine embedder API doc (flutter/engine#52003) 2024-04-11 chaopeng@chaopeng.me [Fuchsia] Support per app present latency tracing (flutter/engine#51503) 2024-04-11 jason-simmons@users.noreply.github.com Save and restore OpenGL bindings that are changed by fl_renderer_render (flutter/engine#51887) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC chinmaygarde@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This PR moves the methods to add or remove views from
ShelltoPlatformView. By design, theShellis supposed to be a messenger that glues classes together, whilePlatformViewis the operator that embedders that do not use the embedder API should operate on. The current design was made due to lack of knowledge to this design.This also makes
PlatformViewaware of views, which might be a prerequisite to #51925.This PR also adds some details to embedder API
AddViewandRemoveView.Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.