mirror of
https://github.com/servo/servo.git
synced 2025-08-01 03:30:33 +01:00
Send response for image requests progressively to image cache.
This commit is contained in:
parent
21118f0a8a
commit
0d2ec852ac
5 changed files with 59 additions and 58 deletions
|
@ -2,6 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use FetchResponseMsg;
|
||||
use image::base::{Image, ImageMetadata};
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use servo_url::ServoUrl;
|
||||
|
@ -89,7 +90,7 @@ pub enum ImageCacheCommand {
|
|||
|
||||
/// Instruct the cache to store this data as a newly-complete network request and continue
|
||||
/// decoding the result into pixel data
|
||||
StoreDecodeImage(PendingImageId, Vec<u8>),
|
||||
StoreDecodeImage(PendingImageId, FetchResponseMsg),
|
||||
|
||||
/// Clients must wait for a response before shutting down the ResourceThread
|
||||
Exit(IpcSender<()>),
|
||||
|
@ -151,9 +152,9 @@ impl ImageCacheThread {
|
|||
self.chan.send(msg).expect("Image cache thread is not available");
|
||||
}
|
||||
|
||||
/// Decode the given image bytes and cache the result for the given pending ID.
|
||||
pub fn store_complete_image_bytes(&self, id: PendingImageId, image_data: Vec<u8>) {
|
||||
let msg = ImageCacheCommand::StoreDecodeImage(id, image_data);
|
||||
/// Inform the image cache about a response for a pending request.
|
||||
pub fn notify_pending_response(&self, id: PendingImageId, data: FetchResponseMsg) {
|
||||
let msg = ImageCacheCommand::StoreDecodeImage(id, data);
|
||||
self.chan.send(msg).expect("Image cache thread is not available");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue