mirror of
https://github.com/servo/servo.git
synced 2025-09-27 15:20:09 +01:00
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:
parent
89e1357c75
commit
66d9f957e6
20 changed files with 107 additions and 95 deletions
|
@ -21,6 +21,7 @@ use std::ops::Range;
|
|||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use base::generic_channel::GenericSender;
|
||||
use base::id::{PipelineId, WebViewId};
|
||||
use crossbeam_channel::Sender;
|
||||
use euclid::{Point2D, Scale, Size2D};
|
||||
|
@ -147,20 +148,20 @@ pub enum SimpleDialog {
|
|||
/// TODO: Include details about the document origin.
|
||||
Alert {
|
||||
message: String,
|
||||
response_sender: IpcSender<AlertResponse>,
|
||||
response_sender: GenericSender<AlertResponse>,
|
||||
},
|
||||
/// [`confirm()`](https://html.spec.whatwg.org/multipage/#dom-confirm).
|
||||
/// TODO: Include details about the document origin.
|
||||
Confirm {
|
||||
message: String,
|
||||
response_sender: IpcSender<ConfirmResponse>,
|
||||
response_sender: GenericSender<ConfirmResponse>,
|
||||
},
|
||||
/// [`prompt()`](https://html.spec.whatwg.org/multipage/#dom-prompt).
|
||||
/// TODO: Include details about the document origin.
|
||||
Prompt {
|
||||
message: String,
|
||||
default: String,
|
||||
response_sender: IpcSender<PromptResponse>,
|
||||
response_sender: GenericSender<PromptResponse>,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -426,19 +427,22 @@ pub enum EmbedderMsg {
|
|||
WebViewId,
|
||||
ServoUrl,
|
||||
bool, /* for proxy */
|
||||
IpcSender<Option<AuthenticationResponse>>,
|
||||
GenericSender<Option<AuthenticationResponse>>,
|
||||
),
|
||||
/// Show a context menu to the user
|
||||
ShowContextMenu(
|
||||
WebViewId,
|
||||
IpcSender<ContextMenuResult>,
|
||||
GenericSender<ContextMenuResult>,
|
||||
Option<String>,
|
||||
Vec<String>,
|
||||
),
|
||||
/// Whether or not to allow a pipeline to load a url.
|
||||
AllowNavigationRequest(WebViewId, PipelineId, ServoUrl),
|
||||
/// Whether or not to allow script to open a new tab/browser
|
||||
AllowOpeningWebView(WebViewId, IpcSender<Option<(WebViewId, ViewportDetails)>>),
|
||||
AllowOpeningWebView(
|
||||
WebViewId,
|
||||
GenericSender<Option<(WebViewId, ViewportDetails)>>,
|
||||
),
|
||||
/// A webview was destroyed.
|
||||
WebViewClosed(WebViewId),
|
||||
/// A webview potentially gained focus for keyboard events, as initiated
|
||||
|
@ -448,7 +452,7 @@ pub enum EmbedderMsg {
|
|||
/// All webviews lost focus for keyboard events.
|
||||
WebViewBlurred,
|
||||
/// Wether or not to unload a document
|
||||
AllowUnload(WebViewId, IpcSender<AllowOrDeny>),
|
||||
AllowUnload(WebViewId, GenericSender<AllowOrDeny>),
|
||||
/// Sends an unconsumed key event back to the embedder.
|
||||
Keyboard(WebViewId, KeyboardEvent),
|
||||
/// Inform embedder to clear the clipboard
|
||||
|
@ -466,9 +470,9 @@ pub enum EmbedderMsg {
|
|||
/// A history traversal operation completed.
|
||||
HistoryTraversalComplete(WebViewId, TraversalId),
|
||||
/// Get the device independent window rectangle.
|
||||
GetWindowRect(WebViewId, IpcSender<DeviceIndependentIntRect>),
|
||||
GetWindowRect(WebViewId, GenericSender<DeviceIndependentIntRect>),
|
||||
/// Get the device independent screen size and available size.
|
||||
GetScreenMetrics(WebViewId, IpcSender<ScreenMetrics>),
|
||||
GetScreenMetrics(WebViewId, GenericSender<ScreenMetrics>),
|
||||
/// Entered or exited fullscreen.
|
||||
NotifyFullscreenStateChanged(WebViewId, bool),
|
||||
/// The [`LoadStatus`] of the Given `WebView` has changed.
|
||||
|
@ -476,21 +480,21 @@ pub enum EmbedderMsg {
|
|||
WebResourceRequested(
|
||||
Option<WebViewId>,
|
||||
WebResourceRequest,
|
||||
IpcSender<WebResourceResponseMsg>,
|
||||
GenericSender<WebResourceResponseMsg>,
|
||||
),
|
||||
/// A pipeline panicked. First string is the reason, second one is the backtrace.
|
||||
Panic(WebViewId, String, Option<String>),
|
||||
/// Open dialog to select bluetooth device.
|
||||
GetSelectedBluetoothDevice(WebViewId, Vec<String>, IpcSender<Option<String>>),
|
||||
GetSelectedBluetoothDevice(WebViewId, Vec<String>, GenericSender<Option<String>>),
|
||||
/// Open file dialog to select files. Set boolean flag to true allows to select multiple files.
|
||||
SelectFiles(
|
||||
WebViewId,
|
||||
Vec<FilterPattern>,
|
||||
bool,
|
||||
IpcSender<Option<Vec<PathBuf>>>,
|
||||
GenericSender<Option<Vec<PathBuf>>>,
|
||||
),
|
||||
/// Open interface to request permission specified by prompt.
|
||||
PromptPermission(WebViewId, PermissionFeature, IpcSender<AllowOrDeny>),
|
||||
PromptPermission(WebViewId, PermissionFeature, GenericSender<AllowOrDeny>),
|
||||
/// Request to present an IME to the user when an editable element is focused.
|
||||
/// If the input is text, the second parameter defines the pre-existing string
|
||||
/// text content and the zero-based index into the string locating the insertion point.
|
||||
|
@ -512,7 +516,7 @@ pub enum EmbedderMsg {
|
|||
/// Report the status of Devtools Server with a token that can be used to bypass the permission prompt.
|
||||
OnDevtoolsStarted(Result<u16, ()>, String),
|
||||
/// Ask the user to allow a devtools client to connect.
|
||||
RequestDevtoolsConnection(IpcSender<AllowOrDeny>),
|
||||
RequestDevtoolsConnection(GenericSender<AllowOrDeny>),
|
||||
/// Request to play a haptic effect on a connected gamepad.
|
||||
PlayGamepadHapticEffect(WebViewId, usize, GamepadHapticEffectType, IpcSender<bool>),
|
||||
/// Request to stop a haptic effect on a connected gamepad.
|
||||
|
@ -546,10 +550,10 @@ pub enum FormControl {
|
|||
SelectElement(
|
||||
Vec<SelectElementOptionOrOptgroup>,
|
||||
Option<usize>,
|
||||
IpcSender<Option<usize>>,
|
||||
GenericSender<Option<usize>>,
|
||||
),
|
||||
/// Indicates that the user has activated a `<input type=color>` element.
|
||||
ColorPicker(RgbColor, IpcSender<Option<RgbColor>>),
|
||||
ColorPicker(RgbColor, GenericSender<Option<RgbColor>>),
|
||||
}
|
||||
|
||||
/// Filter for file selection;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue