Trait net_traits::image_cache::ImageCache
source · pub trait ImageCache: Sync + Send {
fn new(webrender_api: WebrenderIpcSender) -> Self
where
Self: Sized;
fn get_image(
&self,
url: ServoUrl,
origin: ImmutableOrigin,
cors_setting: Option<CorsSettings>
) -> Option<Arc<Image>>;
fn get_cached_image_status(
&self,
url: ServoUrl,
origin: ImmutableOrigin,
cors_setting: Option<CorsSettings>,
use_placeholder: UsePlaceholder
) -> ImageCacheResult;
fn track_image(
&self,
url: ServoUrl,
origin: ImmutableOrigin,
cors_setting: Option<CorsSettings>,
sender: IpcSender<PendingImageResponse>,
use_placeholder: UsePlaceholder
) -> ImageCacheResult;
fn add_listener(&self, id: PendingImageId, listener: ImageResponder);
fn notify_pending_response(
&self,
id: PendingImageId,
action: FetchResponseMsg
);
}
Required Methods§
fn new(webrender_api: WebrenderIpcSender) -> Selfwhere
Self: Sized,
sourcefn get_image(
&self,
url: ServoUrl,
origin: ImmutableOrigin,
cors_setting: Option<CorsSettings>
) -> Option<Arc<Image>>
fn get_image(
&self,
url: ServoUrl,
origin: ImmutableOrigin,
cors_setting: Option<CorsSettings>
) -> Option<Arc<Image>>
Definitively check whether there is a cached, fully loaded image available.
fn get_cached_image_status(
&self,
url: ServoUrl,
origin: ImmutableOrigin,
cors_setting: Option<CorsSettings>,
use_placeholder: UsePlaceholder
) -> ImageCacheResult
sourcefn track_image(
&self,
url: ServoUrl,
origin: ImmutableOrigin,
cors_setting: Option<CorsSettings>,
sender: IpcSender<PendingImageResponse>,
use_placeholder: UsePlaceholder
) -> ImageCacheResult
fn track_image(
&self,
url: ServoUrl,
origin: ImmutableOrigin,
cors_setting: Option<CorsSettings>,
sender: IpcSender<PendingImageResponse>,
use_placeholder: UsePlaceholder
) -> ImageCacheResult
Add a listener for the provided pending image id, eventually called by ImageCacheStore::complete_load. If only metadata is available, Available(ImageOrMetadataAvailable) will be returned. If Available(ImageOrMetadataAvailable::Image) or LoadError is the final value, the provided listener will be dropped (consumed & not added to PendingLoad).
sourcefn add_listener(&self, id: PendingImageId, listener: ImageResponder)
fn add_listener(&self, id: PendingImageId, listener: ImageResponder)
Add a new listener for the given pending image id. If the image is already present, the responder will still receive the expected response.
sourcefn notify_pending_response(&self, id: PendingImageId, action: FetchResponseMsg)
fn notify_pending_response(&self, id: PendingImageId, action: FetchResponseMsg)
Inform the image cache about a response for a pending request.