diff options
author | bors-servo <infra@servo.org> | 2023-05-03 10:44:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-03 10:44:48 +0200 |
commit | a8f7c458117efdcdac64f0865885b372896f50d1 (patch) | |
tree | 9b37eb62ee4cd13ebbec1b35347ac1f0d3964fcf /components/script/script_thread.rs | |
parent | 0cffe557c24f88d560b8a7d67a752a528c9520ca (diff) | |
parent | 0a3797d1309b56692af5c93c4f6e1614105f551e (diff) | |
download | servo-a8f7c458117efdcdac64f0865885b372896f50d1.tar.gz servo-a8f7c458117efdcdac64f0865885b372896f50d1.zip |
Auto merge of #29693 - mrobinson:cleanup-options, r=mukilan
Clean up how command-line options are passed around
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #29678
- [x] These changes do not require tests because they do not change behavior.
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 55 |
1 files changed, 14 insertions, 41 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index f52fc0d777a..89b4ceab185 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -755,15 +755,6 @@ impl ScriptThreadFactory for ScriptThread { fn create( state: InitialScriptState, load_data: LoadData, - profile_script_events: bool, - print_pwm: bool, - relayout_event: bool, - prepare_for_screenshot: bool, - unminify_js: bool, - local_script_source: Option<String>, - userscripts_path: Option<String>, - headless: bool, - replace_surrogates: bool, user_agent: Cow<'static, str>, ) -> (Sender<message::Msg>, Receiver<message::Msg>) { let (script_chan, script_port) = unbounded(); @@ -788,21 +779,8 @@ impl ScriptThreadFactory for ScriptThread { let window_size = state.window_size; let layout_is_busy = state.layout_is_busy.clone(); - let script_thread = ScriptThread::new( - state, - script_port, - script_chan.clone(), - profile_script_events, - print_pwm, - relayout_event, - prepare_for_screenshot, - unminify_js, - local_script_source, - userscripts_path, - headless, - replace_surrogates, - user_agent, - ); + let script_thread = + ScriptThread::new(state, script_port, script_chan.clone(), user_agent); SCRIPT_THREAD_ROOT.with(|root| { root.set(Some(&script_thread as *const _)); @@ -1273,17 +1251,12 @@ impl ScriptThread { state: InitialScriptState, port: Receiver<MainThreadScriptMsg>, chan: Sender<MainThreadScriptMsg>, - profile_script_events: bool, - print_pwm: bool, - relayout_event: bool, - prepare_for_screenshot: bool, - unminify_js: bool, - local_script_source: Option<String>, - userscripts_path: Option<String>, - headless: bool, - replace_surrogates: bool, user_agent: Cow<'static, str>, ) -> ScriptThread { + let opts = opts::get(); + let prepare_for_screenshot = + opts.output_file.is_some() || opts.exit_after_load || opts.webdriver_port.is_some(); + let boxed_script_sender = Box::new(MainThreadScriptChan(chan.clone())); let runtime = new_rt_and_cx(Some(NetworkingTaskSource( @@ -1392,17 +1365,17 @@ impl ScriptThread { webrender_document: state.webrender_document, webrender_api_sender: state.webrender_api_sender, - profile_script_events, - print_pwm, + profile_script_events: opts.debug.profile_script_events, + print_pwm: opts.print_pwm, + relayout_event: opts.debug.relayout_event, - relayout_event, prepare_for_screenshot, - unminify_js, - local_script_source, + unminify_js: opts.unminify_js, + local_script_source: opts.local_script_source.clone(), - userscripts_path, - headless, - replace_surrogates, + userscripts_path: opts.userscripts.clone(), + headless: opts.headless, + replace_surrogates: opts.debug.replace_surrogates, user_agent, player_context: state.player_context, event_loop_waker: state.event_loop_waker, |