mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Extract 3 more embedder options
Extracted clean-shutdown, msaa, and no-native-titlebar embedder specific options out from the global options. Partially fixes #23009
This commit is contained in:
parent
6eca38aea3
commit
74f1e2ec32
8 changed files with 34 additions and 41 deletions
|
@ -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,
|
||||
))
|
||||
};
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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")))]
|
||||
|
@ -83,11 +84,18 @@ pub fn main() {
|
|||
"angle",
|
||||
"Use ANGLE to create a GL context (Windows-only)",
|
||||
);
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -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() };
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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" }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue