Auto merge of #24525 - glowe:issue-23009/separate_angle_and_disable_vsync, r=jdm

Issue 23009/separate angle and disable vsync

The `--angle` and `--disable-vsync` options were declared as global options, but only used in the Glutin embedding for desktop builds. Moving them to the Glutin embedding code makes them easier to update in the future.

I modified `opts::from_cmdline_args` to accept a `getopts::Options` (as prescribed in the issue) and augmented `opts::ArgumentParsingResult` to include an `opts::Matches` and `content-process` String when appropriate. I could use some feedback on this last bit. I could have changed the function to return `opts::Matches` and have the embedding code look for the presence of `content-process`, but I felt that the approach I went with was closer to the original design.

The other aspect I'm not sure about is moving `disable-vsync` from a global debug option to a plain embedder option. This changes the command line interface for glutin, which is maybe bad. However I wasn't sure whether it was worth preserving the original behavior given the complexity of injecting debug options into `opts::from_cmdline_args`.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes partially fix #23009 – there are 2 more options to deal with, but I'm not sure if we should handle them yet.
- [x] These changes do not require tests because this is a refactoring and I'm hoping that the existing tests cover these changes.

r? @jdm
This commit is contained in:
bors-servo 2019-10-26 14:58:54 -04:00 committed by GitHub
commit 2ad6e94091
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 180 additions and 127 deletions

View file

@ -464,6 +464,10 @@ pub struct Constellation<Message, LTF, STF> {
/// Mechanism to force the compositor to process events.
event_loop_waker: Option<Box<dyn EventLoopWaker>>,
/// The ratio of device pixels per px at the default scale. If unspecified, will use the
/// platform default setting.
device_pixels_per_px: Option<f32>,
}
/// State needed to construct a constellation.
@ -520,6 +524,10 @@ pub struct InitialConstellationState {
/// Mechanism to force the compositor to process events.
pub event_loop_waker: Option<Box<dyn EventLoopWaker>>,
/// The ratio of device pixels per px at the default scale. If unspecified, will use the
/// platform default setting.
pub device_pixels_per_px: Option<f32>,
}
/// Data needed for webdriver
@ -837,6 +845,7 @@ where
glplayer_threads: state.glplayer_threads,
player_context: state.player_context,
event_loop_waker: state.event_loop_waker,
device_pixels_per_px,
};
constellation.run();
@ -1081,6 +1090,7 @@ where
webxr_registry: self.webxr_registry.clone(),
player_context: self.player_context.clone(),
event_loop_waker: self.event_loop_waker.as_ref().map(|w| (*w).clone_box()),
device_pixels_per_px: self.device_pixels_per_px,
});
let pipeline = match result {

View file

@ -205,6 +205,10 @@ pub struct InitialPipelineState {
/// Mechanism to force the compositor to process events.
pub event_loop_waker: Option<Box<dyn EventLoopWaker>>,
/// The ratio of device pixels per px at the default scale. If unspecified, will use the
/// platform default setting.
pub device_pixels_per_px: Option<f32>,
}
pub struct NewPipeline {
@ -312,6 +316,7 @@ impl Pipeline {
webvr_chan: state.webvr_chan,
webxr_registry: state.webxr_registry,
player_context: state.player_context,
device_pixels_per_px: state.device_pixels_per_px,
};
// Spawn the child process.
@ -518,6 +523,7 @@ pub struct UnprivilegedPipelineContent {
webvr_chan: Option<IpcSender<WebVRMsg>>,
webxr_registry: webxr_api::Registry,
player_context: WindowGLContext,
device_pixels_per_px: Option<f32>,
}
impl UnprivilegedPipelineContent {
@ -609,7 +615,7 @@ impl UnprivilegedPipelineContent {
layout_thread_busy_flag.clone(),
self.opts.load_webfonts_synchronously,
self.opts.initial_window_size,
self.opts.device_pixels_per_px,
self.device_pixels_per_px,
self.opts.dump_display_list,
self.opts.dump_display_list_json,
self.opts.dump_style_tree,