EmbedderMsg: port reply channels to GenericChannel (#39018)

This change ports all `EmbedderMsg` reply channels that don't use the
`ROUTER` to GenericChannel.
The remaining reply channels that use the router are blocked until
#38973 is merged.
This is a breaking change in the API between libservo and embedders.

Future work: A lot of the reply channels in this PR look like they
conceptually should be oneshot ipc channels. It might make sense to
provide a `OneshotGenericChannel` abstraction that encodes this.

Testing: No functional changes - covered by existing tests. None of the
channels changed here uses the Router
Part of #38912

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
Jonathan Schwender 2025-08-29 14:44:21 +02:00 committed by GitHub
parent 89e1357c75
commit 66d9f957e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 107 additions and 95 deletions

View file

@ -18,6 +18,7 @@ use std::net::{Shutdown, TcpListener, TcpStream};
use std::sync::{Arc, Mutex};
use std::thread;
use base::generic_channel;
use base::id::{BrowsingContextId, PipelineId, WebViewId};
use crossbeam_channel::{Receiver, Sender, unbounded};
use devtools_traits::{
@ -26,7 +27,7 @@ use devtools_traits::{
ScriptToDevtoolsControlMsg, SourceInfo, WorkerId,
};
use embedder_traits::{AllowOrDeny, EmbedderMsg, EmbedderProxy};
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::ipc::IpcSender;
use log::{trace, warn};
use resource::{ResourceArrayType, ResourceAvailable};
use serde::Serialize;
@ -651,7 +652,8 @@ fn allow_devtools_client(stream: &mut TcpStream, embedder: &EmbedderProxy, token
};
// No token found. Prompt user
let (request_sender, request_receiver) = ipc::channel().expect("Failed to create IPC channel!");
let (request_sender, request_receiver) =
generic_channel::channel().expect("Failed to create IPC channel!");
embedder.send(EmbedderMsg::RequestDevtoolsConnection(request_sender));
request_receiver.recv().unwrap() == AllowOrDeny::Allow
}