···11+--- original
22++++ modified
33+@@ -127,4 +127,21 @@
44+ );
55+ }
66+ }
77++
88++ /// Broadcast a message to ALL local routers for the given origin and channel name,
99++ /// without excluding any sender. Used for messages received from remote P2P peers.
1010++ pub fn broadcast_to_all(&self, message: &BroadcastChannelMsg) {
1111++ if let Some(channels) = self.channels.get(&message.origin) {
1212++ let Some(routers) = channels.get(&message.channel_name) else {
1313++ return;
1414++ };
1515++ for router in routers {
1616++ if let Some(broadcast_ipc_sender) = self.routers.get(router) {
1717++ if broadcast_ipc_sender.send(message.clone()).is_err() {
1818++ warn!("Failed to broadcast remote message to router: {:?}", router);
1919++ }
2020++ }
2121++ }
2222++ }
2323++ }
2424+ }
···119119 /// Mark a new document as active
120120 ActivateDocument,
121121 /// Set the document state for a pipeline (used by screenshot / reftests)
122122-@@ -726,6 +775,54 @@
122122+@@ -726,6 +775,60 @@
123123 RespondToScreenshotReadinessRequest(ScreenshotReadinessResponse),
124124 /// Request the constellation to force garbage collection in all `ScriptThread`'s.
125125 TriggerGarbageCollection,
···171171+ PairingGetPeers(GenericCallback<Result<Vec<super::PeerInfo>, String>>),
172172+ /// Update the display name of the local P2P endpoint and restart the service.
173173+ PairingSetName(String, GenericCallback<Result<(), String>>),
174174++ /// Request pairing with a remote peer. Returns true if accepted, false if rejected.
175175++ PairingRequestPairing(String, GenericCallback<Result<bool, String>>),
176176++ /// Accept an incoming pairing request from a remote peer.
177177++ PairingAcceptPairing(String, GenericCallback<Result<(), String>>),
178178++ /// Reject an incoming pairing request from a remote peer.
179179++ PairingRejectPairing(String, GenericCallback<Result<(), String>>),
174180 }
175181176182 impl fmt::Debug for ScriptToConstellationMessage {
···2121 };
2222 pub use from_script_message::*;
2323 use malloc_size_of_derive::MallocSizeOf;
2424-@@ -36,9 +37,138 @@
2424+@@ -36,9 +37,147 @@
2525 use servo_url::{ImmutableOrigin, ServoUrl};
2626 pub use structured_data::*;
2727 use strum::IntoStaticStr;
···129129+ PairingRequest {
130130+ /// The endpoint ID as a string.
131131+ id: String,
132132++ /// The display name of the peer.
133133++ name: String,
132134+ },
133135+ /// A pairing request we sent was accepted.
134136+ PairingAccepted {
···145147+ /// The endpoint ID as a string.
146148+ id: String,
147149+ },
150150++ /// A message was received from a paired peer.
151151++ MessageReceived {
152152++ /// The endpoint ID of the sender.
153153++ from: String,
154154++ /// The raw message bytes (postcard-serialized P2pMessage).
155155++ data: Vec<u8>,
156156++ },
148157+}
149158+
150159+/// The type of simple dialog to show.
···161170 /// Messages to the Constellation from the embedding layer, whether from `ServoRenderer` or
162171 /// from `libservo` itself.
163172 #[derive(IntoStaticStr)]
164164-@@ -118,6 +248,9 @@
173173+@@ -118,6 +257,9 @@
165174 UpdatePinchZoomInfos(PipelineId, PinchZoomInfos),
166175 /// Activate or deactivate accessibility features.
167176 SetAccessibilityActive(bool),