mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Remove compositor dependency on net crate.
Move the ImageCacheTaskClient trait and impl to net_traits. Fixes #5551.
This commit is contained in:
parent
c9a413cb6e
commit
a1d7456307
3 changed files with 13 additions and 14 deletions
|
@ -20,9 +20,8 @@ use msg::constellation_msg::{IFrameSandboxState, MozBrowserEvent, NavigationDire
|
|||
use msg::constellation_msg::{Key, KeyState, KeyModifiers, LoadData};
|
||||
use msg::constellation_msg::{SubpageId, WindowSizeData};
|
||||
use msg::constellation_msg::{self, ConstellationChan, Failure};
|
||||
use net::image_cache_task::ImageCacheTaskClient;
|
||||
use net_traits::{self, ResourceTask};
|
||||
use net_traits::image_cache_task::ImageCacheTask;
|
||||
use net_traits::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
|
||||
use net_traits::storage_task::{StorageTask, StorageTaskMsg};
|
||||
use profile::mem;
|
||||
use profile::time;
|
||||
|
|
|
@ -395,18 +395,6 @@ impl ImageCache {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait ImageCacheTaskClient {
|
||||
fn exit(&self);
|
||||
}
|
||||
|
||||
impl ImageCacheTaskClient for ImageCacheTask {
|
||||
fn exit(&self) {
|
||||
let (response_chan, response_port) = channel();
|
||||
self.send(Msg::Exit(response_chan));
|
||||
response_port.recv().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn spawn_listener<F, A>(f: F) -> Sender<A>
|
||||
where F: FnOnce(Receiver<A>) + Send + 'static,
|
||||
A: Send + 'static
|
||||
|
|
|
@ -70,6 +70,18 @@ impl ImageCacheTask {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait ImageCacheTaskClient {
|
||||
fn exit(&self);
|
||||
}
|
||||
|
||||
impl ImageCacheTaskClient for ImageCacheTask {
|
||||
fn exit(&self) {
|
||||
let (response_chan, response_port) = channel();
|
||||
self.send(Msg::Exit(response_chan));
|
||||
response_port.recv().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn load_image_data(url: Url, resource_task: ResourceTask, placeholder: &[u8]) -> Result<Vec<u8>, ()> {
|
||||
let (response_chan, response_port) = channel();
|
||||
resource_task.send(ControlMsg::Load(LoadData::new(url.clone(), response_chan))).unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue