Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion components/compositing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,13 @@ git = "https://github.com/pcwalton/ipc-channel"
git = "https://github.com/ecoal95/rust-offscreen-rendering-context"
features = ["texture_surface"]

[dependencies.url]
version = "0.2"
features = [ "serde_serialization" ]

[dependencies]
log = "0.3"
num = "0.1.24"
url = "0.2.36"
time = "0.1.17"
libc = "0.1"
gleam = "0.1"
Expand All @@ -80,3 +83,4 @@ core-graphics = "0.1"

[target.x86_64-apple-darwin.dependencies.core-text]
git = "https://github.com/servo/core-text-rs"

5 changes: 4 additions & 1 deletion components/gfx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ path = "../script_traits"
[dependencies.ipc-channel]
git = "https://github.com/pcwalton/ipc-channel"

[dependencies.url]
version = "0.2"
features = [ "serde_serialization" ]

[dependencies]
log = "0.3"
fnv = "1.0"
url = "0.2.36"
time = "0.1.12"
bitflags = "0.3"
rustc-serialize = "0.3"
Expand Down
5 changes: 4 additions & 1 deletion components/layout/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ features = [ "serde-serialization" ]
[dependencies.ipc-channel]
git = "https://github.com/pcwalton/ipc-channel"

[dependencies.url]
version = "0.2"
features = [ "serde_serialization" ]

[dependencies]
log = "0.3"
encoding = "0.2"
fnv = "1.0"
url = "0.2.36"
bitflags = "0.3"
rustc-serialize = "0.3"
libc = "0.1"
Expand Down
5 changes: 4 additions & 1 deletion components/layout_traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ path = "../util"
[dependencies.ipc-channel]
git = "https://github.com/pcwalton/ipc-channel"

[dependencies.url]
version = "0.2"
features = [ "serde_serialization" ]

[dependencies]
url = "0.2.36"
euclid = "0.1"
serde = "0.4"
serde_macros = "0.4"
Expand Down
6 changes: 5 additions & 1 deletion components/net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ features = [ "serde-serialization" ]
[dependencies.ipc-channel]
git = "https://github.com/pcwalton/ipc-channel"

[dependencies.url]
version = "0.2"
features = [ "serde_serialization" ]

[dependencies]
log = "0.3"
url = "0.2.36"
time = "0.1.17"
openssl="0.6.1"
rustc-serialize = "0.3"
Expand All @@ -39,3 +42,4 @@ regex_macros = "0.1.8"
flate2 = "0.2.0"
uuid = "0.1.16"
euclid = "0.1"

