sum_tree: Replace rayon with futures (#41586)
Release Notes: - N/A *or* Added/Fixed/Improved ... Co-authored by: Kate <kate@zed.dev>
This commit is contained in:
@@ -180,7 +180,13 @@ impl RemoteBufferStore {
|
||||
buffer_file = Some(Arc::new(File::from_proto(file, worktree, cx)?)
|
||||
as Arc<dyn language::File>);
|
||||
}
|
||||
Buffer::from_proto(replica_id, capability, state, buffer_file)
|
||||
Buffer::from_proto(
|
||||
replica_id,
|
||||
capability,
|
||||
state,
|
||||
buffer_file,
|
||||
cx.background_executor(),
|
||||
)
|
||||
});
|
||||
|
||||
match buffer_result {
|
||||
@@ -628,9 +634,10 @@ impl LocalBufferStore {
|
||||
Ok(loaded) => {
|
||||
let reservation = cx.reserve_entity::<Buffer>()?;
|
||||
let buffer_id = BufferId::from(reservation.entity_id().as_non_zero_u64());
|
||||
let executor = cx.background_executor().clone();
|
||||
let text_buffer = cx
|
||||
.background_spawn(async move {
|
||||
text::Buffer::new(ReplicaId::LOCAL, buffer_id, loaded.text)
|
||||
text::Buffer::new(ReplicaId::LOCAL, buffer_id, loaded.text, &executor)
|
||||
})
|
||||
.await;
|
||||
cx.insert_entity(reservation, |_| {
|
||||
@@ -639,7 +646,12 @@ impl LocalBufferStore {
|
||||
}
|
||||
Err(error) if is_not_found_error(&error) => cx.new(|cx| {
|
||||
let buffer_id = BufferId::from(cx.entity_id().as_non_zero_u64());
|
||||
let text_buffer = text::Buffer::new(ReplicaId::LOCAL, buffer_id, "");
|
||||
let text_buffer = text::Buffer::new(
|
||||
ReplicaId::LOCAL,
|
||||
buffer_id,
|
||||
"",
|
||||
cx.background_executor(),
|
||||
);
|
||||
Buffer::build(
|
||||
text_buffer,
|
||||
Some(Arc::new(File {
|
||||
|
||||
Reference in New Issue
Block a user