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

[refactor] Move Caches to re_viewer_ctx and make it generic #2043

Merged
merged 9 commits into from
May 4, 2023

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented May 4, 2023

Another step towards moving ViewerContext to re_viewer_ctx. Makes its caches field a container of generic caches and introduces a Cache trait that we can use throughout the viewer for.. caching things!

It is expected that the store will take over more and more of that functionality, but meanwhile this is a nice home for what we have and will make it easier to move it again.

Part of:

Checklist

PR Build Summary: https://build.rerun.io/pr/2043

@Wumpf Wumpf added 📺 re_viewer affects re_viewer itself 🚜 refactor Change the code, not the functionality labels May 4, 2023
@emilk emilk self-requested a review May 4, 2023 13:46
Copy link
Member

@emilk emilk left a comment

Choose a reason for hiding this comment

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

nice nice nice, but let's get the verbosity down and also add some memory tracking while we're at it!

crates/re_viewer/src/ui/data_ui/image.rs Outdated Show resolved Hide resolved
crates/re_viewer/src/ui/data_ui/image.rs Outdated Show resolved Hide resolved
fn purge_memory(&mut self);

/// Converts itself to a mutable reference of [`Any`], which enables mutable downcasting to concrete types.
fn as_any_mut(&mut self) -> &mut dyn Any;
Copy link
Member

Choose a reason for hiding this comment

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

It would be great with an fn bytes_used(&self) -> usize here too. Then we could easily iterate over all caches and show them in the memory panel!

Copy link
Member Author

Choose a reason for hiding this comment

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

liking that idea a lot. I'll add a todo, want to move on with the actual refactoring quickly :)

@Wumpf Wumpf merged commit c5c3242 into main May 4, 2023
@Wumpf Wumpf deleted the andreas/generic-cache branch May 4, 2023 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📺 re_viewer affects re_viewer itself 🚜 refactor Change the code, not the functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants