mirror of
https://github.com/servo/servo.git
synced 2025-06-13 02:44:29 +00:00
script_traits: Rename ConstellationControlMsg
to ScriptThreadMessage
(#35226)
At some point in the past this message was only sent from the `Constellation` to `script`, but nowadays this is sent from various parts of servo to the `ScriptThread`, so this is a better name. In particular, the current name makes it seeem like this message controls the `Constellation`, which it does not. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
006ec58598
commit
ad07db0b0c
13 changed files with 183 additions and 200 deletions
|
@ -82,9 +82,9 @@ use script_layout_interface::{
|
|||
};
|
||||
use script_traits::webdriver_msg::WebDriverScriptCommand;
|
||||
use script_traits::{
|
||||
CompositorEvent, ConstellationControlMsg, DiscardBrowsingContext, DocumentActivity,
|
||||
EventResult, InitialScriptState, JsEvalResult, LoadData, LoadOrigin, NavigationHistoryBehavior,
|
||||
NewLayoutInfo, Painter, ProgressiveWebMetricType, ScriptMsg, ScriptToConstellationChan,
|
||||
CompositorEvent, DiscardBrowsingContext, DocumentActivity, EventResult, InitialScriptState,
|
||||
JsEvalResult, LoadData, LoadOrigin, NavigationHistoryBehavior, NewLayoutInfo, Painter,
|
||||
ProgressiveWebMetricType, ScriptMsg, ScriptThreadMessage, ScriptToConstellationChan,
|
||||
ScrollState, StructuredSerializedData, UntrustedNodeAddress, UpdatePipelineIdReason,
|
||||
WindowSizeData, WindowSizeType,
|
||||
};
|
||||
|
@ -1411,7 +1411,7 @@ impl ScriptThread {
|
|||
// This has to be handled before the ResizeMsg below,
|
||||
// otherwise the page may not have been added to the
|
||||
// child list yet, causing the find() to fail.
|
||||
MixedMessage::FromConstellation(ConstellationControlMsg::AttachLayout(
|
||||
MixedMessage::FromConstellation(ScriptThreadMessage::AttachLayout(
|
||||
new_layout_info,
|
||||
)) => {
|
||||
let pipeline_id = new_layout_info.new_pipeline_id;
|
||||
|
@ -1449,19 +1449,18 @@ impl ScriptThread {
|
|||
},
|
||||
)
|
||||
},
|
||||
MixedMessage::FromConstellation(ConstellationControlMsg::Resize(
|
||||
MixedMessage::FromConstellation(ScriptThreadMessage::Resize(
|
||||
id,
|
||||
size,
|
||||
size_type,
|
||||
)) => {
|
||||
self.handle_resize_message(id, size, size_type);
|
||||
},
|
||||
MixedMessage::FromConstellation(ConstellationControlMsg::Viewport(id, rect)) => {
|
||||
self.profile_event(ScriptThreadEventCategory::SetViewport, Some(id), || {
|
||||
MixedMessage::FromConstellation(ScriptThreadMessage::Viewport(id, rect)) => self
|
||||
.profile_event(ScriptThreadEventCategory::SetViewport, Some(id), || {
|
||||
self.handle_viewport(id, rect);
|
||||
})
|
||||
},
|
||||
MixedMessage::FromConstellation(ConstellationControlMsg::TickAllAnimations(
|
||||
}),
|
||||
MixedMessage::FromConstellation(ScriptThreadMessage::TickAllAnimations(
|
||||
pipeline_id,
|
||||
tick_type,
|
||||
)) => {
|
||||
|
@ -1475,7 +1474,7 @@ impl ScriptThread {
|
|||
)
|
||||
}
|
||||
},
|
||||
MixedMessage::FromConstellation(ConstellationControlMsg::SendEvent(id, event)) => {
|
||||
MixedMessage::FromConstellation(ScriptThreadMessage::SendEvent(id, event)) => {
|
||||
self.handle_event(id, event)
|
||||
},
|
||||
MixedMessage::FromScript(MainThreadScriptMsg::Common(CommonScriptMsg::Task(
|
||||
|
@ -1492,11 +1491,10 @@ impl ScriptThread {
|
|||
// An event came-in from a document that is not fully-active, it has been stored by the task-queue.
|
||||
// Continue without adding it to "sequential".
|
||||
},
|
||||
MixedMessage::FromConstellation(ConstellationControlMsg::ExitFullScreen(id)) => {
|
||||
self.profile_event(ScriptThreadEventCategory::ExitFullscreen, Some(id), || {
|
||||
MixedMessage::FromConstellation(ScriptThreadMessage::ExitFullScreen(id)) => self
|
||||
.profile_event(ScriptThreadEventCategory::ExitFullscreen, Some(id), || {
|
||||
self.handle_exit_fullscreen(id, can_gc);
|
||||
})
|
||||
},
|
||||
}),
|
||||
_ => {
|
||||
sequential.push(event);
|
||||
},
|
||||
|
@ -1525,11 +1523,11 @@ impl ScriptThread {
|
|||
if self.closing.load(Ordering::SeqCst) {
|
||||
// If we've received the closed signal from the BHM, only handle exit messages.
|
||||
match msg {
|
||||
MixedMessage::FromConstellation(ConstellationControlMsg::ExitScriptThread) => {
|
||||
MixedMessage::FromConstellation(ScriptThreadMessage::ExitScriptThread) => {
|
||||
self.handle_exit_script_thread_msg(can_gc);
|
||||
return false;
|
||||
},
|
||||
MixedMessage::FromConstellation(ConstellationControlMsg::ExitPipeline(
|
||||
MixedMessage::FromConstellation(ScriptThreadMessage::ExitPipeline(
|
||||
pipeline_id,
|
||||
discard_browsing_context,
|
||||
)) => {
|
||||
|
@ -1546,7 +1544,7 @@ impl ScriptThread {
|
|||
|
||||
let exiting = self.profile_event(category, pipeline_id, move || {
|
||||
match msg {
|
||||
MixedMessage::FromConstellation(ConstellationControlMsg::ExitScriptThread) => {
|
||||
MixedMessage::FromConstellation(ScriptThreadMessage::ExitScriptThread) => {
|
||||
self.handle_exit_script_thread_msg(can_gc);
|
||||
return true;
|
||||
},
|
||||
|
@ -1601,7 +1599,7 @@ impl ScriptThread {
|
|||
fn categorize_msg(&self, msg: &MixedMessage) -> ScriptThreadEventCategory {
|
||||
match *msg {
|
||||
MixedMessage::FromConstellation(ref inner_msg) => match *inner_msg {
|
||||
ConstellationControlMsg::SendEvent(_, _) => ScriptThreadEventCategory::DomEvent,
|
||||
ScriptThreadMessage::SendEvent(_, _) => ScriptThreadEventCategory::DomEvent,
|
||||
_ => ScriptThreadEventCategory::ConstellationMsg,
|
||||
},
|
||||
// TODO https://github.com/servo/servo/issues/18998
|
||||
|
@ -1779,12 +1777,12 @@ impl ScriptThread {
|
|||
value
|
||||
}
|
||||
|
||||
fn handle_msg_from_constellation(&self, msg: ConstellationControlMsg, can_gc: CanGc) {
|
||||
fn handle_msg_from_constellation(&self, msg: ScriptThreadMessage, can_gc: CanGc) {
|
||||
match msg {
|
||||
ConstellationControlMsg::StopDelayingLoadEventsMode(pipeline_id) => {
|
||||
ScriptThreadMessage::StopDelayingLoadEventsMode(pipeline_id) => {
|
||||
self.handle_stop_delaying_load_events_mode(pipeline_id)
|
||||
},
|
||||
ConstellationControlMsg::NavigateIframe(
|
||||
ScriptThreadMessage::NavigateIframe(
|
||||
parent_pipeline_id,
|
||||
browsing_context_id,
|
||||
load_data,
|
||||
|
@ -1796,25 +1794,23 @@ impl ScriptThread {
|
|||
history_handling,
|
||||
can_gc,
|
||||
),
|
||||
ConstellationControlMsg::UnloadDocument(pipeline_id) => {
|
||||
ScriptThreadMessage::UnloadDocument(pipeline_id) => {
|
||||
self.handle_unload_document(pipeline_id, can_gc)
|
||||
},
|
||||
ConstellationControlMsg::ResizeInactive(id, new_size) => {
|
||||
ScriptThreadMessage::ResizeInactive(id, new_size) => {
|
||||
self.handle_resize_inactive_msg(id, new_size)
|
||||
},
|
||||
ConstellationControlMsg::ThemeChange(_, theme) => {
|
||||
ScriptThreadMessage::ThemeChange(_, theme) => {
|
||||
self.handle_theme_change_msg(theme);
|
||||
},
|
||||
ConstellationControlMsg::GetTitle(pipeline_id) => {
|
||||
self.handle_get_title_msg(pipeline_id)
|
||||
},
|
||||
ConstellationControlMsg::SetDocumentActivity(pipeline_id, activity) => {
|
||||
ScriptThreadMessage::GetTitle(pipeline_id) => self.handle_get_title_msg(pipeline_id),
|
||||
ScriptThreadMessage::SetDocumentActivity(pipeline_id, activity) => {
|
||||
self.handle_set_document_activity_msg(pipeline_id, activity)
|
||||
},
|
||||
ConstellationControlMsg::SetThrottled(pipeline_id, throttled) => {
|
||||
ScriptThreadMessage::SetThrottled(pipeline_id, throttled) => {
|
||||
self.handle_set_throttled_msg(pipeline_id, throttled)
|
||||
},
|
||||
ConstellationControlMsg::SetThrottledInContainingIframe(
|
||||
ScriptThreadMessage::SetThrottledInContainingIframe(
|
||||
parent_pipeline_id,
|
||||
browsing_context_id,
|
||||
throttled,
|
||||
|
@ -1823,7 +1819,7 @@ impl ScriptThread {
|
|||
browsing_context_id,
|
||||
throttled,
|
||||
),
|
||||
ConstellationControlMsg::PostMessage {
|
||||
ScriptThreadMessage::PostMessage {
|
||||
target: target_pipeline_id,
|
||||
source: source_pipeline_id,
|
||||
source_browsing_context,
|
||||
|
@ -1838,7 +1834,7 @@ impl ScriptThread {
|
|||
source_origin,
|
||||
data,
|
||||
),
|
||||
ConstellationControlMsg::UpdatePipelineId(
|
||||
ScriptThreadMessage::UpdatePipelineId(
|
||||
parent_pipeline_id,
|
||||
browsing_context_id,
|
||||
top_level_browsing_context_id,
|
||||
|
@ -1852,27 +1848,27 @@ impl ScriptThread {
|
|||
reason,
|
||||
can_gc,
|
||||
),
|
||||
ConstellationControlMsg::UpdateHistoryState(pipeline_id, history_state_id, url) => {
|
||||
ScriptThreadMessage::UpdateHistoryState(pipeline_id, history_state_id, url) => {
|
||||
self.handle_update_history_state_msg(pipeline_id, history_state_id, url, can_gc)
|
||||
},
|
||||
ConstellationControlMsg::RemoveHistoryStates(pipeline_id, history_states) => {
|
||||
ScriptThreadMessage::RemoveHistoryStates(pipeline_id, history_states) => {
|
||||
self.handle_remove_history_states(pipeline_id, history_states)
|
||||
},
|
||||
ConstellationControlMsg::FocusIFrame(parent_pipeline_id, frame_id) => {
|
||||
ScriptThreadMessage::FocusIFrame(parent_pipeline_id, frame_id) => {
|
||||
self.handle_focus_iframe_msg(parent_pipeline_id, frame_id, can_gc)
|
||||
},
|
||||
ConstellationControlMsg::WebDriverScriptCommand(pipeline_id, msg) => {
|
||||
ScriptThreadMessage::WebDriverScriptCommand(pipeline_id, msg) => {
|
||||
self.handle_webdriver_msg(pipeline_id, msg, can_gc)
|
||||
},
|
||||
ConstellationControlMsg::WebFontLoaded(pipeline_id, success) => {
|
||||
ScriptThreadMessage::WebFontLoaded(pipeline_id, success) => {
|
||||
self.handle_web_font_loaded(pipeline_id, success)
|
||||
},
|
||||
ConstellationControlMsg::DispatchIFrameLoadEvent {
|
||||
ScriptThreadMessage::DispatchIFrameLoadEvent {
|
||||
target: browsing_context_id,
|
||||
parent: parent_id,
|
||||
child: child_id,
|
||||
} => self.handle_iframe_load_event(parent_id, browsing_context_id, child_id, can_gc),
|
||||
ConstellationControlMsg::DispatchStorageEvent(
|
||||
ScriptThreadMessage::DispatchStorageEvent(
|
||||
pipeline_id,
|
||||
storage,
|
||||
url,
|
||||
|
@ -1880,37 +1876,37 @@ impl ScriptThread {
|
|||
old_value,
|
||||
new_value,
|
||||
) => self.handle_storage_event(pipeline_id, storage, url, key, old_value, new_value),
|
||||
ConstellationControlMsg::ReportCSSError(pipeline_id, filename, line, column, msg) => {
|
||||
ScriptThreadMessage::ReportCSSError(pipeline_id, filename, line, column, msg) => {
|
||||
self.handle_css_error_reporting(pipeline_id, filename, line, column, msg)
|
||||
},
|
||||
ConstellationControlMsg::Reload(pipeline_id) => self.handle_reload(pipeline_id, can_gc),
|
||||
ConstellationControlMsg::ExitPipeline(pipeline_id, discard_browsing_context) => {
|
||||
ScriptThreadMessage::Reload(pipeline_id) => self.handle_reload(pipeline_id, can_gc),
|
||||
ScriptThreadMessage::ExitPipeline(pipeline_id, discard_browsing_context) => {
|
||||
self.handle_exit_pipeline_msg(pipeline_id, discard_browsing_context, can_gc)
|
||||
},
|
||||
ConstellationControlMsg::PaintMetric(pipeline_id, metric_type, metric_value) => {
|
||||
ScriptThreadMessage::PaintMetric(pipeline_id, metric_type, metric_value) => {
|
||||
self.handle_paint_metric(pipeline_id, metric_type, metric_value, can_gc)
|
||||
},
|
||||
ConstellationControlMsg::MediaSessionAction(pipeline_id, action) => {
|
||||
ScriptThreadMessage::MediaSessionAction(pipeline_id, action) => {
|
||||
self.handle_media_session_action(pipeline_id, action, can_gc)
|
||||
},
|
||||
#[cfg(feature = "webgpu")]
|
||||
ConstellationControlMsg::SetWebGPUPort(port) => {
|
||||
ScriptThreadMessage::SetWebGPUPort(port) => {
|
||||
*self.receivers.webgpu_receiver.borrow_mut() =
|
||||
ROUTER.route_ipc_receiver_to_new_crossbeam_receiver(port);
|
||||
},
|
||||
msg @ ConstellationControlMsg::AttachLayout(..) |
|
||||
msg @ ConstellationControlMsg::Viewport(..) |
|
||||
msg @ ConstellationControlMsg::Resize(..) |
|
||||
msg @ ConstellationControlMsg::ExitFullScreen(..) |
|
||||
msg @ ConstellationControlMsg::SendEvent(..) |
|
||||
msg @ ConstellationControlMsg::TickAllAnimations(..) |
|
||||
msg @ ConstellationControlMsg::ExitScriptThread => {
|
||||
msg @ ScriptThreadMessage::AttachLayout(..) |
|
||||
msg @ ScriptThreadMessage::Viewport(..) |
|
||||
msg @ ScriptThreadMessage::Resize(..) |
|
||||
msg @ ScriptThreadMessage::ExitFullScreen(..) |
|
||||
msg @ ScriptThreadMessage::SendEvent(..) |
|
||||
msg @ ScriptThreadMessage::TickAllAnimations(..) |
|
||||
msg @ ScriptThreadMessage::ExitScriptThread => {
|
||||
panic!("should have handled {:?} already", msg)
|
||||
},
|
||||
ConstellationControlMsg::SetScrollStates(pipeline_id, scroll_states) => {
|
||||
ScriptThreadMessage::SetScrollStates(pipeline_id, scroll_states) => {
|
||||
self.handle_set_scroll_states_msg(pipeline_id, scroll_states)
|
||||
},
|
||||
ConstellationControlMsg::SetEpochPaintTime(pipeline_id, epoch, time) => {
|
||||
ScriptThreadMessage::SetEpochPaintTime(pipeline_id, epoch, time) => {
|
||||
self.handle_set_epoch_paint_time(pipeline_id, epoch, time)
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue