mirror of
https://github.com/servo/servo.git
synced 2025-10-09 04:59:23 +01:00
Rust upgrades
This commit is contained in:
parent
caf1ed9446
commit
bbac8aa5c3
130 changed files with 1236 additions and 985 deletions
|
@ -8,9 +8,10 @@ use file_loader;
|
|||
use http_loader;
|
||||
use data_loader;
|
||||
|
||||
use std::comm::{Chan, Port, SharedChan};
|
||||
use std::comm::{Chan, Port};
|
||||
use std::cast;
|
||||
use std::task;
|
||||
use extra::url::Url;
|
||||
use util::spawn_listener;
|
||||
use http::headers::content_type::MediaType;
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -85,8 +86,8 @@ pub enum ProgressMsg {
|
|||
|
||||
/// For use by loaders in responding to a Load message.
|
||||
pub fn start_sending(start_chan: Chan<LoadResponse>,
|
||||
metadata: Metadata) -> SharedChan<ProgressMsg> {
|
||||
let (progress_port, progress_chan) = SharedChan::new();
|
||||
metadata: Metadata) -> Chan<ProgressMsg> {
|
||||
let (progress_port, progress_chan) = Chan::new();
|
||||
start_chan.send(LoadResponse {
|
||||
metadata: metadata,
|
||||
progress_port: progress_port,
|
||||
|
@ -112,7 +113,7 @@ pub fn load_whole_resource(resource_task: &ResourceTask, url: Url)
|
|||
}
|
||||
|
||||
/// Handle to a resource task
|
||||
pub type ResourceTask = SharedChan<ControlMsg>;
|
||||
pub type ResourceTask = Chan<ControlMsg>;
|
||||
|
||||
pub type LoaderTask = proc(url: Url, Chan<LoadResponse>);
|
||||
|
||||
|
@ -135,11 +136,26 @@ pub fn ResourceTask() -> ResourceTask {
|
|||
}
|
||||
|
||||
fn create_resource_task_with_loaders(loaders: ~[(~str, LoaderTaskFactory)]) -> ResourceTask {
|
||||
let (setup_port, setup_chan) = Chan::new();
|
||||
let mut builder = task::task().named("ResourceManager");
|
||||
builder.spawn(proc() {
|
||||
let (port, chan) = Chan::new();
|
||||
setup_chan.send(chan);
|
||||
ResourceManager(port, loaders).start();
|
||||
});
|
||||
setup_port.recv()
|
||||
|
||||
// FIXME: code cloned from spawn_listener due to:
|
||||
// error: internal compiler error: cannot relate bound region: ReLateBound(6270, BrNamed(syntax::ast::DefId{krate: 0u32, node: 6294u32}, a)) <= ReInfer(1)
|
||||
//This message reflects a bug in the Rust compiler.
|
||||
|
||||
/*
|
||||
let chan = spawn_listener("ResourceManager", proc(from_client) {
|
||||
// TODO: change copy to move once we can move out of closures
|
||||
ResourceManager(from_client, loaders).start()
|
||||
});
|
||||
chan
|
||||
*/
|
||||
}
|
||||
|
||||
pub struct ResourceManager {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue