mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Constellation: removed almost all opts::get
This commit is contained in:
parent
3a2705f587
commit
cd153efb4a
6 changed files with 53 additions and 23 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -679,6 +679,7 @@ dependencies = [
|
||||||
"script_traits 0.0.1",
|
"script_traits 0.0.1",
|
||||||
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"servo_config 0.0.1",
|
"servo_config 0.0.1",
|
||||||
|
"servo_geometry 0.0.1",
|
||||||
"servo_rand 0.0.1",
|
"servo_rand 0.0.1",
|
||||||
"servo_remutex 0.0.1",
|
"servo_remutex 0.0.1",
|
||||||
"servo_url 0.0.1",
|
"servo_url 0.0.1",
|
||||||
|
|
|
@ -80,6 +80,7 @@ pub struct Opts {
|
||||||
/// Use ANGLE to create the GL context (Windows-only).
|
/// Use ANGLE to create the GL context (Windows-only).
|
||||||
pub angle: bool,
|
pub angle: bool,
|
||||||
|
|
||||||
|
/// True to exit on thread failure instead of displaying about:failure.
|
||||||
pub hard_fail: bool,
|
pub hard_fail: bool,
|
||||||
|
|
||||||
/// True if we should bubble intrinsic widths sequentially (`-b`). If this is true, then
|
/// True if we should bubble intrinsic widths sequentially (`-b`). If this is true, then
|
||||||
|
|
|
@ -43,6 +43,7 @@ script_traits = {path = "../script_traits"}
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
style_traits = {path = "../style_traits"}
|
style_traits = {path = "../style_traits"}
|
||||||
servo_config = {path = "../config"}
|
servo_config = {path = "../config"}
|
||||||
|
servo_geometry = {path = "../geometry"}
|
||||||
servo_rand = {path = "../rand"}
|
servo_rand = {path = "../rand"}
|
||||||
servo_remutex = {path = "../remutex"}
|
servo_remutex = {path = "../remutex"}
|
||||||
servo_url = {path = "../url"}
|
servo_url = {path = "../url"}
|
||||||
|
|
|
@ -153,6 +153,7 @@ use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, Scri
|
||||||
use script_traits::{SWManagerMsg, ScopeThings, UpdatePipelineIdReason, WebDriverCommandMsg};
|
use script_traits::{SWManagerMsg, ScopeThings, UpdatePipelineIdReason, WebDriverCommandMsg};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use servo_config::{opts, pref};
|
use servo_config::{opts, pref};
|
||||||
|
use servo_geometry::DeviceIndependentPixel;
|
||||||
use servo_rand::{random, Rng, SeedableRng, ServoRng};
|
use servo_rand::{random, Rng, SeedableRng, ServoRng};
|
||||||
use servo_remutex::ReentrantMutex;
|
use servo_remutex::ReentrantMutex;
|
||||||
use servo_url::{Host, ImmutableOrigin, ServoUrl};
|
use servo_url::{Host, ImmutableOrigin, ServoUrl};
|
||||||
|
@ -379,6 +380,17 @@ pub struct Constellation<Message, LTF, STF> {
|
||||||
/// Bitmask which indicates which combination of mouse buttons are
|
/// Bitmask which indicates which combination of mouse buttons are
|
||||||
/// currently being pressed.
|
/// currently being pressed.
|
||||||
pressed_mouse_buttons: u16,
|
pressed_mouse_buttons: u16,
|
||||||
|
|
||||||
|
is_running_problem_test: bool,
|
||||||
|
|
||||||
|
/// If True, exits on thread failure instead of displaying about:failure
|
||||||
|
hard_fail: bool,
|
||||||
|
|
||||||
|
/// If set with --disable-canvas-aa, disable antialiasing on the HTML
|
||||||
|
/// canvas element.
|
||||||
|
/// Like --disable-text-aa, this is useful for reftests where pixel perfect
|
||||||
|
/// results are required.
|
||||||
|
enable_canvas_antialiasing: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// State needed to construct a constellation.
|
/// State needed to construct a constellation.
|
||||||
|
@ -599,6 +611,13 @@ where
|
||||||
/// Create a new constellation thread.
|
/// Create a new constellation thread.
|
||||||
pub fn start(
|
pub fn start(
|
||||||
state: InitialConstellationState,
|
state: InitialConstellationState,
|
||||||
|
initial_window_size: TypedSize2D<u32, DeviceIndependentPixel>,
|
||||||
|
device_pixels_per_px: Option<f32>,
|
||||||
|
random_pipeline_closure_probability: Option<f32>,
|
||||||
|
random_pipeline_closure_seed: Option<usize>,
|
||||||
|
is_running_problem_test: bool,
|
||||||
|
hard_fail: bool,
|
||||||
|
enable_canvas_antialiasing: bool,
|
||||||
) -> (Sender<FromCompositorMsg>, IpcSender<SWManagerMsg>) {
|
) -> (Sender<FromCompositorMsg>, IpcSender<SWManagerMsg>) {
|
||||||
let (compositor_sender, compositor_receiver) = unbounded();
|
let (compositor_sender, compositor_receiver) = unbounded();
|
||||||
|
|
||||||
|
@ -685,11 +704,8 @@ where
|
||||||
time_profiler_chan: state.time_profiler_chan,
|
time_profiler_chan: state.time_profiler_chan,
|
||||||
mem_profiler_chan: state.mem_profiler_chan,
|
mem_profiler_chan: state.mem_profiler_chan,
|
||||||
window_size: WindowSizeData {
|
window_size: WindowSizeData {
|
||||||
initial_viewport: opts::get().initial_window_size.to_f32() *
|
initial_viewport: initial_window_size.to_f32() * TypedScale::new(1.0),
|
||||||
TypedScale::new(1.0),
|
device_pixel_ratio: TypedScale::new(device_pixels_per_px.unwrap_or(1.0)),
|
||||||
device_pixel_ratio: TypedScale::new(
|
|
||||||
opts::get().device_pixels_per_px.unwrap_or(1.0),
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
clipboard_ctx: match ClipboardContext::new() {
|
clipboard_ctx: match ClipboardContext::new() {
|
||||||
|
@ -706,22 +722,21 @@ where
|
||||||
webrender_api_sender: state.webrender_api_sender,
|
webrender_api_sender: state.webrender_api_sender,
|
||||||
shutting_down: false,
|
shutting_down: false,
|
||||||
handled_warnings: VecDeque::new(),
|
handled_warnings: VecDeque::new(),
|
||||||
random_pipeline_closure: opts::get().random_pipeline_closure_probability.map(
|
random_pipeline_closure: random_pipeline_closure_probability.map(|prob| {
|
||||||
|prob| {
|
let seed = random_pipeline_closure_seed.unwrap_or_else(random);
|
||||||
let seed = opts::get()
|
let rng = ServoRng::from_seed(&[seed]);
|
||||||
.random_pipeline_closure_seed
|
warn!("Randomly closing pipelines.");
|
||||||
.unwrap_or_else(random);
|
info!("Using seed {} for random pipeline closure.", seed);
|
||||||
let rng = ServoRng::from_seed(&[seed]);
|
(rng, prob)
|
||||||
warn!("Randomly closing pipelines.");
|
}),
|
||||||
info!("Using seed {} for random pipeline closure.", seed);
|
|
||||||
(rng, prob)
|
|
||||||
},
|
|
||||||
),
|
|
||||||
webgl_threads: state.webgl_threads,
|
webgl_threads: state.webgl_threads,
|
||||||
webvr_chan: state.webvr_chan,
|
webvr_chan: state.webvr_chan,
|
||||||
canvas_chan: CanvasPaintThread::start(),
|
canvas_chan: CanvasPaintThread::start(),
|
||||||
pending_approval_navigations: HashMap::new(),
|
pending_approval_navigations: HashMap::new(),
|
||||||
pressed_mouse_buttons: 0,
|
pressed_mouse_buttons: 0,
|
||||||
|
is_running_problem_test,
|
||||||
|
hard_fail,
|
||||||
|
enable_canvas_antialiasing,
|
||||||
};
|
};
|
||||||
|
|
||||||
constellation.run();
|
constellation.run();
|
||||||
|
@ -1165,13 +1180,13 @@ where
|
||||||
FromCompositorMsg::IsReadyToSaveImage(pipeline_states) => {
|
FromCompositorMsg::IsReadyToSaveImage(pipeline_states) => {
|
||||||
let is_ready = self.handle_is_ready_to_save_image(pipeline_states);
|
let is_ready = self.handle_is_ready_to_save_image(pipeline_states);
|
||||||
debug!("Ready to save image {:?}.", is_ready);
|
debug!("Ready to save image {:?}.", is_ready);
|
||||||
if opts::get().is_running_problem_test {
|
if self.is_running_problem_test {
|
||||||
println!("got ready to save image query, result is {:?}", is_ready);
|
println!("got ready to save image query, result is {:?}", is_ready);
|
||||||
}
|
}
|
||||||
let is_ready = is_ready == ReadyToSave::Ready;
|
let is_ready = is_ready == ReadyToSave::Ready;
|
||||||
self.compositor_proxy
|
self.compositor_proxy
|
||||||
.send(ToCompositorMsg::IsReadyToSaveImageReply(is_ready));
|
.send(ToCompositorMsg::IsReadyToSaveImageReply(is_ready));
|
||||||
if opts::get().is_running_problem_test {
|
if self.is_running_problem_test {
|
||||||
println!("sent response");
|
println!("sent response");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1694,7 +1709,7 @@ where
|
||||||
reason: String,
|
reason: String,
|
||||||
backtrace: Option<String>,
|
backtrace: Option<String>,
|
||||||
) {
|
) {
|
||||||
if opts::get().hard_fail {
|
if self.hard_fail {
|
||||||
// It's quite difficult to make Servo exit cleanly if some threads have failed.
|
// It's quite difficult to make Servo exit cleanly if some threads have failed.
|
||||||
// Hard fail exists for test runners so we crash and that's good enough.
|
// Hard fail exists for test runners so we crash and that's good enough.
|
||||||
println!("Pipeline failed in hard-fail mode. Crashing!");
|
println!("Pipeline failed in hard-fail mode. Crashing!");
|
||||||
|
@ -3155,7 +3170,7 @@ where
|
||||||
canvas_id_sender,
|
canvas_id_sender,
|
||||||
size,
|
size,
|
||||||
webrender_api,
|
webrender_api,
|
||||||
opts::get().enable_canvas_antialiasing,
|
self.enable_canvas_antialiasing,
|
||||||
)) {
|
)) {
|
||||||
return warn!("Create canvas paint thread failed ({})", e);
|
return warn!("Create canvas paint thread failed ({})", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -646,7 +646,7 @@ impl UnprivilegedPipelineContent {
|
||||||
.expect("Failed to create IPC one-shot server.");
|
.expect("Failed to create IPC one-shot server.");
|
||||||
|
|
||||||
// If there is a sandbox, use the `gaol` API to create the child process.
|
// If there is a sandbox, use the `gaol` API to create the child process.
|
||||||
if opts::get().sandbox {
|
if self.opts.sandbox {
|
||||||
let mut command = sandbox::Command::me().expect("Failed to get current sandbox.");
|
let mut command = sandbox::Command::me().expect("Failed to get current sandbox.");
|
||||||
self.setup_common(&mut command, token);
|
self.setup_common(&mut command, token);
|
||||||
|
|
||||||
|
|
|
@ -617,6 +617,9 @@ fn create_constellation(
|
||||||
window_gl: Rc<dyn gl::Gl>,
|
window_gl: Rc<dyn gl::Gl>,
|
||||||
webvr_services: Option<VRServiceManager>,
|
webvr_services: Option<VRServiceManager>,
|
||||||
) -> (Sender<ConstellationMsg>, SWManagerSenders) {
|
) -> (Sender<ConstellationMsg>, SWManagerSenders) {
|
||||||
|
// Global configuration options, parsed from the command line.
|
||||||
|
let opts = opts::get();
|
||||||
|
|
||||||
let bluetooth_thread: IpcSender<BluetoothRequest> =
|
let bluetooth_thread: IpcSender<BluetoothRequest> =
|
||||||
BluetoothThreadFactory::new(embedder_proxy.clone());
|
BluetoothThreadFactory::new(embedder_proxy.clone());
|
||||||
|
|
||||||
|
@ -651,7 +654,7 @@ fn create_constellation(
|
||||||
};
|
};
|
||||||
|
|
||||||
// GLContext factory used to create WebGL Contexts
|
// GLContext factory used to create WebGL Contexts
|
||||||
let gl_factory = if opts::get().should_use_osmesa() {
|
let gl_factory = if opts.should_use_osmesa() {
|
||||||
GLContextFactory::current_osmesa_handle()
|
GLContextFactory::current_osmesa_handle()
|
||||||
} else {
|
} else {
|
||||||
GLContextFactory::current_native_handle(&compositor_proxy)
|
GLContextFactory::current_native_handle(&compositor_proxy)
|
||||||
|
@ -697,7 +700,16 @@ fn create_constellation(
|
||||||
script_layout_interface::message::Msg,
|
script_layout_interface::message::Msg,
|
||||||
layout_thread::LayoutThread,
|
layout_thread::LayoutThread,
|
||||||
script::script_thread::ScriptThread,
|
script::script_thread::ScriptThread,
|
||||||
>::start(initial_state);
|
>::start(
|
||||||
|
initial_state,
|
||||||
|
opts.initial_window_size,
|
||||||
|
opts.device_pixels_per_px,
|
||||||
|
opts.random_pipeline_closure_probability,
|
||||||
|
opts.random_pipeline_closure_seed,
|
||||||
|
opts.is_running_problem_test,
|
||||||
|
opts.hard_fail,
|
||||||
|
opts.enable_canvas_antialiasing,
|
||||||
|
);
|
||||||
|
|
||||||
if let Some(webvr_constellation_sender) = webvr_constellation_sender {
|
if let Some(webvr_constellation_sender) = webvr_constellation_sender {
|
||||||
// Set constellation channel used by WebVR thread to broadcast events
|
// Set constellation channel used by WebVR thread to broadcast events
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue