aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-03-29 05:49:01 -0600
committerbors-servo <metajack+bors@gmail.com>2015-03-29 05:49:01 -0600
commit0d3574b583d1c6b4bd591c8174918829a1c559c2 (patch)
treec760098213bd9f3ce510e0ba60504375bcb2aa50
parent1282850b998ce82195a7099d950676fc1b53b86b (diff)
parent88b31933c405c65d5b832bb78939a725770dbeca (diff)
downloadservo-0d3574b583d1c6b4bd591c8174918829a1c559c2.tar.gz
servo-0d3574b583d1c6b4bd591c8174918829a1c559c2.zip
auto merge of #5442 : servo/servo/fix-more-gonk-warnings, r=Ms2ger
-rw-r--r--ports/gonk/src/input.rs4
-rw-r--r--ports/gonk/src/lib.rs94
-rw-r--r--ports/gonk/src/main.rs4
3 files changed, 44 insertions, 58 deletions
diff --git a/ports/gonk/src/input.rs b/ports/gonk/src/input.rs
index a7ae4423633..44640316f3d 100644
--- a/ports/gonk/src/input.rs
+++ b/ports/gonk/src/input.rs
@@ -10,7 +10,7 @@ use std::os::errno;
use std::os::unix::AsRawFd;
use std::num::Float;
use std::fs::File;
-use std::thread::Thread;
+use std::thread;
use std::sync::mpsc::Sender;
use std::io::Read;
@@ -238,7 +238,7 @@ fn read_input_device(device_path: &Path,
pub fn run_input_loop(event_sender: &Sender<WindowEvent>) {
let sender = event_sender.clone();
- Thread::spawn(move || {
+ thread::spawn(move || {
// XXX need to scan all devices and read every one.
let touchinputdev = Path::new("/dev/input/event0");
read_input_device(&touchinputdev, &sender);
diff --git a/ports/gonk/src/lib.rs b/ports/gonk/src/lib.rs
index 42df54669a2..46c12ef0cba 100644
--- a/ports/gonk/src/lib.rs
+++ b/ports/gonk/src/lib.rs
@@ -5,7 +5,7 @@
#![feature(thread_local)]
#![feature(box_syntax)]
#![feature(int_uint)]
-#![feature(core, path, rustc_private)]
+#![feature(path, rustc_private)]
// For FFI
#![allow(non_snake_case, dead_code)]
@@ -58,10 +58,6 @@ use util::taskpool::TaskPool;
use std::env;
#[cfg(not(test))]
use std::rc::Rc;
-#[cfg(not(test))]
-use std::thread::Builder;
-#[cfg(not(test))]
-use std::sync::mpsc::channel;
pub struct Browser {
compositor: Box<CompositorEventListener + 'static>,
@@ -85,59 +81,45 @@ impl Browser {
devtools::start_server(port)
});
- let opts_clone = opts.clone();
- let time_profiler_chan_clone = time_profiler_chan.clone();
- let mem_profiler_chan_clone = mem_profiler_chan.clone();
-
- let (result_chan, result_port) = channel();
- let compositor_proxy_for_constellation = compositor_proxy.clone_compositor_proxy();
- Builder::new()
- .spawn(move || {
- let opts = &opts_clone;
- // Create a Servo instance.
- let resource_task = new_resource_task(opts.user_agent.clone());
- // If we are emitting an output file, then we need to block on
- // image load or we risk emitting an output file missing the
- // image.
- let image_cache_task = if opts.output_file.is_some() {
- ImageCacheTask::new_sync(resource_task.clone(), shared_task_pool,
- time_profiler_chan_clone.clone())
- } else {
- ImageCacheTask::new(resource_task.clone(), shared_task_pool,
- time_profiler_chan_clone.clone())
+ // Create a Servo instance.
+ let resource_task = new_resource_task(opts.user_agent.clone());
+
+ // If we are emitting an output file, then we need to block on
+ // image load or we risk emitting an output file missing the
+ // image.
+ let image_cache_task = if opts.output_file.is_some() {
+ ImageCacheTask::new_sync(resource_task.clone(), shared_task_pool,
+ time_profiler_chan.clone())
+ } else {
+ ImageCacheTask::new(resource_task.clone(), shared_task_pool,
+ time_profiler_chan.clone())
+ };
+ let font_cache_task = FontCacheTask::new(resource_task.clone());
+ let storage_task = StorageTaskFactory::new();
+ let constellation_chan = Constellation::<layout::layout_task::LayoutTask,
+ script::script_task::ScriptTask>::start(
+ compositor_proxy.clone_compositor_proxy(),
+ resource_task,
+ image_cache_task,
+ font_cache_task,
+ time_profiler_chan.clone(),
+ mem_profiler_chan.clone(),
+ devtools_chan,
+ storage_task);
+
+ // Send the URL command to the constellation.
+ let cwd = env::current_dir().unwrap();
+ for url in opts.urls.iter() {
+ let url = match url::Url::parse(&*url) {
+ Ok(url) => url,
+ Err(url::ParseError::RelativeUrlWithoutBase)
+ => url::Url::from_file_path(&*cwd.join(&*url)).unwrap(),
+ Err(_) => panic!("URL parsing failed"),
};
- let font_cache_task = FontCacheTask::new(resource_task.clone());
- let storage_task = StorageTaskFactory::new();
- let constellation_chan = Constellation::<layout::layout_task::LayoutTask,
- script::script_task::ScriptTask>::start(
- compositor_proxy_for_constellation,
- resource_task,
- image_cache_task,
- font_cache_task,
- time_profiler_chan_clone,
- mem_profiler_chan_clone,
- devtools_chan,
- storage_task);
-
- // Send the URL command to the constellation.
- let cwd = env::current_dir().unwrap();
- for url in opts.urls.iter() {
- let url = match url::Url::parse(url.as_slice()) {
- Ok(url) => url,
- Err(url::ParseError::RelativeUrlWithoutBase)
- => url::Url::from_file_path(&*cwd.join(url.as_slice())).unwrap(),
- Err(_) => panic!("URL parsing failed"),
- };
-
- let ConstellationChan(ref chan) = constellation_chan;
- chan.send(ConstellationMsg::InitLoadUrl(url)).ok().unwrap();
- }
-
- // Send the constallation Chan as the result
- result_chan.send(constellation_chan).ok().unwrap();
- });
- let constellation_chan = result_port.recv().unwrap();
+ let ConstellationChan(ref chan) = constellation_chan;
+ chan.send(ConstellationMsg::InitLoadUrl(url)).unwrap();
+ }
debug!("preparing to enter main loop");
let compositor = CompositorTask::create(window,
diff --git a/ports/gonk/src/main.rs b/ports/gonk/src/main.rs
index 4a50c729018..82379345fa1 100644
--- a/ports/gonk/src/main.rs
+++ b/ports/gonk/src/main.rs
@@ -23,8 +23,10 @@ extern crate gleam;
extern crate layers;
extern crate egl;
extern crate url;
+extern crate net;
use util::opts;
+use net::resource_task;
use servo::Browser;
use compositing::windowing::WindowEvent;
@@ -39,6 +41,8 @@ struct BrowserWrapper {
fn main() {
if opts::from_cmdline_args(env::args().collect::<Vec<_>>().as_slice()) {
+ resource_task::global_init();
+
let window = if opts::get().headless {
None
} else {