-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Conversation
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. |
FYI @dnfield |
shell/common/shell.cc
Outdated
if (engine) { | ||
engine->NotifyDestroyed(); | ||
} | ||
}; |
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 looks like this task never gets run?
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.
Fixed the code to ensure the task gets run.
|
||
tonic::DartState::Scope scope(root_isolate); | ||
|
||
Dart_NotifyDestroyed(); |
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.
Does this call block?
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.
No.
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(); |
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.
Remove the "Bool"
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.
Done.
shell/common/shell.cc
Outdated
@@ -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()]() { |
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.
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?
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.
Moved to the start.
…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)
…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)
…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)
Add call to Dart_NotifyDestroyed when the flutter view is destroyed.