Struct ImageCacheStore

Source
struct ImageCacheStore {
    pending_loads: AllPendingLoads,
    completed_loads: HashMap<(ServoUrl, ImmutableOrigin, Option<CorsSettings>), CompletedLoad>,
    vector_images: FxHashMap<PendingImageId, VectorImageData>,
    rasterized_vector_images: FxHashMap<(PendingImageId, DeviceIntSize), RasterizationTask>,
    placeholder_image: Arc<RasterImage>,
    placeholder_url: ServoUrl,
    compositor_api: CrossProcessCompositorApi,
    pipeline_id: Option<PipelineId>,
    key_cache: KeyCache,
}
Expand description

§Image cache implementation.

Fields§

§pending_loads: AllPendingLoads

Images that are loading over network, or decoding.

§completed_loads: HashMap<(ServoUrl, ImmutableOrigin, Option<CorsSettings>), CompletedLoad>

Images that have finished loading (successful or not)

§vector_images: FxHashMap<PendingImageId, VectorImageData>

Vector (e.g. SVG) images that have been sucessfully loaded and parsed but are yet to be rasterized. Since the same SVG data can be used for rasterizing at different sizes, we use this hasmap to share the data.

§rasterized_vector_images: FxHashMap<(PendingImageId, DeviceIntSize), RasterizationTask>

Vector images for which rasterization at a particular size has started or completed. If completed, the result member of RasterizationTask contains the rasterized image.

§placeholder_image: Arc<RasterImage>

The placeholder image used when an image fails to load

§placeholder_url: ServoUrl

The URL used for the placeholder image

§compositor_api: CrossProcessCompositorApi

Cross-process compositor API instance.

§pipeline_id: Option<PipelineId>§key_cache: KeyCache

Main struct to handle the cache of WebRenderImageKey and images that do not have a key yet.

Implementations§

Source§

impl ImageCacheStore

Source

fn set_key_and_finish_load( &mut self, pending_image: PendingKey, image_key: WebRenderImageKey, )

Finishes loading the image by setting the WebRenderImageKey and calling compete_load or complete_load_svg.

Source

fn load_image_with_keycache(&mut self, pending_image: PendingKey)

If a key is available the image will be immediately loaded, otherwise it will load then the next batch of keys is received. Only call this if the image does not have a LoadKey yet.

Source

fn insert_keys_and_load_images(&mut self, image_keys: Vec<WebRenderImageKey>)

Insert received keys into the cache and complete the loading of images.

Source

fn complete_load_svg( &mut self, rasterized_image: RasterImage, pending_image_id: PendingImageId, requested_size: DeviceIntSize, )

Complete the loading the of the rasterized svg image. This needs the RasterImage to already have a WebRenderImageKey.

Source

fn complete_load(&mut self, key: PendingImageId, load_result: LoadResult)

The rest of complete load. This requires that images have a valid WebRenderImageKey.

Source

fn get_completed_image_if_available( &self, url: ServoUrl, origin: ImmutableOrigin, cors_setting: Option<CorsSettings>, placeholder: UsePlaceholder, ) -> Option<Result<(Image, ServoUrl), ()>>

Return a completed image if it exists, or None if there is no complete load or the complete load is not fully decoded or is unavailable.

Source

fn handle_decoder(&mut self, msg: DecoderMsg)

Handle a message from one of the decoder worker threads or from a sync decoding operation.

Trait Implementations§

Source§

impl Drop for ImageCacheStore

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl MallocSizeOf for ImageCacheStore

Source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T