Truly independent web browser
LibIPC: Let Rust transports tell how many messages wait to be sent
Ali Mohammad Pur4953191b1d75
diff --git a/Libraries/LibIPC/Rust/src/transport.rs b/Libraries/LibIPC/Rust/src/transport.rsindex 6b292ecb218..b36b3481658 100644--- a/Libraries/LibIPC/Rust/src/transport.rs+++ b/Libraries/LibIPC/Rust/src/transport.rs@@ -142,6 +142,12 @@ impl TransportMachPort {Ok(())}+ /// How many posted messages are still waiting to be sent, so a producer can tell when its peer falls behind.+ pub fn pending_message_count(&self) -> usize {+ let queue = self.shared.lock_send_queue();+ queue.pending.len() + usize::from(queue.in_progress)+ }+/// Waits until every message posted so far is sent, or the transport stops.pub fn flush(&self) {self.shared.wake_io_thread();diff --git a/Libraries/LibIPC/Rust/src/transport_socket.rs b/Libraries/LibIPC/Rust/src/transport_socket.rsindex 9eeacfa4db3..80299b653c3 100644--- a/Libraries/LibIPC/Rust/src/transport_socket.rs+++ b/Libraries/LibIPC/Rust/src/transport_socket.rs@@ -142,6 +142,12 @@ impl TransportSocket {Ok(())}+ /// How many posted messages are still waiting to be sent, so a producer can tell when its peer falls behind.+ pub fn pending_message_count(&self) -> usize {+ let queue = self.shared.lock_outgoing();+ queue.messages.len() + usize::from(queue.sending)+ }+/// Waits until every message posted so far is sent, or the transport stops.pub fn flush(&self) {let mut queue = self.shared.lock_outgoing();