Make the choice of layout runtime setting

Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Martin Robinson 2023-06-28 10:07:08 +02:00
parent f11c6045e3
commit d31cdb682f
No known key found for this signature in database
GPG key ID: D56AA4FA55EFE6F8
262 changed files with 1740 additions and 3700 deletions

View file

@ -16,8 +16,6 @@ debugmozjs = ["script/debugmozjs"]
googlevr = ["webxr/googlevr"]
jitspew = ["script/jitspew"]
js_backtrace = ["script/js_backtrace"]
layout-2013 = ["layout_thread_2013"]
layout-2020 = ["layout_thread_2020"]
max_log_level = ["log/release_max_level_info"]
media-dummy = ["servo-media-dummy"]
media-gstreamer = ["servo-media-gstreamer", "gstreamer"]
@ -55,8 +53,8 @@ gleam = { workspace = true }
gstreamer = { version = "0.15", features = ["v1_16"], optional = true }
ipc-channel = { workspace = true }
keyboard-types = { workspace = true }
layout_thread_2013 = { path = "../layout_thread", optional = true }
layout_thread_2020 = { path = "../layout_thread_2020", optional = true }
layout_thread_2013 = { path = "../layout_thread" }
layout_thread_2020 = { path = "../layout_thread_2020" }
log = { workspace = true }
media = { path = "../media" }
mozangle = { workspace = true }

View file

@ -8,16 +8,6 @@ use std::path::Path;
use std::process::Command;
fn main() {
let layout_2013 = std::env::var_os("CARGO_FEATURE_LAYOUT_2013").is_some();
let layout_2020 = std::env::var_os("CARGO_FEATURE_LAYOUT_2020").is_some();
if !(layout_2013 || layout_2020) {
error("Must enable one of the `layout-2013` or `layout-2020` features.")
}
if layout_2013 && layout_2020 {
error("Must not enable both of the `layout-2013` or `layout-2020` features.")
}
println!("cargo:rerun-if-changed=../../python/servo/gstreamer.py");
let output = Command::new(find_python())
@ -34,11 +24,6 @@ fn main() {
fs::write(path, output.stdout).unwrap();
}
fn error(message: &str) {
print!("\n\n Error: {}\n\n", message);
std::process::exit(1);
}
fn find_python() -> String {
env::var("PYTHON3").ok().unwrap_or_else(|| {
let candidates = if cfg!(windows) {

View file

@ -33,7 +33,8 @@ pub use embedder_traits;
pub use euclid;
pub use gfx;
pub use ipc_channel;
pub use layout_thread;
pub use layout_thread_2013;
pub use layout_thread_2020;
pub use media;
pub use msg;
pub use net;
@ -887,12 +888,23 @@ fn create_constellation(
wgpu_image_map,
};
let constellation_chan = Constellation::<
script_layout_interface::message::Msg,
layout_thread::LayoutThread,
script::script_thread::ScriptThread,
script::serviceworker_manager::ServiceWorkerManager,
>::start(
let start_constellation_chan = if opts::get().legacy_layout {
Constellation::<
script_layout_interface::message::Msg,
layout_thread_2013::LayoutThread,
script::script_thread::ScriptThread,
script::serviceworker_manager::ServiceWorkerManager,
>::start
} else {
Constellation::<
script_layout_interface::message::Msg,
layout_thread_2020::LayoutThread,
script::script_thread::ScriptThread,
script::serviceworker_manager::ServiceWorkerManager,
>::start
};
start_constellation_chan(
initial_state,
initial_window_size,
opts.random_pipeline_closure_probability,
@ -902,9 +914,7 @@ fn create_constellation(
!opts.debug.disable_canvas_antialiasing,
canvas_create_sender,
canvas_ipc_sender,
);
constellation_chan
)
}
struct FontCacheWR(CompositorProxy);
@ -1017,14 +1027,23 @@ pub fn run_content_process(token: String) {
set_logger(content.script_to_constellation_chan().clone());
let background_hang_monitor_register = content.register_with_background_hang_monitor();
content.start_all::<script_layout_interface::message::Msg,
layout_thread::LayoutThread,
script::script_thread::ScriptThread>(
true,
background_hang_monitor_register,
None,
);
if opts::get().legacy_layout {
content.start_all::<script_layout_interface::message::Msg,
layout_thread_2013::LayoutThread,
script::script_thread::ScriptThread>(
true,
background_hang_monitor_register,
None,
);
} else {
content.start_all::<script_layout_interface::message::Msg,
layout_thread_2020::LayoutThread,
script::script_thread::ScriptThread>(
true,
background_hang_monitor_register,
None,
);
}
},
UnprivilegedContent::ServiceWorker(content) => {
content.start::<ServiceWorkerManager>();