diff options
Diffstat (limited to 'components/servo')
-rw-r--r-- | components/servo/Cargo.toml | 6 | ||||
-rw-r--r-- | components/servo/build.rs | 15 | ||||
-rw-r--r-- | components/servo/lib.rs | 55 |
3 files changed, 39 insertions, 37 deletions
diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml index 4e4b8da58d3..15c20d20979 100644 --- a/components/servo/Cargo.toml +++ b/components/servo/Cargo.toml @@ -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 } diff --git a/components/servo/build.rs b/components/servo/build.rs index 936ed712dc6..278afb641eb 100644 --- a/components/servo/build.rs +++ b/components/servo/build.rs @@ -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) { diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 25d89187f0c..4b9b37a178b 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -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>(); |