Pass a MutableAppContext in render

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra
2021-08-27 17:25:13 +02:00
co-authored by Nathan Sobo
parent a9963f1b32
commit d5b7e2d4e3
2 changed files with 69 additions and 61 deletions
+7 -3
View File
@@ -32,7 +32,7 @@ impl Presenter {
font_cache: Arc<FontCache>,
text_layout_cache: TextLayoutCache,
asset_cache: Arc<AssetCache>,
cx: &MutableAppContext,
cx: &mut MutableAppContext,
) -> Self {
Self {
window_id,
@@ -57,7 +57,7 @@ impl Presenter {
path
}
pub fn invalidate(&mut self, mut invalidation: WindowInvalidation, cx: &AppContext) {
pub fn invalidate(&mut self, mut invalidation: WindowInvalidation, cx: &mut MutableAppContext) {
for view_id in invalidation.removed {
invalidation.updated.remove(&view_id);
self.rendered_views.remove(&view_id);
@@ -72,7 +72,11 @@ impl Presenter {
}
}
pub fn refresh(&mut self, invalidation: Option<WindowInvalidation>, cx: &AppContext) {
pub fn refresh(
&mut self,
invalidation: Option<WindowInvalidation>,
cx: &mut MutableAppContext,
) {
if let Some(invalidation) = invalidation {
for view_id in invalidation.removed {
self.rendered_views.remove(&view_id);