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

@ -10,11 +10,12 @@ use std::path::{Path, PathBuf};
use std::sync::atomic::{self, AtomicBool, AtomicUsize, Ordering};
use std::sync::{Arc, Mutex, RwLock, Weak};
use base::generic_channel;
use base::id::WebViewId;
use embedder_traits::{EmbedderMsg, EmbedderProxy, FilterPattern};
use headers::{ContentLength, ContentRange, ContentType, HeaderMap, HeaderMapExt, Range};
use http::header::{self, HeaderValue};
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::ipc::IpcSender;
use log::warn;
use mime::{self, Mime};
use net_traits::blob_url_store::{BlobBuf, BlobURLStoreError};
@ -583,7 +584,8 @@ impl FileManagerStore {
multiple_files: bool,
embedder_proxy: EmbedderProxy,
) -> Option<Vec<PathBuf>> {
let (ipc_sender, ipc_receiver) = ipc::channel().expect("Failed to create IPC channel!");
let (ipc_sender, ipc_receiver) =
generic_channel::channel().expect("Failed to create IPC channel!");
embedder_proxy.send(EmbedderMsg::SelectFiles(
webview_id,
patterns,

View file

@ -9,6 +9,7 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH};
use async_recursion::async_recursion;
use base::cross_process_instant::CrossProcessInstant;
use base::generic_channel;
use base::id::{BrowsingContextId, HistoryStateId, PipelineId};
use crossbeam_channel::Sender;
use devtools_traits::{
@ -138,7 +139,7 @@ impl HttpState {
}
let embedder_proxy = self.embedder_proxy.lock().unwrap();
let (ipc_sender, ipc_receiver) = ipc::channel().unwrap();
let (ipc_sender, ipc_receiver) = generic_channel::channel().unwrap();
embedder_proxy.send(EmbedderMsg::RequestAuthentication(
webview_id,
request.url(),

View file

@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use base::generic_channel;
use content_security_policy::Destination;
use embedder_traits::{EmbedderMsg, EmbedderProxy, WebResourceRequest, WebResourceResponseMsg};
use ipc_channel::ipc;
use log::error;
use net_traits::NetworkError;
use net_traits::http_status::HttpStatus;
@ -29,7 +29,7 @@ impl RequestInterceptor {
response: &mut Option<Response>,
context: &FetchContext,
) {
let (sender, receiver) = ipc::channel().unwrap();
let (sender, receiver) = generic_channel::channel().unwrap();
let is_for_main_frame = matches!(request.destination, Destination::Document);
let web_resource_request = WebResourceRequest {
method: request.method.clone(),