mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
MessagePort: implement disentanglement (#36654)
Implement [disentangle](https://html.spec.whatwg.org/multipage/#disentangle) Remove bespoke gc logic which now becomes unnecessary. Adds a wpt test that hits the "disentangle while in transfer" logic. Updates streams code, fixing an error where disentanglement is conditional on an error. Test coverage: there are existing tests in `/webmessaging/message-channels/close-event/explicitly-closed.tentative.window.js` for the no transfer case, and the simple completed transfer case, and this PR adds a test for the more complicated transfer in progress case. Fix https://github.com/servo/servo/issues/36465 --------- Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
This commit is contained in:
parent
c46402e222
commit
af5d665efa
19 changed files with 356 additions and 191 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! Messages send from the ScriptThread to the Constellation.
|
||||
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
|
||||
use base::Epoch;
|
||||
|
@ -35,7 +35,9 @@ use webgpu_traits::{WebGPU, WebGPUAdapterResponse};
|
|||
use webrender_api::ImageKey;
|
||||
|
||||
use crate::structured_data::{BroadcastMsg, StructuredSerializedData};
|
||||
use crate::{LogEntry, MessagePortMsg, PortMessageTask, TraversalDirection, WindowSizeType};
|
||||
use crate::{
|
||||
LogEntry, MessagePortMsg, PortMessageTask, PortTransferInfo, TraversalDirection, WindowSizeType,
|
||||
};
|
||||
|
||||
/// A Script to Constellation channel.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
|
@ -470,7 +472,7 @@ pub enum ScriptToConstellationMessage {
|
|||
/* The ids of ports transferred successfully */
|
||||
Vec<MessagePortId>,
|
||||
/* The ids, and buffers, of ports whose transfer failed */
|
||||
HashMap<MessagePortId, VecDeque<PortMessageTask>>,
|
||||
HashMap<MessagePortId, PortTransferInfo>,
|
||||
),
|
||||
/// A new message-port was created or transferred, with corresponding control-sender.
|
||||
NewMessagePort(MessagePortRouterId, MessagePortId),
|
||||
|
@ -482,10 +484,14 @@ pub enum ScriptToConstellationMessage {
|
|||
RerouteMessagePort(MessagePortId, PortMessageTask),
|
||||
/// A message-port was shipped, let the entangled port know.
|
||||
MessagePortShipped(MessagePortId),
|
||||
/// A message-port has been discarded by script.
|
||||
RemoveMessagePort(MessagePortId),
|
||||
/// Entangle two message-ports.
|
||||
EntanglePorts(MessagePortId, MessagePortId),
|
||||
/// Disentangle two message-ports.
|
||||
/// The first is the initiator, the second the other port,
|
||||
/// unless the message is sent to complete a disentanglement,
|
||||
/// in which case the first one is the other port,
|
||||
/// and the second is none.
|
||||
DisentanglePorts(MessagePortId, Option<MessagePortId>),
|
||||
/// A global has started managing broadcast-channels.
|
||||
NewBroadcastChannelRouter(
|
||||
BroadcastChannelRouterId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue