Refactor constellation broadcast channel (#38077)

- Move the 2 hash maps used to manage channels in their own struct.
- The constellation is still in charge of origin checks since it holds
the pipeline information required.
- BroadcastMsg is renamed to BroadcastChannelMsg for consistency.


Testing: covered by existing tests.
Fixes: #38060

Signed-off-by: webbeef <me@webbeef.org>
This commit is contained in:
webbeef 2025-07-15 06:57:05 -07:00 committed by GitHub
parent 34829dfce7
commit 30b6e289e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 199 additions and 198 deletions

View file

@ -36,7 +36,7 @@ use strum_macros::IntoStaticStr;
use webgpu_traits::{WebGPU, WebGPUAdapterResponse};
use webrender_api::ImageKey;
use crate::structured_data::{BroadcastMsg, StructuredSerializedData};
use crate::structured_data::{BroadcastChannelMsg, StructuredSerializedData};
use crate::{
LogEntry, MessagePortMsg, PortMessageTask, PortTransferInfo, TraversalDirection, WindowSizeType,
};
@ -506,7 +506,7 @@ pub enum ScriptToConstellationMessage {
/// A global has started managing broadcast-channels.
NewBroadcastChannelRouter(
BroadcastChannelRouterId,
IpcSender<BroadcastMsg>,
IpcSender<BroadcastChannelMsg>,
ImmutableOrigin,
),
/// A global has stopped managing broadcast-channels.
@ -517,7 +517,7 @@ pub enum ScriptToConstellationMessage {
RemoveBroadcastChannelNameInRouter(BroadcastChannelRouterId, String, ImmutableOrigin),
/// Broadcast a message to all same-origin broadcast channels,
/// excluding the source of the broadcast.
ScheduleBroadcast(BroadcastChannelRouterId, BroadcastMsg),
ScheduleBroadcast(BroadcastChannelRouterId, BroadcastChannelMsg),
/// Forward a message to the embedder.
ForwardToEmbedder(EmbedderMsg),
/// Broadcast a storage event to every same-origin pipeline.