-
Notifications
You must be signed in to change notification settings - Fork 6k
started sharing GPU contexts between spawned engines #23435
Conversation
ef5e5be to
d0410e2
Compare
This comment has been minimized.
This comment has been minimized.
| static_cast<flutter::PlatformViewIOS*>(platform_view.get()); | ||
| std::shared_ptr<flutter::IOSContext> context = ios_platform_view->GetIosContext(); | ||
| FML_DCHECK(context); | ||
| flutter::Shell::CreateCallback<flutter::PlatformView> on_create_platform_view = |
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.
I was wondering whether there might be a race here too and then noticed there was a comment in the other place where this callback was created to say the whole thing is synchronous. Worth copying that comment here too.
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
| - (void)tearDown { | ||
| } | ||
|
|
||
| - (void)testSpawnsShareGpuContext { |
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.
Why do you need mrc here?
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.
Because of our smart pointers around objective-c objects in headers. Certain internal headers for the engine can't be included without blowing up. In particular FlutterEngine_Internal.h. I tried to fix our smart pointers but it's a losing battle.
| // |PlatformView| | ||
| void SetSemanticsEnabled(bool enabled) override; | ||
|
|
||
| const std::shared_ptr<IOSContext>& GetIosContext() { return ios_context_; } |
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.
doc
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
Description
As shown in flutter.dev/go/multiple-engines, sharing graphics contexts between engines in a group opens up memory savings. This is one more optimization that is happening as part of the multiple-flutters work.
Related Issues
fixes flutter/flutter#72022
Tests
I added the following tests:
FlutterEngineTest unit tests.
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.Reviewer Checklist
Breaking Change
Did any tests fail when you ran them? Please read handling breaking changes.