Correct usage of number of painting threads.

Previously this used the number of layout threads to allocate the
threadpool. This also makes the member name consistent with the rest of
the structure.
This commit is contained in:
Jack Moffitt 2015-02-19 15:57:54 -07:00
parent 923676d443
commit 7acc0619e6
3 changed files with 21 additions and 19 deletions

View file

@ -424,7 +424,7 @@ impl WorkerThreadProxy {
let thread_count = if opts::get().gpu_painting {
1
} else {
opts::get().layout_threads
opts::get().paint_threads
};
(0..thread_count).map(|_| {
let (from_worker_sender, from_worker_receiver) = channel();

View file

@ -27,8 +27,8 @@ pub struct Opts {
/// How many threads to use for CPU painting (`-t`).
///
/// FIXME(pcwalton): This is not currently used. All painting is sequential.
pub n_paint_threads: uint,
/// Note that painting is sequentialized when using GPU painting.
pub paint_threads: uint,
/// True to use GPU painting via Skia-GL, false to use CPU painting via Skia (`-g`). Note that
/// compositing is always done on the GPU.
@ -155,7 +155,7 @@ static FORCE_CPU_PAINTING: bool = false;
pub fn default_opts() -> Opts {
Opts {
urls: vec!(),
n_paint_threads: 1,
paint_threads: 1,
gpu_painting: false,
tile_size: 512,
device_pixels_per_px: None,
@ -254,9 +254,9 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
ScaleFactor(dppx_str.parse().unwrap())
);
let mut n_paint_threads: uint = match opt_match.opt_str("t") {
Some(n_paint_threads_str) => n_paint_threads_str.parse().unwrap(),
None => 1, // FIXME: Number of cores.
let mut paint_threads: uint = match opt_match.opt_str("t") {
Some(paint_threads_str) => paint_threads_str.parse().unwrap(),
None => cmp::max(rt::default_sched_threads() * 3 / 4, 1),
};
// If only the flag is present, default to a 5 second period for both profilers.
@ -279,7 +279,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
let mut bubble_inline_sizes_separately = debug_options.contains(&"bubble-widths");
let trace_layout = debug_options.contains(&"trace-layout");
if trace_layout {
n_paint_threads = 1;
paint_threads = 1;
layout_threads = 1;
bubble_inline_sizes_separately = true;
}
@ -300,7 +300,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
let opts = Opts {
urls: urls,
n_paint_threads: n_paint_threads,
paint_threads: paint_threads,
gpu_painting: gpu_painting,
tile_size: tile_size,
device_pixels_per_px: device_pixels_per_px,

View file

@ -60,10 +60,20 @@ pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
}
}
let rendering_threads = unsafe {
if ((*settings).rendering_threads as uint) < 1 {
1
} else if (*settings).rendering_threads as uint > MAX_RENDERING_THREADS {
MAX_RENDERING_THREADS
} else {
(*settings).rendering_threads as uint
}
};
let urls = vec![HOME_URL.to_owned()];
opts::set_opts(opts::Opts {
urls: urls,
n_paint_threads: 1,
paint_threads: rendering_threads,
gpu_painting: false,
tile_size: 512,
device_pixels_per_px: None,
@ -71,15 +81,7 @@ pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
memory_profiler_period: None,
enable_experimental: false,
nonincremental_layout: false,
layout_threads: unsafe {
if ((*settings).rendering_threads as uint) < 1 {
1
} else if (*settings).rendering_threads as uint > MAX_RENDERING_THREADS {
MAX_RENDERING_THREADS
} else {
(*settings).rendering_threads as uint
}
},
layout_threads: rendering_threads,
output_file: None,
headless: false,
hard_fail: false,