Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add call to Dart_NotifyDestroyed when the flutter view is destroyed. #37539

Merged
merged 5 commits into from
Nov 17, 2022

Conversation

a-siva
Copy link
Contributor

@a-siva a-siva commented Nov 12, 2022

Add call to Dart_NotifyDestroyed when the flutter view is destroyed.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@zanderso
Copy link
Member

FYI @dnfield

if (engine) {
engine->NotifyDestroyed();
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this task never gets run?

Copy link
Contributor Author

@a-siva a-siva Nov 15, 2022

Choose a reason for hiding this comment

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

Fixed the code to ensure the task gets run.


tonic::DartState::Scope scope(root_isolate);

Dart_NotifyDestroyed();
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this call block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No.

@dnfield
Copy link
Contributor

dnfield commented Nov 16, 2022

I think this looks right but would appreciate a pass from @jason-simmons to double check any threading considerations.

@@ -424,6 +429,8 @@ Future<void> runCallback(IsolateParam param) async {
@pragma('vm:entry-point')
@pragma('vm:external-name', 'NotifyNativeBool')
external void notifyNativeBool(bool value);
@pragma('vm:external-name', 'NotifyDestroyedBool')
external void notifyDestroyedBool();
Copy link
Member

Choose a reason for hiding this comment

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

Remove the "Bool"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -899,6 +899,12 @@ void Shell::OnPlatformViewDestroyed() {
// Overall, the longer term plan is to remove this implementation once
// https://github.com/flutter/flutter/issues/96679 is fixed.
rasterizer_->TeardownExternalViewEmbedder();

task_runners_.GetUITaskRunner()->PostTask([engine = engine_->GetWeakPtr()]() {
Copy link
Member

Choose a reason for hiding this comment

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

Would it be safe to move this to the start of Shell::OnPlatformViewDestroyed so it can run concurrently with the IO and raster thread tasks in that method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to the start.

@a-siva a-siva merged commit 1e1a4ab into flutter:main Nov 17, 2022
@a-siva a-siva deleted the destroy branch November 17, 2022 21:11
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)
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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants