mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Add docs to image_cache_task
This commit is contained in:
parent
dd3d5e3cd1
commit
e4a09a3287
1 changed files with 10 additions and 0 deletions
|
@ -14,8 +14,12 @@ import core::arc::arc;
|
||||||
import clone_arc = core::arc::clone;
|
import clone_arc = core::arc::clone;
|
||||||
|
|
||||||
enum Msg {
|
enum Msg {
|
||||||
|
/// Tell the cache that we may need a particular image soon. Must be posted
|
||||||
|
/// before GetImage
|
||||||
Prefetch(url),
|
Prefetch(url),
|
||||||
|
/// Request an Image object for a URL
|
||||||
GetImage(url, chan<ImageResponseMsg>),
|
GetImage(url, chan<ImageResponseMsg>),
|
||||||
|
/// Used by the decoder tasks to post decoded images back to the cache
|
||||||
StoreImage(url, arc<~Image>),
|
StoreImage(url, arc<~Image>),
|
||||||
Exit
|
Exit
|
||||||
}
|
}
|
||||||
|
@ -40,10 +44,16 @@ fn image_cache_task(resource_task: ResourceTask) -> ImageCacheTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ImageCache {
|
struct ImageCache {
|
||||||
|
/// A handle to the resource task for fetching the image binaries
|
||||||
resource_task: ResourceTask;
|
resource_task: ResourceTask;
|
||||||
|
/// The port on which we'll receive client requests
|
||||||
from_client: port<Msg>;
|
from_client: port<Msg>;
|
||||||
|
/// A map from URLs to the partially loaded compressed image data.
|
||||||
|
/// Once the data is complete it is then sent to a decoder
|
||||||
prefetch_map: UrlMap<@PrefetchData>;
|
prefetch_map: UrlMap<@PrefetchData>;
|
||||||
|
/// A list of clients waiting on images that are currently being decoded
|
||||||
future_image_map: UrlMap<@FutureData>;
|
future_image_map: UrlMap<@FutureData>;
|
||||||
|
/// The cache of decoded images
|
||||||
image_map: UrlMap<@arc<~Image>>;
|
image_map: UrlMap<@arc<~Image>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue