aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authoratbrakhi <atbrakhi@igalia.com>2023-11-14 11:15:02 +0100
committerGitHub <noreply@github.com>2023-11-14 10:15:02 +0000
commit1e5db618d04ef5636bdcf887ca8dffb480c1a222 (patch)
tree370f23e5927bf332bd84fbdcfc60aeff24216eae /components
parent098e6a158039fe1b01cc69f1e52a5e375c4c423f (diff)
downloadservo-1e5db618d04ef5636bdcf887ca8dffb480c1a222.tar.gz
servo-1e5db618d04ef5636bdcf887ca8dffb480c1a222.zip
Fix Servo taking a long time to start on MacOS after a recompile (#30726)
* update init as we initialize media in the background now With [#405](https://github.com/servo/media/pull/405) changes in servo/media we move initialization of the media engine to a background thread. This PR updates the init function in libservo to adapt that behaviour. Co-authored-by: Martin Robinson <mrobinson@igalia.com> * review fix: simplify code * Update media --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components')
-rw-r--r--components/servo/lib.rs33
1 files changed, 17 insertions, 16 deletions
diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index 265fb63766a..b5a8eacc30d 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -112,24 +112,25 @@ mod media_platform {
#[cfg(any(windows, target_os = "macos"))]
pub fn init() {
- let mut plugin_dir = std::env::current_exe().unwrap();
- plugin_dir.pop();
+ ServoMedia::init_with_backend(|| {
+ let mut plugin_dir = std::env::current_exe().unwrap();
+ plugin_dir.pop();
- if cfg!(target_os = "macos") {
- plugin_dir.push("lib");
- }
+ if cfg!(target_os = "macos") {
+ plugin_dir.push("lib");
+ }
- let backend = match GStreamerBackend::init_with_plugins(
- plugin_dir,
- &gstreamer_plugins::GSTREAMER_PLUGINS,
- ) {
- Ok(b) => b,
- Err(e) => {
- eprintln!("Error initializing GStreamer: {:?}", e);
- std::process::exit(1);
- },
- };
- ServoMedia::init_with_backend(backend);
+ match GStreamerBackend::init_with_plugins(
+ plugin_dir,
+ &gstreamer_plugins::GSTREAMER_PLUGINS,
+ ) {
+ Ok(b) => b,
+ Err(e) => {
+ eprintln!("Error initializing GStreamer: {:?}", e);
+ std::process::exit(1);
+ },
+ }
+ });
}
#[cfg(not(any(windows, target_os = "macos")))]