mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Fetch complete images from the cache for canvas operations.
This commit is contained in:
parent
c890c9143c
commit
541ecbfe21
1 changed files with 11 additions and 10 deletions
|
@ -337,18 +337,19 @@ impl<'a> From<&'a WebGLContextAttributes> for GLContextAttributes {
|
|||
|
||||
pub mod utils {
|
||||
use dom::window::Window;
|
||||
use net_traits::image_cache_thread::ImageResponse;
|
||||
use net_traits::image_cache_thread::{ImageResponse, UsePlaceholder, ImageOrMetadataAvailable};
|
||||
use net_traits::image_cache_thread::CanRequestImages;
|
||||
use servo_url::ServoUrl;
|
||||
|
||||
pub fn request_image_from_cache(window: &Window, url: ServoUrl) -> ImageResponse {
|
||||
panic!()
|
||||
/*let image_cache = window.image_cache_thread();
|
||||
let (response_chan, response_port) = ipc::channel().unwrap();
|
||||
image_cache.request_image(url.into(), ImageCacheChan(response_chan), None);
|
||||
let result = response_port.recv().unwrap();
|
||||
match result {
|
||||
ImageCacheResult::InitiateRequest(..) => panic!("unexpected image request initiator"),
|
||||
ImageCacheResult::Response(result) => result.image_response,
|
||||
}*/
|
||||
let image_cache = window.image_cache_thread();
|
||||
//XXXjdm add a image cache mode that doesn't store anything for NotRequested?
|
||||
let response =
|
||||
image_cache.find_image_or_metadata(url.into(), UsePlaceholder::No);
|
||||
match response {
|
||||
Ok(ImageOrMetadataAvailable::ImageAvailable(image)) =>
|
||||
ImageResponse::Loaded(image),
|
||||
_ => ImageResponse::None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue