mirror of
https://github.com/servo/servo.git
synced 2025-08-09 15:35:34 +01:00
Add exit_after_load flag to options, and make them cloneable.
This commit is contained in:
parent
f363c09f41
commit
2f0a792165
1 changed files with 6 additions and 0 deletions
|
@ -12,12 +12,14 @@ use std::float;
|
||||||
use std::result;
|
use std::result;
|
||||||
use std::uint;
|
use std::uint;
|
||||||
|
|
||||||
|
#[deriving(Clone)]
|
||||||
pub struct Opts {
|
pub struct Opts {
|
||||||
urls: ~[~str],
|
urls: ~[~str],
|
||||||
render_backend: BackendType,
|
render_backend: BackendType,
|
||||||
n_render_threads: uint,
|
n_render_threads: uint,
|
||||||
tile_size: uint,
|
tile_size: uint,
|
||||||
profiler_period: Option<float>,
|
profiler_period: Option<float>,
|
||||||
|
exit_after_load: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_implicitly_copyable_typarams)]
|
#[allow(non_implicitly_copyable_typarams)]
|
||||||
|
@ -32,6 +34,7 @@ pub fn from_cmdline_args(args: &[~str]) -> Opts {
|
||||||
getopts::optopt("s"), // size of tiles
|
getopts::optopt("s"), // size of tiles
|
||||||
getopts::optopt("t"), // threads to render with
|
getopts::optopt("t"), // threads to render with
|
||||||
getopts::optflagopt("p"), // profiler flag and output interval
|
getopts::optflagopt("p"), // profiler flag and output interval
|
||||||
|
getopts::optflag("x"), // exit after load flag
|
||||||
];
|
];
|
||||||
|
|
||||||
let opt_match = match getopts::getopts(args, opts) {
|
let opt_match = match getopts::getopts(args, opts) {
|
||||||
|
@ -85,11 +88,14 @@ pub fn from_cmdline_args(args: &[~str]) -> Opts {
|
||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let exit_after_load = getopts::opt_present(&opt_match, "x");
|
||||||
|
|
||||||
Opts {
|
Opts {
|
||||||
urls: urls,
|
urls: urls,
|
||||||
render_backend: render_backend,
|
render_backend: render_backend,
|
||||||
n_render_threads: n_render_threads,
|
n_render_threads: n_render_threads,
|
||||||
tile_size: tile_size,
|
tile_size: tile_size,
|
||||||
profiler_period: profiler_period,
|
profiler_period: profiler_period,
|
||||||
|
exit_after_load: exit_after_load,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue