mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
constellation: Rename messages sent to the Constellation
(#36341)
Messages that are sent to the `Constellation` have pretty ambiguous names. This change does two renames: - `ConstellationMsg` → `EmbedderToConstellationMessage` - `ScriptMsg` → `ScriptToConstellationMessage` This naming reflects that the `Constellation` stands in between the embedding layer and the script layer and can receive messages from both. Soon both of these message types will live in `constellation_traits`, reflecting the idea that the `_traits` variant for a crate is responsible for exposing the API for that crate. Testing: No new tests are necessary here as this just renames two enums. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
c7a7862574
commit
5a35e1faec
37 changed files with 415 additions and 364 deletions
|
@ -11,7 +11,7 @@ use constellation_traits::UntrustedNodeAddress;
|
|||
use cssparser::ToCss;
|
||||
use fxhash::{FxHashMap, FxHashSet};
|
||||
use libc::c_void;
|
||||
use script_traits::{AnimationState as AnimationsPresentState, ScriptMsg};
|
||||
use script_traits::{AnimationState as AnimationsPresentState, ScriptToConstellationMessage};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use style::animation::{
|
||||
Animation, AnimationSetKey, AnimationState, DocumentAnimationSet, ElementAnimationSet,
|
||||
|
@ -186,7 +186,9 @@ impl Animations {
|
|||
true => AnimationsPresentState::AnimationsPresent,
|
||||
false => AnimationsPresentState::NoAnimationsPresent,
|
||||
};
|
||||
window.send_to_constellation(ScriptMsg::ChangeRunningAnimationsState(state));
|
||||
window.send_to_constellation(ScriptToConstellationMessage::ChangeRunningAnimationsState(
|
||||
state,
|
||||
));
|
||||
}
|
||||
|
||||
pub(crate) fn running_animation_count(&self) -> usize {
|
||||
|
|
|
@ -21,7 +21,7 @@ use net_traits::image_cache::{ImageCache, ImageResponse};
|
|||
use net_traits::request::CorsSettings;
|
||||
use pixels::PixelFormat;
|
||||
use profile_traits::ipc as profiled_ipc;
|
||||
use script_traits::ScriptMsg;
|
||||
use script_traits::ScriptToConstellationMessage;
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use style::color::{AbsoluteColor, ColorFlags, ColorSpace};
|
||||
use style::context::QuirksMode;
|
||||
|
@ -177,7 +177,9 @@ impl CanvasState {
|
|||
let script_to_constellation_chan = global.script_to_constellation_chan();
|
||||
debug!("Asking constellation to create new canvas thread.");
|
||||
script_to_constellation_chan
|
||||
.send(ScriptMsg::CreateCanvasPaintThread(size, sender))
|
||||
.send(ScriptToConstellationMessage::CreateCanvasPaintThread(
|
||||
size, sender,
|
||||
))
|
||||
.unwrap();
|
||||
let (ipc_renderer, canvas_id, image_key) = receiver.recv().unwrap();
|
||||
debug!("Done.");
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use base::id::WebViewId;
|
||||
use embedder_traits::EmbedderMsg;
|
||||
use ipc_channel::ipc::channel;
|
||||
use script_traits::{ScriptMsg, ScriptToConstellationChan};
|
||||
use script_traits::{ScriptToConstellationChan, ScriptToConstellationMessage};
|
||||
|
||||
/// A trait which abstracts access to the embedder's clipboard in order to allow unit
|
||||
/// testing clipboard-dependent parts of `script`.
|
||||
|
@ -25,19 +25,17 @@ impl ClipboardProvider for EmbedderClipboardProvider {
|
|||
fn get_text(&mut self) -> Result<String, String> {
|
||||
let (tx, rx) = channel().unwrap();
|
||||
self.constellation_sender
|
||||
.send(ScriptMsg::ForwardToEmbedder(EmbedderMsg::GetClipboardText(
|
||||
self.webview_id,
|
||||
tx,
|
||||
)))
|
||||
.send(ScriptToConstellationMessage::ForwardToEmbedder(
|
||||
EmbedderMsg::GetClipboardText(self.webview_id, tx),
|
||||
))
|
||||
.unwrap();
|
||||
rx.recv().unwrap()
|
||||
}
|
||||
fn set_text(&mut self, s: String) {
|
||||
self.constellation_sender
|
||||
.send(ScriptMsg::ForwardToEmbedder(EmbedderMsg::SetClipboardText(
|
||||
self.webview_id,
|
||||
s,
|
||||
)))
|
||||
.send(ScriptToConstellationMessage::ForwardToEmbedder(
|
||||
EmbedderMsg::SetClipboardText(self.webview_id, s),
|
||||
))
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ use dom_struct::dom_struct;
|
|||
use js::jsapi::{Heap, JSObject};
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue, MutableHandleValue};
|
||||
use script_traits::{ScriptMsg, StructuredSerializedData};
|
||||
use script_traits::{ScriptToConstellationMessage, StructuredSerializedData};
|
||||
use servo_url::ServoUrl;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::DissimilarOriginWindowBinding;
|
||||
|
@ -236,7 +236,7 @@ impl DissimilarOriginWindow {
|
|||
Err(_) => return Err(Error::Syntax),
|
||||
},
|
||||
};
|
||||
let msg = ScriptMsg::PostMessage {
|
||||
let msg = ScriptToConstellationMessage::PostMessage {
|
||||
target,
|
||||
source: incumbent.pipeline_id(),
|
||||
source_origin,
|
||||
|
|
|
@ -54,7 +54,8 @@ use profile_traits::time::TimerMetadataFrameType;
|
|||
use script_bindings::interfaces::DocumentHelpers;
|
||||
use script_layout_interface::{PendingRestyle, TrustedNodeAddress};
|
||||
use script_traits::{
|
||||
AnimationState, ConstellationInputEvent, DocumentActivity, ProgressiveWebMetricType, ScriptMsg,
|
||||
AnimationState, ConstellationInputEvent, DocumentActivity, ProgressiveWebMetricType,
|
||||
ScriptToConstellationMessage,
|
||||
};
|
||||
use servo_arc::Arc;
|
||||
use servo_config::pref;
|
||||
|
@ -1178,7 +1179,8 @@ impl Document {
|
|||
// Update the focus state for all elements in the focus chain.
|
||||
// https://html.spec.whatwg.org/multipage/#focus-chain
|
||||
if focus_type == FocusType::Element {
|
||||
self.window().send_to_constellation(ScriptMsg::Focus);
|
||||
self.window()
|
||||
.send_to_constellation(ScriptToConstellationMessage::Focus);
|
||||
}
|
||||
|
||||
// Notify the embedder to display an input method.
|
||||
|
@ -1223,10 +1225,11 @@ impl Document {
|
|||
if self.browsing_context().is_some() {
|
||||
self.send_title_to_embedder();
|
||||
let title = String::from(self.Title());
|
||||
self.window.send_to_constellation(ScriptMsg::TitleChanged(
|
||||
self.window.pipeline_id(),
|
||||
title.clone(),
|
||||
));
|
||||
self.window
|
||||
.send_to_constellation(ScriptToConstellationMessage::TitleChanged(
|
||||
self.window.pipeline_id(),
|
||||
title.clone(),
|
||||
));
|
||||
if let Some(chan) = self.window.as_global_scope().devtools_chan() {
|
||||
let _ = chan.send(ScriptToDevtoolsControlMsg::TitleChanged(
|
||||
self.window.pipeline_id(),
|
||||
|
@ -1665,7 +1668,7 @@ impl Document {
|
|||
ClipboardEventType::Paste => {
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
self.window
|
||||
.send_to_constellation(ScriptMsg::ForwardToEmbedder(
|
||||
.send_to_constellation(ScriptToConstellationMessage::ForwardToEmbedder(
|
||||
EmbedderMsg::GetClipboardText(self.window.webview_id(), sender),
|
||||
));
|
||||
let text_contents = receiver
|
||||
|
@ -2343,8 +2346,9 @@ impl Document {
|
|||
// This reduces CPU usage by avoiding needless thread wakeups in the common case of
|
||||
// repeated rAF.
|
||||
|
||||
let event =
|
||||
ScriptMsg::ChangeRunningAnimationsState(AnimationState::AnimationCallbacksPresent);
|
||||
let event = ScriptToConstellationMessage::ChangeRunningAnimationsState(
|
||||
AnimationState::AnimationCallbacksPresent,
|
||||
);
|
||||
self.window().send_to_constellation(event);
|
||||
}
|
||||
|
||||
|
@ -2439,7 +2443,7 @@ impl Document {
|
|||
// to expliclty trigger a OneshotTimerCallback for these queued callbacks.
|
||||
self.schedule_fake_animation_frame();
|
||||
}
|
||||
let event = ScriptMsg::ChangeRunningAnimationsState(
|
||||
let event = ScriptToConstellationMessage::ChangeRunningAnimationsState(
|
||||
AnimationState::NoAnimationCallbacksPresent,
|
||||
);
|
||||
self.window().send_to_constellation(event);
|
||||
|
@ -2448,10 +2452,11 @@ impl Document {
|
|||
// If we were previously faking animation frames, we need to re-enable video refresh
|
||||
// callbacks when we stop seeing spurious animation frames.
|
||||
if was_faking_animation_frames && !self.is_faking_animation_frames() && !is_empty {
|
||||
self.window()
|
||||
.send_to_constellation(ScriptMsg::ChangeRunningAnimationsState(
|
||||
self.window().send_to_constellation(
|
||||
ScriptToConstellationMessage::ChangeRunningAnimationsState(
|
||||
AnimationState::AnimationCallbacksPresent,
|
||||
));
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2690,7 +2695,7 @@ impl Document {
|
|||
if !self.salvageable.get() {
|
||||
// Step 1 of clean-up steps.
|
||||
global_scope.close_event_sources();
|
||||
let msg = ScriptMsg::DiscardDocument;
|
||||
let msg = ScriptToConstellationMessage::DiscardDocument;
|
||||
let _ = global_scope.script_to_constellation_chan().send(msg);
|
||||
}
|
||||
// https://w3c.github.io/FileAPI/#lifeTime
|
||||
|
@ -3064,7 +3069,8 @@ impl Document {
|
|||
}
|
||||
|
||||
pub(crate) fn notify_constellation_load(&self) {
|
||||
self.window().send_to_constellation(ScriptMsg::LoadComplete);
|
||||
self.window()
|
||||
.send_to_constellation(ScriptToConstellationMessage::LoadComplete);
|
||||
}
|
||||
|
||||
pub(crate) fn set_current_parser(&self, script: Option<&ServoParser>) {
|
||||
|
|
|
@ -58,7 +58,8 @@ use script_bindings::interfaces::GlobalScopeHelpers;
|
|||
use script_traits::serializable::{BlobData, BlobImpl, FileBlob};
|
||||
use script_traits::transferable::MessagePortImpl;
|
||||
use script_traits::{
|
||||
BroadcastMsg, MessagePortMsg, PortMessageTask, ScriptMsg, ScriptToConstellationChan,
|
||||
BroadcastMsg, MessagePortMsg, PortMessageTask, ScriptToConstellationChan,
|
||||
ScriptToConstellationMessage,
|
||||
};
|
||||
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
|
||||
use timers::{TimerEventId, TimerEventRequest, TimerSource};
|
||||
|
@ -526,7 +527,7 @@ impl MessageListener {
|
|||
// If not managing any ports, no transfer can succeed,
|
||||
// so just send back everything.
|
||||
let _ = global.script_to_constellation_chan().send(
|
||||
ScriptMsg::MessagePortTransferResult(None, vec![], ports),
|
||||
ScriptToConstellationMessage::MessagePortTransferResult(None, vec![], ports),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -544,7 +545,7 @@ impl MessageListener {
|
|||
}
|
||||
}
|
||||
let _ = global.script_to_constellation_chan().send(
|
||||
ScriptMsg::MessagePortTransferResult(Some(router_id), succeeded, failed),
|
||||
ScriptToConstellationMessage::MessagePortTransferResult(Some(router_id), succeeded, failed),
|
||||
);
|
||||
})
|
||||
);
|
||||
|
@ -916,9 +917,9 @@ impl GlobalScope {
|
|||
if let MessagePortState::Managed(router_id, _message_ports) =
|
||||
&*self.message_port_state.borrow()
|
||||
{
|
||||
let _ = self
|
||||
.script_to_constellation_chan()
|
||||
.send(ScriptMsg::RemoveMessagePortRouter(*router_id));
|
||||
let _ = self.script_to_constellation_chan().send(
|
||||
ScriptToConstellationMessage::RemoveMessagePortRouter(*router_id),
|
||||
);
|
||||
}
|
||||
*self.message_port_state.borrow_mut() = MessagePortState::UnManaged;
|
||||
}
|
||||
|
@ -929,12 +930,12 @@ impl GlobalScope {
|
|||
if let BroadcastChannelState::Managed(router_id, _channels) =
|
||||
&*self.broadcast_channel_state.borrow()
|
||||
{
|
||||
let _ =
|
||||
self.script_to_constellation_chan()
|
||||
.send(ScriptMsg::RemoveBroadcastChannelRouter(
|
||||
*router_id,
|
||||
self.origin().immutable().clone(),
|
||||
));
|
||||
let _ = self.script_to_constellation_chan().send(
|
||||
ScriptToConstellationMessage::RemoveBroadcastChannelRouter(
|
||||
*router_id,
|
||||
self.origin().immutable().clone(),
|
||||
),
|
||||
);
|
||||
}
|
||||
*self.broadcast_channel_state.borrow_mut() = BroadcastChannelState::UnManaged;
|
||||
}
|
||||
|
@ -965,7 +966,7 @@ impl GlobalScope {
|
|||
|
||||
let _ = self
|
||||
.script_to_constellation_chan()
|
||||
.send(ScriptMsg::EntanglePorts(port1, port2));
|
||||
.send(ScriptToConstellationMessage::EntanglePorts(port1, port2));
|
||||
}
|
||||
|
||||
/// Note that the entangled port of `port_id` has been removed in another global.
|
||||
|
@ -997,7 +998,7 @@ impl GlobalScope {
|
|||
port_impl.set_has_been_shipped();
|
||||
let _ = self
|
||||
.script_to_constellation_chan()
|
||||
.send(ScriptMsg::MessagePortShipped(*port_id));
|
||||
.send(ScriptToConstellationMessage::MessagePortShipped(*port_id));
|
||||
port_impl
|
||||
} else {
|
||||
panic!("mark_port_as_transferred called on a global not managing any ports.");
|
||||
|
@ -1093,9 +1094,9 @@ impl GlobalScope {
|
|||
/// If we don't know about the port,
|
||||
/// send the message to the constellation for routing.
|
||||
fn re_route_port_task(&self, port_id: MessagePortId, task: PortMessageTask) {
|
||||
let _ = self
|
||||
.script_to_constellation_chan()
|
||||
.send(ScriptMsg::RerouteMessagePort(port_id, task));
|
||||
let _ = self.script_to_constellation_chan().send(
|
||||
ScriptToConstellationMessage::RerouteMessagePort(port_id, task),
|
||||
);
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-broadcastchannel-postmessage>
|
||||
|
@ -1111,9 +1112,9 @@ impl GlobalScope {
|
|||
//
|
||||
// Note: for globals in the same script-thread,
|
||||
// we could skip the hop to the constellation.
|
||||
let _ = self
|
||||
.script_to_constellation_chan()
|
||||
.send(ScriptMsg::ScheduleBroadcast(*router_id, msg));
|
||||
let _ = self.script_to_constellation_chan().send(
|
||||
ScriptToConstellationMessage::ScheduleBroadcast(*router_id, msg),
|
||||
);
|
||||
} else {
|
||||
panic!("Attemps to broadcast a message via global not managing any channels.");
|
||||
}
|
||||
|
@ -1286,12 +1287,9 @@ impl GlobalScope {
|
|||
}
|
||||
managed_port.pending = false;
|
||||
}
|
||||
let _ =
|
||||
self.script_to_constellation_chan()
|
||||
.send(ScriptMsg::CompleteMessagePortTransfer(
|
||||
*router_id,
|
||||
to_be_added,
|
||||
));
|
||||
let _ = self.script_to_constellation_chan().send(
|
||||
ScriptToConstellationMessage::CompleteMessagePortTransfer(*router_id, to_be_added),
|
||||
);
|
||||
} else {
|
||||
warn!("maybe_add_pending_ports called on a global not managing any ports.");
|
||||
}
|
||||
|
@ -1310,7 +1308,7 @@ impl GlobalScope {
|
|||
// and to forward this message to the script-process where the entangled is found.
|
||||
let _ = self
|
||||
.script_to_constellation_chan()
|
||||
.send(ScriptMsg::RemoveMessagePort(*id));
|
||||
.send(ScriptToConstellationMessage::RemoveMessagePort(*id));
|
||||
Some(*id)
|
||||
} else {
|
||||
None
|
||||
|
@ -1340,7 +1338,7 @@ impl GlobalScope {
|
|||
channels.retain(|chan| !chan.closed());
|
||||
if channels.is_empty() {
|
||||
let _ = self.script_to_constellation_chan().send(
|
||||
ScriptMsg::RemoveBroadcastChannelNameInRouter(
|
||||
ScriptToConstellationMessage::RemoveBroadcastChannelNameInRouter(
|
||||
*router_id,
|
||||
name.to_string(),
|
||||
self.origin().immutable().clone(),
|
||||
|
@ -1382,19 +1380,19 @@ impl GlobalScope {
|
|||
);
|
||||
let router_id = BroadcastChannelRouterId::new();
|
||||
*current_state = BroadcastChannelState::Managed(router_id, HashMap::new());
|
||||
let _ = self
|
||||
.script_to_constellation_chan()
|
||||
.send(ScriptMsg::NewBroadcastChannelRouter(
|
||||
let _ = self.script_to_constellation_chan().send(
|
||||
ScriptToConstellationMessage::NewBroadcastChannelRouter(
|
||||
router_id,
|
||||
broadcast_control_sender,
|
||||
self.origin().immutable().clone(),
|
||||
));
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if let BroadcastChannelState::Managed(router_id, channels) = &mut *current_state {
|
||||
let entry = channels.entry(dom_channel.Name()).or_insert_with(|| {
|
||||
let _ = self.script_to_constellation_chan().send(
|
||||
ScriptMsg::NewBroadcastChannelNameInRouter(
|
||||
ScriptToConstellationMessage::NewBroadcastChannelNameInRouter(
|
||||
*router_id,
|
||||
dom_channel.Name().to_string(),
|
||||
self.origin().immutable().clone(),
|
||||
|
@ -1434,12 +1432,9 @@ impl GlobalScope {
|
|||
);
|
||||
let router_id = MessagePortRouterId::new();
|
||||
*current_state = MessagePortState::Managed(router_id, HashMapTracedValues::new());
|
||||
let _ = self
|
||||
.script_to_constellation_chan()
|
||||
.send(ScriptMsg::NewMessagePortRouter(
|
||||
router_id,
|
||||
port_control_sender,
|
||||
));
|
||||
let _ = self.script_to_constellation_chan().send(
|
||||
ScriptToConstellationMessage::NewMessagePortRouter(router_id, port_control_sender),
|
||||
);
|
||||
}
|
||||
|
||||
if let MessagePortState::Managed(router_id, message_ports) = &mut *current_state {
|
||||
|
@ -1478,12 +1473,12 @@ impl GlobalScope {
|
|||
closed: false,
|
||||
},
|
||||
);
|
||||
let _ = self
|
||||
.script_to_constellation_chan()
|
||||
.send(ScriptMsg::NewMessagePort(
|
||||
let _ = self.script_to_constellation_chan().send(
|
||||
ScriptToConstellationMessage::NewMessagePort(
|
||||
*router_id,
|
||||
*dom_port.message_port_id(),
|
||||
));
|
||||
),
|
||||
);
|
||||
};
|
||||
} else {
|
||||
panic!("track_message_port should have first switched the state to managed.");
|
||||
|
@ -2229,10 +2224,10 @@ impl GlobalScope {
|
|||
}
|
||||
|
||||
pub(crate) fn send_to_embedder(&self, msg: EmbedderMsg) {
|
||||
self.send_to_constellation(ScriptMsg::ForwardToEmbedder(msg));
|
||||
self.send_to_constellation(ScriptToConstellationMessage::ForwardToEmbedder(msg));
|
||||
}
|
||||
|
||||
pub(crate) fn send_to_constellation(&self, msg: ScriptMsg) {
|
||||
pub(crate) fn send_to_constellation(&self, msg: ScriptToConstellationMessage) {
|
||||
self.script_to_constellation_chan().send(msg).unwrap();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ use js::rust::{HandleValue, MutableHandleValue};
|
|||
use net_traits::{CoreResourceMsg, IpcSend};
|
||||
use profile_traits::ipc;
|
||||
use profile_traits::ipc::channel;
|
||||
use script_traits::{ScriptMsg, StructuredSerializedData};
|
||||
use script_traits::{ScriptToConstellationMessage, StructuredSerializedData};
|
||||
use servo_url::ServoUrl;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::HistoryBinding::HistoryMethods;
|
||||
|
@ -72,7 +72,7 @@ impl History {
|
|||
if !self.window.Document().is_fully_active() {
|
||||
return Err(Error::Security);
|
||||
}
|
||||
let msg = ScriptMsg::TraverseHistory(direction);
|
||||
let msg = ScriptToConstellationMessage::TraverseHistory(direction);
|
||||
let _ = self
|
||||
.window
|
||||
.as_global_scope()
|
||||
|
@ -227,7 +227,7 @@ impl History {
|
|||
PushOrReplace::Push => {
|
||||
let state_id = HistoryStateId::new();
|
||||
self.state_id.set(Some(state_id));
|
||||
let msg = ScriptMsg::PushHistoryState(state_id, new_url.clone());
|
||||
let msg = ScriptToConstellationMessage::PushHistoryState(state_id, new_url.clone());
|
||||
let _ = self
|
||||
.window
|
||||
.as_global_scope()
|
||||
|
@ -244,7 +244,8 @@ impl History {
|
|||
state_id
|
||||
},
|
||||
};
|
||||
let msg = ScriptMsg::ReplaceHistoryState(state_id, new_url.clone());
|
||||
let msg =
|
||||
ScriptToConstellationMessage::ReplaceHistoryState(state_id, new_url.clone());
|
||||
let _ = self
|
||||
.window
|
||||
.as_global_scope()
|
||||
|
@ -339,7 +340,7 @@ impl HistoryMethods<crate::DomTypeHolder> for History {
|
|||
}
|
||||
let (sender, recv) = channel(self.global().time_profiler_chan().clone())
|
||||
.expect("Failed to create channel to send jsh length.");
|
||||
let msg = ScriptMsg::JointSessionHistoryLength(sender);
|
||||
let msg = ScriptToConstellationMessage::JointSessionHistoryLength(sender);
|
||||
let _ = self
|
||||
.window
|
||||
.as_global_scope()
|
||||
|
|
|
@ -21,7 +21,7 @@ use js::error::throw_type_error;
|
|||
use js::rust::{HandleObject, HandleValue};
|
||||
use script_layout_interface::{HTMLCanvasData, HTMLCanvasDataSource};
|
||||
#[cfg(feature = "webgpu")]
|
||||
use script_traits::ScriptMsg;
|
||||
use script_traits::ScriptToConstellationMessage;
|
||||
use script_traits::serializable::BlobImpl;
|
||||
use servo_media::streams::MediaStreamType;
|
||||
use servo_media::streams::registry::MediaStreamId;
|
||||
|
@ -334,7 +334,7 @@ impl HTMLCanvasElement {
|
|||
let global_scope = self.owner_global();
|
||||
let _ = global_scope
|
||||
.script_to_constellation_chan()
|
||||
.send(ScriptMsg::GetWebGPUChan(sender));
|
||||
.send(ScriptToConstellationMessage::GetWebGPUChan(sender));
|
||||
receiver
|
||||
.recv()
|
||||
.expect("Failed to get WebGPU channel")
|
||||
|
|
|
@ -15,7 +15,7 @@ use profile_traits::ipc as ProfiledIpc;
|
|||
use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
|
||||
use script_traits::{
|
||||
IFrameLoadInfo, IFrameLoadInfoWithData, JsEvalResult, LoadData, LoadOrigin,
|
||||
NavigationHistoryBehavior, NewLayoutInfo, ScriptMsg, UpdatePipelineIdReason,
|
||||
NavigationHistoryBehavior, NewLayoutInfo, ScriptToConstellationMessage, UpdatePipelineIdReason,
|
||||
};
|
||||
use servo_url::ServoUrl;
|
||||
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
||||
|
@ -217,7 +217,7 @@ impl HTMLIFrameElement {
|
|||
window
|
||||
.as_global_scope()
|
||||
.script_to_constellation_chan()
|
||||
.send(ScriptMsg::ScriptNewIFrame(load_info))
|
||||
.send(ScriptToConstellationMessage::ScriptNewIFrame(load_info))
|
||||
.unwrap();
|
||||
|
||||
let new_layout_info = NewLayoutInfo {
|
||||
|
@ -244,7 +244,9 @@ impl HTMLIFrameElement {
|
|||
window
|
||||
.as_global_scope()
|
||||
.script_to_constellation_chan()
|
||||
.send(ScriptMsg::ScriptLoadedURLInIFrame(load_info))
|
||||
.send(ScriptToConstellationMessage::ScriptLoadedURLInIFrame(
|
||||
load_info,
|
||||
))
|
||||
.unwrap();
|
||||
},
|
||||
}
|
||||
|
@ -782,7 +784,7 @@ impl VirtualMethods for HTMLIFrameElement {
|
|||
};
|
||||
debug!("Unbinding frame {}.", browsing_context_id);
|
||||
|
||||
let msg = ScriptMsg::RemoveIFrame(browsing_context_id, sender);
|
||||
let msg = ScriptToConstellationMessage::RemoveIFrame(browsing_context_id, sender);
|
||||
window
|
||||
.as_global_scope()
|
||||
.script_to_constellation_chan()
|
||||
|
|
|
@ -8,7 +8,7 @@ use dom_struct::dom_struct;
|
|||
use embedder_traits::{
|
||||
MediaMetadata as EmbedderMediaMetadata, MediaSessionActionType, MediaSessionEvent,
|
||||
};
|
||||
use script_traits::ScriptMsg;
|
||||
use script_traits::ScriptToConstellationMessage;
|
||||
|
||||
use super::bindings::trace::HashMapTracedValues;
|
||||
use crate::conversions::Convert;
|
||||
|
@ -106,7 +106,10 @@ impl MediaSession {
|
|||
let global = self.global();
|
||||
let window = global.as_window();
|
||||
let pipeline_id = window.pipeline_id();
|
||||
window.send_to_constellation(ScriptMsg::MediaSessionEvent(pipeline_id, event));
|
||||
window.send_to_constellation(ScriptToConstellationMessage::MediaSessionEvent(
|
||||
pipeline_id,
|
||||
event,
|
||||
));
|
||||
}
|
||||
|
||||
pub(crate) fn update_title(&self, title: String) {
|
||||
|
|
|
@ -8,7 +8,7 @@ use base::id::ServiceWorkerId;
|
|||
use dom_struct::dom_struct;
|
||||
use js::jsapi::{Heap, JSObject};
|
||||
use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue};
|
||||
use script_traits::{DOMMessage, ScriptMsg};
|
||||
use script_traits::{DOMMessage, ScriptToConstellationMessage};
|
||||
use servo_url::ServoUrl;
|
||||
|
||||
use crate::dom::abstractworker::SimpleWorkerErrorHandler;
|
||||
|
@ -109,13 +109,9 @@ impl ServiceWorker {
|
|||
origin: incumbent.origin().immutable().clone(),
|
||||
data,
|
||||
};
|
||||
let _ = self
|
||||
.global()
|
||||
.script_to_constellation_chan()
|
||||
.send(ScriptMsg::ForwardDOMMessage(
|
||||
msg_vec,
|
||||
self.scope_url.clone(),
|
||||
));
|
||||
let _ = self.global().script_to_constellation_chan().send(
|
||||
ScriptToConstellationMessage::ForwardDOMMessage(msg_vec, self.scope_url.clone()),
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,9 @@ use std::rc::Rc;
|
|||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc;
|
||||
use ipc_channel::router::ROUTER;
|
||||
use script_traits::{Job, JobError, JobResult, JobResultValue, JobType, ScriptMsg};
|
||||
use script_traits::{
|
||||
Job, JobError, JobResult, JobResultValue, JobType, ScriptToConstellationMessage,
|
||||
};
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::{
|
||||
RegistrationOptions, ServiceWorkerContainerMethods,
|
||||
|
@ -179,7 +181,7 @@ impl ServiceWorkerContainerMethods<crate::DomTypeHolder> for ServiceWorkerContai
|
|||
// B: Step 14: schedule job.
|
||||
let _ = global
|
||||
.script_to_constellation_chan()
|
||||
.send(ScriptMsg::ScheduleJob(job));
|
||||
.send(ScriptToConstellationMessage::ScheduleJob(job));
|
||||
|
||||
// A: Step 7
|
||||
promise
|
||||
|
|
|
@ -9,7 +9,7 @@ use js::rust::HandleObject;
|
|||
use profile_traits::mem::MemoryReportResult;
|
||||
use script_bindings::interfaces::ServoInternalsHelpers;
|
||||
use script_bindings::script_runtime::JSContext;
|
||||
use script_traits::ScriptMsg;
|
||||
use script_traits::ScriptToConstellationMessage;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::ServoInternalsBinding::ServoInternalsMethods;
|
||||
use crate::dom::bindings::error::Error;
|
||||
|
@ -46,7 +46,7 @@ impl ServoInternalsMethods<crate::DomTypeHolder> for ServoInternals {
|
|||
let sender = route_promise(&promise, self);
|
||||
let script_to_constellation_chan = global.script_to_constellation_chan();
|
||||
if script_to_constellation_chan
|
||||
.send(ScriptMsg::ReportMemory(sender))
|
||||
.send(ScriptToConstellationMessage::ReportMemory(sender))
|
||||
.is_err()
|
||||
{
|
||||
promise.reject_error(Error::Operation, can_gc);
|
||||
|
|
|
@ -7,7 +7,7 @@ use ipc_channel::ipc::IpcSender;
|
|||
use net_traits::IpcSend;
|
||||
use net_traits::storage_thread::{StorageThreadMsg, StorageType};
|
||||
use profile_traits::ipc;
|
||||
use script_traits::ScriptMsg;
|
||||
use script_traits::ScriptToConstellationMessage;
|
||||
use servo_url::ServoUrl;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::StorageBinding::StorageMethods;
|
||||
|
@ -195,7 +195,9 @@ impl Storage {
|
|||
) {
|
||||
let storage = self.storage_type;
|
||||
let url = self.get_url();
|
||||
let msg = ScriptMsg::BroadcastStorageEvent(storage, url, key, old_value, new_value);
|
||||
let msg = ScriptToConstellationMessage::BroadcastStorageEvent(
|
||||
storage, url, key, old_value, new_value,
|
||||
);
|
||||
self.global()
|
||||
.script_to_constellation_chan()
|
||||
.send(msg)
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::rc::Rc;
|
|||
|
||||
use dom_struct::dom_struct;
|
||||
use js::jsapi::Heap;
|
||||
use script_traits::ScriptMsg;
|
||||
use script_traits::ScriptToConstellationMessage;
|
||||
use webgpu_traits::WebGPUAdapterResponse;
|
||||
use wgpu_types::PowerPreference;
|
||||
|
||||
|
@ -66,7 +66,7 @@ impl GPUMethods<crate::DomTypeHolder> for GPU {
|
|||
|
||||
let script_to_constellation_chan = global.script_to_constellation_chan();
|
||||
if script_to_constellation_chan
|
||||
.send(ScriptMsg::RequestAdapter(
|
||||
.send(ScriptToConstellationMessage::RequestAdapter(
|
||||
sender,
|
||||
wgpu_core::instance::RequestAdapterOptions {
|
||||
power_preference,
|
||||
|
|
|
@ -63,8 +63,8 @@ use script_layout_interface::{
|
|||
TrustedNodeAddress, combine_id_with_fragment_type,
|
||||
};
|
||||
use script_traits::{
|
||||
DocumentState, LoadData, LoadOrigin, NavigationHistoryBehavior, ScriptMsg, ScriptThreadMessage,
|
||||
ScriptToConstellationChan, StructuredSerializedData,
|
||||
DocumentState, LoadData, LoadOrigin, NavigationHistoryBehavior, ScriptThreadMessage,
|
||||
ScriptToConstellationChan, ScriptToConstellationMessage, StructuredSerializedData,
|
||||
};
|
||||
use selectors::attr::CaseSensitivity;
|
||||
use servo_arc::Arc as ServoArc;
|
||||
|
@ -904,7 +904,7 @@ impl WindowMethods<crate::DomTypeHolder> for Window {
|
|||
// which calls into https://html.spec.whatwg.org/multipage/#discard-a-document.
|
||||
window.discard_browsing_context();
|
||||
|
||||
window.send_to_constellation(ScriptMsg::DiscardTopLevelBrowsingContext);
|
||||
window.send_to_constellation(ScriptToConstellationMessage::DiscardTopLevelBrowsingContext);
|
||||
}
|
||||
});
|
||||
self.as_global_scope()
|
||||
|
@ -2047,7 +2047,7 @@ impl Window {
|
|||
.iframes_mut()
|
||||
.handle_new_iframe_sizes_after_layout(results.iframe_sizes);
|
||||
if !size_messages.is_empty() {
|
||||
self.send_to_constellation(ScriptMsg::IFrameSizes(size_messages));
|
||||
self.send_to_constellation(ScriptToConstellationMessage::IFrameSizes(size_messages));
|
||||
}
|
||||
document
|
||||
.image_animation_manager_mut()
|
||||
|
@ -2145,7 +2145,7 @@ impl Window {
|
|||
"{:?}: Sending DocumentState::Idle to Constellation",
|
||||
self.pipeline_id()
|
||||
);
|
||||
let event = ScriptMsg::SetDocumentState(DocumentState::Idle);
|
||||
let event = ScriptToConstellationMessage::SetDocumentState(DocumentState::Idle);
|
||||
self.send_to_constellation(event);
|
||||
self.has_sent_idle_message.set(true);
|
||||
}
|
||||
|
@ -2227,7 +2227,7 @@ impl Window {
|
|||
self.pipeline_id()
|
||||
);
|
||||
let (sender, receiver) = ipc::channel().expect("Failed to create IPC channel!");
|
||||
let event = ScriptMsg::SetLayoutEpoch(epoch, sender);
|
||||
let event = ScriptToConstellationMessage::SetLayoutEpoch(epoch, sender);
|
||||
self.send_to_constellation(event);
|
||||
let _ = receiver.recv();
|
||||
}
|
||||
|
@ -2445,7 +2445,7 @@ impl Window {
|
|||
// Step 6
|
||||
// TODO: Fragment handling appears to have moved to step 13
|
||||
if let Some(fragment) = load_data.url.fragment() {
|
||||
self.send_to_constellation(ScriptMsg::NavigatedToFragment(
|
||||
self.send_to_constellation(ScriptToConstellationMessage::NavigatedToFragment(
|
||||
load_data.url.clone(),
|
||||
history_handling,
|
||||
));
|
||||
|
@ -2769,10 +2769,10 @@ impl Window {
|
|||
}
|
||||
|
||||
pub(crate) fn send_to_embedder(&self, msg: EmbedderMsg) {
|
||||
self.send_to_constellation(ScriptMsg::ForwardToEmbedder(msg));
|
||||
self.send_to_constellation(ScriptToConstellationMessage::ForwardToEmbedder(msg));
|
||||
}
|
||||
|
||||
pub(crate) fn send_to_constellation(&self, msg: ScriptMsg) {
|
||||
pub(crate) fn send_to_constellation(&self, msg: ScriptToConstellationMessage) {
|
||||
self.as_global_scope()
|
||||
.script_to_constellation_chan()
|
||||
.send(msg)
|
||||
|
|
|
@ -31,7 +31,7 @@ use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
|||
use net_traits::request::Referrer;
|
||||
use script_traits::{
|
||||
AuxiliaryWebViewCreationRequest, LoadData, LoadOrigin, NavigationHistoryBehavior,
|
||||
NewLayoutInfo, ScriptMsg,
|
||||
NewLayoutInfo, ScriptToConstellationMessage,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
|
@ -314,7 +314,7 @@ impl WindowProxy {
|
|||
opener_pipeline_id: self.currently_active.get().unwrap(),
|
||||
response_sender,
|
||||
};
|
||||
let constellation_msg = ScriptMsg::CreateAuxiliaryWebView(load_info);
|
||||
let constellation_msg = ScriptToConstellationMessage::CreateAuxiliaryWebView(load_info);
|
||||
window.send_to_constellation(constellation_msg);
|
||||
|
||||
let response = response_receiver.recv().unwrap()?;
|
||||
|
@ -863,7 +863,7 @@ unsafe fn GetSubframeWindowProxy(
|
|||
let (result_sender, result_receiver) = ipc::channel().unwrap();
|
||||
|
||||
let _ = win.as_global_scope().script_to_constellation_chan().send(
|
||||
ScriptMsg::GetChildBrowsingContextId(
|
||||
ScriptToConstellationMessage::GetChildBrowsingContextId(
|
||||
browsing_context_id,
|
||||
index as usize,
|
||||
result_sender,
|
||||
|
@ -882,7 +882,7 @@ unsafe fn GetSubframeWindowProxy(
|
|||
let (result_sender, result_receiver) = ipc::channel().unwrap();
|
||||
|
||||
let _ = win.global().script_to_constellation_chan().send(
|
||||
ScriptMsg::GetChildBrowsingContextId(
|
||||
ScriptToConstellationMessage::GetChildBrowsingContextId(
|
||||
browsing_context_id,
|
||||
index as usize,
|
||||
result_sender,
|
||||
|
|
|
@ -14,7 +14,7 @@ use js::rust::Runtime;
|
|||
use net_traits::ResourceThreads;
|
||||
use net_traits::image_cache::ImageCache;
|
||||
use profile_traits::{mem, time};
|
||||
use script_traits::{Painter, ScriptMsg, ScriptToConstellationChan};
|
||||
use script_traits::{Painter, ScriptToConstellationChan, ScriptToConstellationMessage};
|
||||
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
|
||||
use stylo_atoms::Atom;
|
||||
|
||||
|
@ -180,7 +180,7 @@ pub(crate) struct WorkletGlobalScopeInit {
|
|||
/// Channel to devtools
|
||||
pub(crate) devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||
/// Messages to send to constellation
|
||||
pub(crate) to_constellation_sender: IpcSender<(PipelineId, ScriptMsg)>,
|
||||
pub(crate) to_constellation_sender: IpcSender<(PipelineId, ScriptToConstellationMessage)>,
|
||||
/// The image cache
|
||||
pub(crate) image_cache: Arc<dyn ImageCache>,
|
||||
/// Identity manager for WebGPU resources
|
||||
|
|
|
@ -18,7 +18,7 @@ use net_traits::FetchResponseMsg;
|
|||
use net_traits::image_cache::PendingImageResponse;
|
||||
use profile_traits::mem::{self as profile_mem, OpaqueSender, ReportsChan};
|
||||
use profile_traits::time::{self as profile_time};
|
||||
use script_traits::{Painter, ScriptMsg, ScriptThreadMessage};
|
||||
use script_traits::{Painter, ScriptThreadMessage, ScriptToConstellationMessage};
|
||||
use stylo_atoms::Atom;
|
||||
use timers::TimerScheduler;
|
||||
#[cfg(feature = "webgpu")]
|
||||
|
@ -315,7 +315,8 @@ pub(crate) struct ScriptThreadSenders {
|
|||
/// A [`Sender`] that sends messages to the `Constellation` associated with
|
||||
/// particular pipelines.
|
||||
#[no_trace]
|
||||
pub(crate) pipeline_to_constellation_sender: IpcSender<(PipelineId, ScriptMsg)>,
|
||||
pub(crate) pipeline_to_constellation_sender:
|
||||
IpcSender<(PipelineId, ScriptToConstellationMessage)>,
|
||||
|
||||
/// The shared [`IpcSender`] which is sent to the `ImageCache` when requesting an image. The
|
||||
/// messages on this channel are routed to crossbeam [`Sender`] on the router thread, which
|
||||
|
|
|
@ -80,8 +80,8 @@ use script_layout_interface::{
|
|||
use script_traits::{
|
||||
ConstellationInputEvent, DiscardBrowsingContext, DocumentActivity, InitialScriptState,
|
||||
JsEvalResult, LoadData, LoadOrigin, NavigationHistoryBehavior, NewLayoutInfo, Painter,
|
||||
ProgressiveWebMetricType, ScriptMsg, ScriptThreadMessage, ScriptToConstellationChan,
|
||||
StructuredSerializedData, UpdatePipelineIdReason,
|
||||
ProgressiveWebMetricType, ScriptThreadMessage, ScriptToConstellationChan,
|
||||
ScriptToConstellationMessage, StructuredSerializedData, UpdatePipelineIdReason,
|
||||
};
|
||||
use servo_config::opts;
|
||||
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
|
||||
|
@ -609,7 +609,7 @@ impl ScriptThread {
|
|||
if ScriptThread::check_load_origin(&load_data.load_origin, &window.get_url().origin()) {
|
||||
ScriptThread::eval_js_url(&trusted_global.root(), &mut load_data, CanGc::note());
|
||||
sender
|
||||
.send((pipeline_id, ScriptMsg::LoadUrl(load_data, history_handling)))
|
||||
.send((pipeline_id, ScriptToConstellationMessage::LoadUrl(load_data, history_handling)))
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
@ -629,7 +629,10 @@ impl ScriptThread {
|
|||
script_thread
|
||||
.senders
|
||||
.pipeline_to_constellation_sender
|
||||
.send((pipeline_id, ScriptMsg::LoadUrl(load_data, history_handling)))
|
||||
.send((
|
||||
pipeline_id,
|
||||
ScriptToConstellationMessage::LoadUrl(load_data, history_handling),
|
||||
))
|
||||
.expect("Sending a LoadUrl message to the constellation failed");
|
||||
}
|
||||
});
|
||||
|
@ -1098,7 +1101,7 @@ impl ScriptThread {
|
|||
touch_event.event_type,
|
||||
)
|
||||
};
|
||||
let message = ScriptMsg::TouchEventProcessed(result);
|
||||
let message = ScriptToConstellationMessage::TouchEventProcessed(result);
|
||||
self.senders
|
||||
.pipeline_to_constellation_sender
|
||||
.send((pipeline_id, message))
|
||||
|
@ -2447,7 +2450,10 @@ impl ScriptThread {
|
|||
// domain)
|
||||
self.senders
|
||||
.pipeline_to_constellation_sender
|
||||
.send((id, ScriptMsg::SetThrottledComplete(throttled)))
|
||||
.send((
|
||||
id,
|
||||
ScriptToConstellationMessage::SetThrottledComplete(throttled),
|
||||
))
|
||||
.unwrap();
|
||||
|
||||
let window = self.documents.borrow().find_window(id);
|
||||
|
@ -2694,7 +2700,7 @@ impl ScriptThread {
|
|||
}
|
||||
self.senders
|
||||
.pipeline_to_constellation_sender
|
||||
.send((*id, ScriptMsg::AbortLoadUrl))
|
||||
.send((*id, ScriptToConstellationMessage::AbortLoadUrl))
|
||||
.unwrap();
|
||||
return None;
|
||||
};
|
||||
|
@ -2752,7 +2758,7 @@ impl ScriptThread {
|
|||
debug!("{id}: Sending PipelineExited message to constellation");
|
||||
self.senders
|
||||
.pipeline_to_constellation_sender
|
||||
.send((id, ScriptMsg::PipelineExited))
|
||||
.send((id, ScriptToConstellationMessage::PipelineExited))
|
||||
.ok();
|
||||
|
||||
// Clear any active animations and unroot all of the associated DOM objects.
|
||||
|
@ -2891,7 +2897,7 @@ impl ScriptThread {
|
|||
pipeline_id: PipelineId,
|
||||
) -> Option<(BrowsingContextId, Option<PipelineId>)> {
|
||||
let (result_sender, result_receiver) = ipc::channel().unwrap();
|
||||
let msg = ScriptMsg::GetBrowsingContextInfo(pipeline_id, result_sender);
|
||||
let msg = ScriptToConstellationMessage::GetBrowsingContextInfo(pipeline_id, result_sender);
|
||||
self.senders
|
||||
.pipeline_to_constellation_sender
|
||||
.send((pipeline_id, msg))
|
||||
|
@ -2907,7 +2913,10 @@ impl ScriptThread {
|
|||
browsing_context_id: BrowsingContextId,
|
||||
) -> Option<WebViewId> {
|
||||
let (result_sender, result_receiver) = ipc::channel().unwrap();
|
||||
let msg = ScriptMsg::GetTopForBrowsingContext(browsing_context_id, result_sender);
|
||||
let msg = ScriptToConstellationMessage::GetTopForBrowsingContext(
|
||||
browsing_context_id,
|
||||
result_sender,
|
||||
);
|
||||
self.senders
|
||||
.pipeline_to_constellation_sender
|
||||
.send((sender_pipeline, msg))
|
||||
|
@ -3029,7 +3038,7 @@ impl ScriptThread {
|
|||
.pipeline_to_constellation_sender
|
||||
.send((
|
||||
incomplete.pipeline_id,
|
||||
ScriptMsg::SetFinalUrl(final_url.clone()),
|
||||
ScriptToConstellationMessage::SetFinalUrl(final_url.clone()),
|
||||
))
|
||||
.unwrap();
|
||||
}
|
||||
|
@ -3221,7 +3230,10 @@ impl ScriptThread {
|
|||
|
||||
self.senders
|
||||
.pipeline_to_constellation_sender
|
||||
.send((incomplete.pipeline_id, ScriptMsg::ActivateDocument))
|
||||
.send((
|
||||
incomplete.pipeline_id,
|
||||
ScriptToConstellationMessage::ActivateDocument,
|
||||
))
|
||||
.unwrap();
|
||||
|
||||
// Notify devtools that a new script global exists.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue