Trait net_traits::image_cache::ImageCache

source ·
pub trait ImageCache: Sync + Send {
    // Required methods
    fn new(compositor_api: CrossProcessCompositorApi) -> 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§

source

fn new(compositor_api: CrossProcessCompositorApi) -> Self
where Self: Sized,

source

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.

source

fn get_cached_image_status( &self, url: ServoUrl, origin: ImmutableOrigin, cors_setting: Option<CorsSettings>, use_placeholder: UsePlaceholder, ) -> ImageCacheResult

source

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).

source

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.

source

fn notify_pending_response(&self, id: PendingImageId, action: FetchResponseMsg)

Inform the image cache about a response for a pending request.

Implementors§