Start switching net/ to use abstractions over channels to allow introducing non-channel communication in the future.

This commit is contained in:
Josh Matthews 2015-01-25 10:44:28 -05:00
parent 7fddf4aa13
commit 1644436557
13 changed files with 108 additions and 79 deletions

View file

@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use image::base::Image;
use LoadConsumer::Channel;
use {ControlMsg, LoadData, ProgressMsg, ResourceTask};
use url::Url;
@ -84,7 +85,7 @@ impl ImageCacheTaskClient for ImageCacheTask {
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();
resource_task.send(ControlMsg::Load(LoadData::new(url.clone()), Channel(response_chan))).unwrap();
let mut image_data = vec!();