Skip to content

Commit

Permalink
Remove compositor dependency on net crate.
Browse files Browse the repository at this point in the history
Move the ImageCacheTaskClient trait and impl to net_traits. Fixes #5551.
  • Loading branch information
aneeshusa committed Apr 10, 2015
1 parent c9a413c commit a1d7456
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
3 changes: 1 addition & 2 deletions components/compositing/constellation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 0 additions & 12 deletions components/net/image_cache_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions components/net_traits/image_cache_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit a1d7456

Please sign in to comment.