Unified · Split
| @@ -134,7 +134,7 @@ impl Room { · 133 unmodified lines | ||
| 134 | 134 | } |
| 135 | 135 | }); |
| 136 | 136 | |
| 137 | − let _maintain_video_tracks = cx.spawn_on_main({ | |
| 137 | + let _maintain_video_tracks = cx.spawn({ | |
| 138 | 138 | let room = room.clone(); |
| 139 | 139 | move |this, mut cx| async move { |
| 140 | 140 | let mut track_video_changes = room.remote_video_track_updates(); |
| @@ -153,7 +153,7 @@ impl Room { · 12 unmodified lines | ||
| 153 | 153 | } |
| 154 | 154 | }); |
| 155 | 155 | |
| 156 | − let _maintain_audio_tracks = cx.spawn_on_main({ | |
| 156 | + let _maintain_audio_tracks = cx.spawn({ | |
| 157 | 157 | let room = room.clone(); |
| 158 | 158 | |this, mut cx| async move { |
| 159 | 159 | let mut track_audio_changes = room.remote_audio_track_updates(); |
| @@ -1301,7 +1301,9 @@ impl Room { · 1141 unmodified lines | ||
| 1301 | 1301 | live_kit.room.unpublish_track(publication); |
| 1302 | 1302 | } else { |
| 1303 | 1303 | if muted { |
| 1304 | − cx.executor().spawn(publication.set_mute(muted)).detach(); | |
| 1304 | + cx.background_executor() | |
| 1305 | + .spawn(publication.set_mute(muted)) | |
| 1306 | + .detach(); | |
| 1305 | 1307 | } |
| 1306 | 1308 | live_kit.microphone_track = LocalTrack::Published { |
| 1307 | 1309 | track_publication: publication, |
| @@ -1344,7 +1346,7 @@ impl Room { · 36 unmodified lines | ||
| 1344 | 1346 | return Task::ready(Err(anyhow!("live-kit was not initialized"))); |
| 1345 | 1347 | }; |
| 1346 | 1348 | |
| 1347 | − cx.spawn_on_main(move |this, mut cx| async move { | |
| 1349 | + cx.spawn(move |this, mut cx| async move { | |
| 1348 | 1350 | let publish_track = async { |
| 1349 | 1351 | let displays = displays.await?; |
| 1350 | 1352 | let display = displays |
| @@ -1387,7 +1389,9 @@ impl Room { · 36 unmodified lines | ||
| 1387 | 1389 | live_kit.room.unpublish_track(publication); |
| 1388 | 1390 | } else { |
| 1389 | 1391 | if muted { |
| 1390 | − cx.executor().spawn(publication.set_mute(muted)).detach(); | |
| 1392 | + cx.background_executor() | |
| 1393 | + .spawn(publication.set_mute(muted)) | |
| 1394 | + .detach(); | |
| 1391 | 1395 | } |
| 1392 | 1396 | live_kit.screen_track = LocalTrack::Published { |
| 1393 | 1397 | track_publication: publication, |
| @@ -1454,14 +1458,11 @@ impl Room { · 60 unmodified lines | ||
| 1454 | 1458 | .remote_audio_track_publications(&participant.user.id.to_string()) |
| 1455 | 1459 | { |
| 1456 | 1460 | let deafened = live_kit.deafened; |
| 1457 | − tasks.push( | |
| 1458 | − cx.executor() | |
| 1459 | − .spawn_on_main(move || track.set_enabled(!deafened)), | |
| 1460 | − ); | |
| 1461 | + tasks.push(cx.foreground_executor().spawn(track.set_enabled(!deafened))); | |
| 1461 | 1462 | } |
| 1462 | 1463 | } |
| 1463 | 1464 | |
| 1464 | − Ok(cx.executor().spawn_on_main(|| async { | |
| 1465 | + Ok(cx.foreground_executor().spawn(async move { | |
| 1465 | 1466 | if let Some(mute_task) = mute_task { |
| 1466 | 1467 | mute_task.await?; |
| 1467 | 1468 | } |
| @@ -42,7 +42,7 @@ fn main() { · 41 unmodified lines | ||
| 42 | 42 | let live_kit_key = std::env::var("LIVE_KIT_KEY").unwrap_or("devkey".into()); |
| 43 | 43 | let live_kit_secret = std::env::var("LIVE_KIT_SECRET").unwrap_or("secret".into()); |
| 44 | 44 | |
| 45 | − cx.spawn_on_main(|cx| async move { | |
| 45 | + cx.spawn(|cx| async move { | |
| 46 | 46 | let user_a_token = token::create( |
| 47 | 47 | &live_kit_key, |
| 48 | 48 | &live_kit_secret, |
| @@ -104,7 +104,7 @@ fn main() { · 55 unmodified lines | ||
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | println!("Pausing for 5 seconds to test audio, make some noise!"); |
| 107 | − let timer = cx.executor().timer(Duration::from_secs(5)); | |
| 107 | + let timer = cx.background_executor().timer(Duration::from_secs(5)); | |
| 108 | 108 | timer.await; |
| 109 | 109 | let remote_audio_track = room_b |
| 110 | 110 | .remote_audio_tracks("test-participant-1") |
| @@ -2,7 +2,7 @@ use anyhow::{anyhow, Context, Result}; · 1 unmodified line | ||
| 2 | 2 | use async_trait::async_trait; |
| 3 | 3 | use collections::{BTreeMap, HashMap}; |
| 4 | 4 | use futures::Stream; |
| 5 | −use gpui2::Executor; | |
| 5 | +use gpui2::BackgroundExecutor; | |
| 6 | 6 | use live_kit_server::token; |
| 7 | 7 | use media::core_video::CVImageBuffer; |
| 8 | 8 | use parking_lot::Mutex; |
| @@ -16,7 +16,7 @@ pub struct TestServer { · 7 unmodified lines | ||
| 16 | 16 | pub api_key: String, |
| 17 | 17 | pub secret_key: String, |
| 18 | 18 | rooms: Mutex<HashMap<String, TestServerRoom>>, |
| 19 | − executor: Arc<Executor>, | |
| 19 | + executor: Arc<BackgroundExecutor>, | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | impl TestServer { |
| @@ -24,7 +24,7 @@ impl TestServer { · 1 unmodified line | ||
| 24 | 24 | url: String, |
| 25 | 25 | api_key: String, |
| 26 | 26 | secret_key: String, |
| 27 | − executor: Arc<Executor>, | |
| 27 | + executor: Arc<BackgroundExecutor>, | |
| 28 | 28 | ) -> Result<Arc<TestServer>> { |
| 29 | 29 | let mut servers = SERVERS.lock(); |
| 30 | 30 | if servers.contains_key(&url) { |
| @@ -878,7 +878,7 @@ impl MultiBuffer { · 877 unmodified lines | ||
| 878 | 878 | cx.spawn(move |this, mut cx| async move { |
| 879 | 879 | let mut excerpt_ranges = Vec::new(); |
| 880 | 880 | let mut range_counts = Vec::new(); |
| 881 | − cx.executor() | |
| 881 | + cx.background_executor() | |
| 882 | 882 | .scoped(|scope| { |
| 883 | 883 | scope.spawn(async { |
| 884 | 884 | let (ranges, counts) = |
| @@ -4177,7 +4177,7 @@ mod tests { · 3292 unmodified lines | ||
| 4177 | 4177 | let guest_buffer = cx.build_model(|cx| { |
| 4178 | 4178 | let state = host_buffer.read(cx).to_proto(); |
| 4179 | 4179 | let ops = cx |
| 4180 | − .executor() | |
| 4180 | + .background_executor() | |
| 4181 | 4181 | .block(host_buffer.read(cx).serialize_ops(None, cx)); |
| 4182 | 4182 | let mut buffer = Buffer::from_proto(1, state, None).unwrap(); |
| 4183 | 4183 | buffer |