-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Document and slightly refactor ResourceManagerVK
& friends.
#45474
[Impeller] Document and slightly refactor ResourceManagerVK
& friends.
#45474
Conversation
@chinmaygarde QQ: if (auto manager = resource_manager_.lock()) {
manager->Reclaim(std::move(resource_));
} ... What if another thread calls |
I'm still working on the tests, they were more aspirational than functional :) |
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. I'd just add a test that clears out a resource to capture coverage for most of the code.
impeller/renderer/backend/vulkan/resource_manager_vk_unittests.cc
Outdated
Show resolved
Hide resolved
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 pending Aarons comments. Thanks!
ResourceManagerVK
& friendsResourceManagerVK
& friends.
@chinmaygarde Could you respond to #45474 (comment)? |
Weak pointers can't be used that way. You need to convert the weak to a shared pointer using a lock. So, if you can call reclaim, you need a shared pointer (using a lock or otherwise). |
impeller/renderer/backend/vulkan/resource_manager_vk_unittests.cc
Outdated
Show resolved
Hide resolved
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's not quite right yet. Sorry, it's best to make it flakeproof however unlikely the flake.
impeller/renderer/backend/vulkan/resource_manager_vk_unittests.cc
Outdated
Show resolved
Hide resolved
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!
…134240) flutter/engine@f0b718e...8d07c29 2023-09-07 matanlurey@users.noreply.github.com [Impeller] Document and slightly refactor `ResourceManagerVK` & friends. (flutter/engine#45474) 2023-09-07 uysalere@gmail.com [fuchsia] Restructure Flatland vsync loop (flutter/engine#45531) 2023-09-07 skia-flutter-autoroll@skia.org Roll Skia from 16df0c27bc0e to c3d6534b0ac3 (3 revisions) (flutter/engine#45543) 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 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Fixes flutter/flutter#134482. I wish I knew how to create the thread in `::Create()`, but given the constructor is private I feel less bad about reverting part of #45474. Added a test that consistently fails before this PR and passes after. (Unblocks flutter/flutter#133198)
@chinmaygarde specifically, let me know if I violated any correctness you were looking for, or if you would prefer I don't make 1 or more of the changes I made here.
@gaaclarke would love your input on C++ style specifically, or anything that stands out in general.
Summary
I plan to use the resource strategy in flutter/flutter#133198, but wanted to understand the code better first, so this is my contribution to make it a bit easier to understand (hopefully! push back if not!) and contribute tests.
Reset(ResourceType)
toSwap()
for consistency with the std smart pointers.::Create
(style guide).FML_DCHECK
s to private APIs to enforce correctness.