diff options
author | glowe <graham@spinlag.com> | 2019-10-23 18:13:57 -0400 |
---|---|---|
committer | glowe <graham@spinlag.com> | 2019-10-26 11:34:36 -0400 |
commit | 74f1e2ec322b22ef9a1370d56d7cf3b1d38479ef (patch) | |
tree | a7e958b7d5c99f81bc98c5e554ff19cf5045068f /ports | |
parent | 6eca38aea3178e99f2f97dda5e4d257244a01fad (diff) | |
download | servo-74f1e2ec322b22ef9a1370d56d7cf3b1d38479ef.tar.gz servo-74f1e2ec322b22ef9a1370d56d7cf3b1d38479ef.zip |
Extract 3 more embedder options
Extracted clean-shutdown, msaa, and no-native-titlebar embedder
specific options out from the global options.
Partially fixes #23009
Diffstat (limited to 'ports')
-rw-r--r-- | ports/glutin/app.rs | 4 | ||||
-rw-r--r-- | ports/glutin/headed_window.rs | 16 | ||||
-rw-r--r-- | ports/glutin/main2.rs | 18 | ||||
-rw-r--r-- | ports/glutin/platform/macos/mod.rs | 5 | ||||
-rw-r--r-- | ports/libmlservo/Cargo.toml | 1 | ||||
-rw-r--r-- | ports/libsimpleservo/api/Cargo.toml | 1 |
6 files changed, 33 insertions, 12 deletions
diff --git a/ports/glutin/app.rs b/ports/glutin/app.rs index d5371bf1e93..44c8d52e6a7 100644 --- a/ports/glutin/app.rs +++ b/ports/glutin/app.rs @@ -34,7 +34,7 @@ pub struct App { } impl App { - pub fn run(angle: bool, enable_vsync: bool) { + pub fn run(angle: bool, enable_vsync: bool, use_msaa: bool, no_native_titlebar: bool) { let events_loop = EventsLoop::new(opts::get().headless); // Implements window methods, used by compositor. @@ -47,6 +47,8 @@ impl App { events_loop.clone(), angle, enable_vsync, + use_msaa, + no_native_titlebar, )) }; diff --git a/ports/glutin/headed_window.rs b/ports/glutin/headed_window.rs index 37af152a2a2..10c69ba59c6 100644 --- a/ports/glutin/headed_window.rs +++ b/ports/glutin/headed_window.rs @@ -73,6 +73,8 @@ pub struct Window { xr_rotation: Cell<Rotation3D<f32, UnknownUnit, UnknownUnit>>, angle: bool, enable_vsync: bool, + use_msaa: bool, + no_native_titlebar: bool, } #[cfg(not(target_os = "windows"))] @@ -94,6 +96,8 @@ impl Window { events_loop: Rc<RefCell<EventsLoop>>, angle: bool, enable_vsync: bool, + use_msaa: bool, + no_native_titlebar: bool, ) -> Window { let opts = opts::get(); @@ -101,7 +105,7 @@ impl Window { // `load_end()`. This avoids an ugly flash of unstyled content (especially important since // unstyled content is white and chrome often has a transparent background). See issue // #9996. - let visible = opts.output_file.is_none() && !opts.no_native_titlebar; + let visible = opts.output_file.is_none() && !no_native_titlebar; let win_size: DeviceIntSize = (win_size.to_f32() * window_creation_scale_factor()).to_i32(); let width = win_size.to_untyped().width; @@ -109,8 +113,8 @@ impl Window { let mut window_builder = glutin::WindowBuilder::new() .with_title("Servo".to_string()) - .with_decorations(!opts.no_native_titlebar) - .with_transparency(opts.no_native_titlebar) + .with_decorations(!no_native_titlebar) + .with_transparency(no_native_titlebar) .with_dimensions(LogicalSize::new(width as f64, height as f64)) .with_visibility(visible) .with_multitouch(); @@ -121,7 +125,7 @@ impl Window { .with_gl(app::gl_version(angle)) .with_vsync(enable_vsync); - if opts.use_msaa { + if use_msaa { context_builder = context_builder.with_multisampling(MULTISAMPLES) } @@ -204,6 +208,8 @@ impl Window { xr_rotation: Cell::new(Rotation3D::identity()), angle, enable_vsync, + use_msaa, + no_native_titlebar, }; window.present(); @@ -553,6 +559,8 @@ impl webxr::glwindow::GlWindow for Window { self.events_loop.clone(), self.angle, self.enable_vsync, + self.use_msaa, + self.no_native_titlebar, )); app::register_window(window.clone()); Ok(window) diff --git a/ports/glutin/main2.rs b/ports/glutin/main2.rs index e0224e64daa..c6aff92f5e0 100644 --- a/ports/glutin/main2.rs +++ b/ports/glutin/main2.rs @@ -27,6 +27,7 @@ use backtrace::Backtrace; use getopts::Options; use servo::config::opts::{self, ArgumentParsingResult}; use servo::config::servo_version; +use servo::servo_config::pref; use std::env; use std::panic; use std::process; @@ -40,7 +41,7 @@ pub mod platform { pub mod macos; #[cfg(not(target_os = "macos"))] - pub fn deinit() {} + pub fn deinit(_clean_shutdown: bool) {} } #[cfg(not(any(target_os = "macos", target_os = "linux")))] @@ -85,9 +86,16 @@ pub fn main() { ); opts.optflag( "", + "clean-shutdown", + "Do not shutdown until all threads have finished (macos only)", + ); + opts.optflag( + "", "disable-vsync", "Disable vsync mode in the compositor to allow profiling at more than monitor refresh rate", ); + opts.optflag("", "msaa", "Use multisample antialiasing in WebRender."); + opts.optflag("b", "no-native-titlebar", "Do not use native titlebar"); let opts_matches; let content_process_token; @@ -146,8 +154,12 @@ pub fn main() { } let angle = opts_matches.opt_present("angle"); + let clean_shutdown = opts_matches.opt_present("clean-shutdown"); + let do_not_use_native_titlebar = + opts_matches.opt_present("no-native-titlebar") || !(pref!(shell.native_titlebar.enabled)); let enable_vsync = !opts_matches.opt_present("disable-vsync"); - App::run(angle, enable_vsync); + let use_msaa = opts_matches.opt_present("msaa"); + App::run(angle, enable_vsync, use_msaa, do_not_use_native_titlebar); - platform::deinit() + platform::deinit(clean_shutdown) } diff --git a/ports/glutin/platform/macos/mod.rs b/ports/glutin/platform/macos/mod.rs index 730f4072576..d9d14bb9ee8 100644 --- a/ports/glutin/platform/macos/mod.rs +++ b/ports/glutin/platform/macos/mod.rs @@ -2,12 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use servo::config::opts; use std::ptr; use std::thread; use std::time::Duration; -pub fn deinit() { +pub fn deinit(clean_shutdown: bool) { // An unfortunate hack to make sure the linker's dead code stripping doesn't strip our // `Info.plist`. unsafe { @@ -21,7 +20,7 @@ pub fn deinit() { "{} threads are still running after shutdown (bad).", thread_count ); - if opts::get().clean_shutdown { + if clean_shutdown { println!("Waiting until all threads have shutdown"); loop { let thread_count = unsafe { macos_count_running_threads() }; diff --git a/ports/libmlservo/Cargo.toml b/ports/libmlservo/Cargo.toml index 4809675761c..4c4ef0e8b1b 100644 --- a/ports/libmlservo/Cargo.toml +++ b/ports/libmlservo/Cargo.toml @@ -25,7 +25,6 @@ simpleservo = { path = "../libsimpleservo/api", features = ["no_static_freetype" rust-webvr = { version = "0.16", features = ["magicleap"] } webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] } webxr = { git = "https://github.com/servo/webxr", features = ["ipc", "magicleap"] } -getopts = "0.2.11" libc = "0.2" log = "0.4" servo-egl = "0.2" diff --git a/ports/libsimpleservo/api/Cargo.toml b/ports/libsimpleservo/api/Cargo.toml index e0204f3ebb6..afbd3f4c800 100644 --- a/ports/libsimpleservo/api/Cargo.toml +++ b/ports/libsimpleservo/api/Cargo.toml @@ -7,6 +7,7 @@ edition = "2018" publish = false [dependencies] +getopts = "0.2.11" libservo = { path = "../../../components/servo" } log = "0.4" servo-media = { git = "https://github.com/servo/media" } |