3 changes: 2 additions & 1 deletion components/net/about_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ pub fn factory(mut load_data: LoadData, start_chan: LoadConsumer, classifier: Ar
}
_ => {
start_sending(start_chan, Metadata::default(load_data.url))
.send(Done(Err("Unknown about: URL.".to_string()))).unwrap();
.send(Done(Err("Unknown about: URL.".to_string())))
.unwrap();
return
}
};
Expand Down
7 changes: 4 additions & 3 deletions components/net/data_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ pub fn load(load_data: LoadData, start_chan: LoadConsumer) {
_ => panic!("Expected a non-relative scheme URL.")
};
match url.query {
Some(query) => {
Some(ref query) => {
scheme_data.push_str("?");
scheme_data.push_str(&query);
scheme_data.push_str(query);
},
None => ()
}
let parts: Vec<&str> = scheme_data.splitn(2, ',').collect();
if parts.len() != 2 {
start_sending(start_chan, metadata).send(Done(Err("invalid data uri".to_string()))).unwrap();
start_sending(start_chan,
metadata).send(Done(Err("invalid data uri".to_string()))).unwrap();
return;
}

Expand Down
12 changes: 8 additions & 4 deletions components/net/http_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use mime_classifier::MIMEClassifier;
use resource_task::{start_sending_opt, start_sending_sniffed_opt};
use hsts::{HSTSList, secure_url};

use ipc_channel::ipc::{self, IpcSender};
use log;
use std::collections::HashSet;
use file_loader;
Expand Down Expand Up @@ -36,7 +37,7 @@ use uuid;
use std::borrow::ToOwned;
use std::boxed::FnBox;

pub fn factory(cookies_chan: Sender<ControlMsg>,
pub fn factory(cookies_chan: IpcSender<ControlMsg>,
devtools_chan: Option<Sender<DevtoolsControlMsg>>,
hsts_list: Arc<Mutex<HSTSList>>)
-> Box<FnBox(LoadData, LoadConsumer, Arc<MIMEClassifier>) + Send> {
Expand Down Expand Up @@ -86,7 +87,7 @@ fn request_must_be_secured(hsts_list: &HSTSList, url: &Url) -> bool {
fn load(mut load_data: LoadData,
start_chan: LoadConsumer,
classifier: Arc<MIMEClassifier>,
cookies_chan: Sender<ControlMsg>,
cookies_chan: IpcSender<ControlMsg>,
devtools_chan: Option<Sender<DevtoolsControlMsg>>,
hsts_list: Arc<Mutex<HSTSList>>) {
// FIXME: At the time of writing this FIXME, servo didn't have any central
Expand Down Expand Up @@ -153,6 +154,7 @@ reason: \"certificate verify failed\" }]))";
Request::with_connector(load_data.method.clone(), url.clone(),
&HttpsConnector::new(Openssl { context: Arc::new(context) }))
};

let mut req = match req {
Ok(req) => req,
Err(HttpError::Io(ref io_error)) if (
Expand Down Expand Up @@ -201,8 +203,10 @@ reason: \"certificate verify failed\" }]))";
req.headers_mut().set(accept);
}

let (tx, rx) = channel();
cookies_chan.send(ControlMsg::GetCookiesForUrl(url.clone(), tx, CookieSource::HTTP)).unwrap();
let (tx, rx) = ipc::channel().unwrap();
cookies_chan.send(ControlMsg::GetCookiesForUrl(url.clone(),
tx,
CookieSource::HTTP)).unwrap();
if let Some(cookie_list) = rx.recv().unwrap() {
let mut v = Vec::new();
v.push(cookie_list.into_bytes());
Expand Down
31 changes: 13 additions & 18 deletions components/net/image_cache_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,6 @@ struct ResourceLoadInfo {
url: Url,
}

struct ResourceListener {
url: Url,
sender: Sender<ResourceLoadInfo>,
}

impl AsyncResponseTarget for ResourceListener {
fn invoke_with_listener(&self, action: ResponseAction) {
self.sender.send(ResourceLoadInfo {
action: action,
url: self.url.clone(),
}).unwrap();
}
}

/// Implementation of the image cache
struct ImageCache {
// Receive commands from clients
Expand Down Expand Up @@ -330,11 +316,20 @@ impl ImageCache {
e.insert(pending_load);

let load_data = LoadData::new(url.clone(), None);
let listener = box ResourceListener {
url: url,
sender: self.progress_sender.clone(),
let (action_sender, action_receiver) = ipc::channel().unwrap();
let response_target = AsyncResponseTarget {
sender: action_sender,
};
let msg = ControlMsg::Load(load_data, LoadConsumer::Listener(listener));
let msg = ControlMsg::Load(load_data,
LoadConsumer::Listener(response_target));
let progress_sender = self.progress_sender.clone();
ROUTER.add_route(action_receiver.to_opaque(), box move |message| {
let action: ResponseAction = message.to().unwrap();
progress_sender.send(ResourceLoadInfo {
action: action,
url: url.clone(),
}).unwrap();
});
self.resource_task.send(msg).unwrap();
}
}
Expand Down
30 changes: 15 additions & 15 deletions components/net/resource_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use cookie_storage::CookieStorage;
use cookie;
use mime_classifier::MIMEClassifier;

use net_traits::{ControlMsg, LoadData, LoadResponse, LoadConsumer};
use net_traits::{Metadata, ProgressMsg, ResourceTask, AsyncResponseTarget, ResponseAction, CookieSource};
use net_traits::{ControlMsg, LoadData, LoadResponse, LoadConsumer, CookieSource};
use net_traits::{Metadata, ProgressMsg, ResourceTask, AsyncResponseTarget, ResponseAction};
use net_traits::ProgressMsg::Done;
use util::opts;
use util::task::spawn_named;
Expand All @@ -24,6 +24,7 @@ use hsts::{HSTSList, HSTSEntry, preload_hsts_domains};
use devtools_traits::{DevtoolsControlMsg};
use hyper::header::{ContentType, Header, SetCookie, UserAgent};
use hyper::mime::{Mime, TopLevel, SubLevel};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};

use regex::Regex;
use std::borrow::ToOwned;
Expand All @@ -34,7 +35,7 @@ use std::fs::File;
use std::io::{BufReader, Read};
use std::sync::Arc;
use std::sync::Mutex;
use std::sync::mpsc::{channel, Receiver, Sender};
use std::sync::mpsc::{channel, Sender};

static mut HOST_TABLE: Option<*mut HashMap<String, String>> = None;
pub static IPV4_REGEX: Regex = regex!(
Expand Down Expand Up @@ -67,8 +68,8 @@ pub fn global_init() {
}

pub enum ProgressSender {
Channel(Sender<ProgressMsg>),
Listener(Box<AsyncResponseTarget>),
Channel(IpcSender<ProgressMsg>),
Listener(AsyncResponseTarget),
}

impl ProgressSender {
Expand Down Expand Up @@ -124,7 +125,8 @@ pub fn start_sending_sniffed_opt(start_chan: LoadConsumer, mut metadata: Metadat
}
}

let supplied_type = metadata.content_type.map(|ContentType(Mime(toplevel, sublevel, _))| {
let supplied_type =
metadata.content_type.map(|ContentType(Mime(toplevel, sublevel, _))| {
(format!("{}", toplevel), format!("{}", sublevel))
});
metadata.content_type = classifier.classify(nosniff, check_for_apache_bug, &supplied_type,
Expand All @@ -143,7 +145,7 @@ pub fn start_sending_sniffed_opt(start_chan: LoadConsumer, mut metadata: Metadat
pub fn start_sending_opt(start_chan: LoadConsumer, metadata: Metadata) -> Result<ProgressSender, ()> {
match start_chan {
LoadConsumer::Channel(start_chan) => {
let (progress_chan, progress_port) = channel();
let (progress_chan, progress_port) = ipc::channel().unwrap();
let result = start_chan.send(LoadResponse {
metadata: metadata,
progress_port: progress_port,
Expand All @@ -168,7 +170,7 @@ pub fn new_resource_task(user_agent: Option<String>,
None => HSTSList::new()
};

let (setup_chan, setup_port) = channel();
let (setup_chan, setup_port) = ipc::channel().unwrap();
let setup_chan_clone = setup_chan.clone();
spawn_named("ResourceManager".to_owned(), move || {
let resource_manager = ResourceManager::new(
Expand Down Expand Up @@ -218,7 +220,7 @@ pub fn replace_hosts(mut load_data: LoadData, host_table: *mut HashMap<String, S
}

struct ResourceChannelManager {
from_client: Receiver<ControlMsg>,
from_client: IpcReceiver<ControlMsg>,
resource_manager: ResourceManager
}

Expand Down Expand Up @@ -251,18 +253,17 @@ impl ResourceChannelManager {
pub struct ResourceManager {
user_agent: Option<String>,
cookie_storage: CookieStorage,
// TODO: Can this be de-coupled?
resource_task: Sender<ControlMsg>,
resource_task: IpcSender<ControlMsg>,
mime_classifier: Arc<MIMEClassifier>,
devtools_chan: Option<Sender<DevtoolsControlMsg>>,
hsts_list: Arc<Mutex<HSTSList>>
}

impl ResourceManager {
pub fn new(user_agent: Option<String>,
resource_task: Sender<ControlMsg>,
hsts_list: HSTSList,
devtools_channel: Option<Sender<DevtoolsControlMsg>>) -> ResourceManager {
resource_task: IpcSender<ControlMsg>,
hsts_list: HSTSList,
devtools_channel: Option<Sender<DevtoolsControlMsg>>) -> ResourceManager {
ResourceManager {
user_agent: user_agent,
cookie_storage: CookieStorage::new(),
Expand All @@ -274,7 +275,6 @@ impl ResourceManager {
}
}


impl ResourceManager {
fn set_cookies_for_url(&mut self, request: Url, cookie_list: String, source: CookieSource) {
let header = Header::parse_header(&[cookie_list.into_bytes()]);
Expand Down
8 changes: 4 additions & 4 deletions components/net_traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ git = "https://github.com/servo/rust-stb-image"
version = "0.6"
features = [ "serde-serialization" ]

[dependencies.url]
version = "0.2.36"
features = [ "serde_serialization" ]

[dependencies.ipc-channel]
git = "https://github.com/pcwalton/ipc-channel"

[dependencies.url]
version = "0.2"
features = [ "serde_serialization" ]

[dependencies]
log = "0.3"
euclid = "0.1"
Expand Down
Loading