mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Allow render threads to be specified with -t
This commit is contained in:
parent
95a57dfced
commit
b6c9b65355
2 changed files with 14 additions and 13 deletions
|
@ -281,17 +281,8 @@ impl<C:RenderListener + Send> RenderTask<C> {
|
|||
}
|
||||
|
||||
fn spawn_workers(&mut self, result_tx: Sender<Box<LayerBuffer>>) -> Vec<Sender<WorkerMsg>> {
|
||||
// FIXME (rust/14707): This still isn't exposed publicly via std::rt??
|
||||
// FIXME (rust/14704): Terrible name for this lint, which here is allowing
|
||||
// Rust types, not C types
|
||||
#[allow(ctypes)]
|
||||
extern {
|
||||
fn rust_get_num_cpus() -> uint;
|
||||
}
|
||||
|
||||
let num_workers = unsafe { rust_get_num_cpus() as uint };
|
||||
let mut worker_chans = vec![];
|
||||
for render_idx in range(0, num_workers) {
|
||||
for render_idx in range(0, self.opts.n_render_threads) {
|
||||
let (tx, rx) = channel();
|
||||
let result_tx = result_tx.clone();
|
||||
|
||||
|
|
|
@ -83,10 +83,10 @@ pub fn from_cmdline_args(args: &[String]) -> Option<Opts> {
|
|||
getopts::optopt("r", "rendering", "Rendering backend", "direct2d|core-graphics|core-graphics-accelerated|cairo|skia."),
|
||||
getopts::optopt("s", "size", "Size of tiles", "512"),
|
||||
getopts::optopt("", "device-pixel-ratio", "Device pixels per px", ""),
|
||||
getopts::optopt("t", "threads", "Number of render threads", "1"),
|
||||
getopts::optflagopt("p", "profile", "Profiler flag and output interval", "10"),
|
||||
getopts::optflag("x", "exit", "Exit after load flag"),
|
||||
getopts::optopt("y", "layout-threads", "Number of threads to use for layout", "1"),
|
||||
getopts::optopt("t", "threads", "Number of render threads", "[n-cores]"),
|
||||
getopts::optopt("y", "layout-threads", "Number of layout threads", "1"),
|
||||
getopts::optflag("z", "headless", "Headless mode"),
|
||||
getopts::optflag("f", "hard-fail", "Exit on task failure instead of displaying about:failure"),
|
||||
getopts::optflag("b", "bubble-widths", "Bubble intrinsic widths separately like other engines"),
|
||||
|
@ -144,7 +144,17 @@ pub fn from_cmdline_args(args: &[String]) -> Option<Opts> {
|
|||
|
||||
let n_render_threads: uint = match opt_match.opt_str("t") {
|
||||
Some(n_render_threads_str) => from_str(n_render_threads_str.as_slice()).unwrap(),
|
||||
None => 1, // FIXME: Number of cores.
|
||||
None => {
|
||||
// FIXME (rust/14707): This still isn't exposed publicly via std::rt??
|
||||
// FIXME (rust/14704): Terrible name for this lint, which here is allowing
|
||||
// Rust types, not C types
|
||||
#[allow(ctypes)]
|
||||
extern {
|
||||
fn rust_get_num_cpus() -> uint;
|
||||
}
|
||||
|
||||
unsafe { rust_get_num_cpus() as uint }
|
||||
}
|
||||
};
|
||||
|
||||
// if only flag is present, default to 5 second period
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue