# gpui: Replace shared asset futures with owning cache entries \(\#63934\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/5896274168e06663568f42b5bae142162936e0a6)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 5896274168e06663568f42b5bae142162936e0a6

Requested commit: 5896274168e06663568f42b5bae142162936e0a6

Commit: 5896274168e06663568f42b5bae142162936e0a6

Tree: d0b1a99ea234b63ab1fe12e28fa3633da11c82ef

Author: Lukas Wirth

Committer: GitHub

## Message

```
gpui: Replace shared asset futures with owning cache entries (#63934)

## Summary

Replace GPUI's shared asset futures with owning cache entries. The
mutex-backed waiter collection in futures::future::Shared can contend
between a worker and the browser main thread, where blocking waits are
forbidden.

- Keep loading on the background executor, with one foreground task
publishing the cached result and notifying interested views.
- Deduplicate loads and view registrations; cancel pending work on
eviction without allowing completion to update a replacement entry.
- Change App::fetch_asset to return Option<A::Output>, remove
ImageLoadingTask, and make ImageCacheItem an opaque owning entry.
- Migrate the retain-all image cache and image gallery LRU example.
Repository-wide search found no further callers requiring migration.

Results become visible after the foreground completion task publishes
them. Entries expose neither cloneable nor awaitable task handles.

Release Notes:

- N/A
```

## Parents

- [f83313d0e0031f7205fc8f77679fc742fe341a23](https://git.cafe/gitcafe/zed/commit/f83313d0e0031f7205fc8f77679fc742fe341a23?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/5896274168e06663568f42b5bae142162936e0a6?format=markdown)
