mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01: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
|
@ -31,7 +31,7 @@ use profile_traits::time::{self as profile_time, ProfilerCategory};
|
||||||
use profile_traits::time_profile;
|
use profile_traits::time_profile;
|
||||||
use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent, TouchEvent, WheelEvent};
|
use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent, TouchEvent, WheelEvent};
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
AnimationState, AnimationTickType, ConstellationControlMsg, ScrollState, WindowSizeData,
|
AnimationState, AnimationTickType, ScriptThreadMessage, ScrollState, WindowSizeData,
|
||||||
WindowSizeType,
|
WindowSizeType,
|
||||||
};
|
};
|
||||||
use servo_geometry::{DeviceIndependentPixel, FramebufferUintLength};
|
use servo_geometry::{DeviceIndependentPixel, FramebufferUintLength};
|
||||||
|
@ -1886,7 +1886,7 @@ impl IOCompositor {
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Some(pipeline) = details.pipeline.as_ref() {
|
if let Some(pipeline) = details.pipeline.as_ref() {
|
||||||
let message = ConstellationControlMsg::SetScrollStates(*pipeline_id, scroll_states);
|
let message = ScriptThreadMessage::SetScrollStates(*pipeline_id, scroll_states);
|
||||||
let _ = pipeline.script_chan.send(message);
|
let _ = pipeline.script_chan.send(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2226,10 +2226,9 @@ impl IOCompositor {
|
||||||
// be painted.
|
// be painted.
|
||||||
pending_epochs.drain(0..index);
|
pending_epochs.drain(0..index);
|
||||||
|
|
||||||
if let Err(error) =
|
if let Err(error) = pipeline
|
||||||
pipeline
|
|
||||||
.script_chan
|
.script_chan
|
||||||
.send(ConstellationControlMsg::SetEpochPaintTime(
|
.send(ScriptThreadMessage::SetEpochPaintTime(
|
||||||
*pipeline_id,
|
*pipeline_id,
|
||||||
current_epoch,
|
current_epoch,
|
||||||
paint_time,
|
paint_time,
|
||||||
|
|
|
@ -139,13 +139,13 @@ use script_layout_interface::{LayoutFactory, ScriptThreadFactory};
|
||||||
use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent};
|
use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent};
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
webdriver_msg, AnimationState, AnimationTickType, AuxiliaryBrowsingContextLoadInfo,
|
webdriver_msg, AnimationState, AnimationTickType, AuxiliaryBrowsingContextLoadInfo,
|
||||||
BroadcastMsg, CompositorEvent, ConstellationControlMsg, DiscardBrowsingContext,
|
BroadcastMsg, CompositorEvent, DiscardBrowsingContext, DocumentActivity, DocumentState,
|
||||||
DocumentActivity, DocumentState, IFrameLoadInfo, IFrameLoadInfoWithData, IFrameSandboxState,
|
IFrameLoadInfo, IFrameLoadInfoWithData, IFrameSandboxState, IFrameSizeMsg, Job,
|
||||||
IFrameSizeMsg, Job, LayoutMsg as FromLayoutMsg, LoadData, LoadOrigin, LogEntry, MessagePortMsg,
|
LayoutMsg as FromLayoutMsg, LoadData, LoadOrigin, LogEntry, MessagePortMsg,
|
||||||
NavigationHistoryBehavior, PortMessageTask, SWManagerMsg, SWManagerSenders,
|
NavigationHistoryBehavior, PortMessageTask, SWManagerMsg, SWManagerSenders,
|
||||||
ScriptMsg as FromScriptMsg, ScriptToConstellationChan, ServiceWorkerManagerFactory,
|
ScriptMsg as FromScriptMsg, ScriptThreadMessage, ScriptToConstellationChan,
|
||||||
ServiceWorkerMsg, StructuredSerializedData, UpdatePipelineIdReason, WebDriverCommandMsg,
|
ServiceWorkerManagerFactory, ServiceWorkerMsg, StructuredSerializedData,
|
||||||
WindowSizeData, WindowSizeType,
|
UpdatePipelineIdReason, WebDriverCommandMsg, WindowSizeData, WindowSizeType,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use servo_config::{opts, pref};
|
use servo_config::{opts, pref};
|
||||||
|
@ -1310,9 +1310,8 @@ where
|
||||||
// we need to take it out of it's "delaying-load-events-mode".
|
// we need to take it out of it's "delaying-load-events-mode".
|
||||||
// https://html.spec.whatwg.org/multipage/#delaying-load-events-mode
|
// https://html.spec.whatwg.org/multipage/#delaying-load-events-mode
|
||||||
if !pipeline_is_top_level_pipeline {
|
if !pipeline_is_top_level_pipeline {
|
||||||
let msg = ConstellationControlMsg::StopDelayingLoadEventsMode(
|
let msg =
|
||||||
pipeline_id,
|
ScriptThreadMessage::StopDelayingLoadEventsMode(pipeline_id);
|
||||||
);
|
|
||||||
let result = match self.pipelines.get(&pipeline_id) {
|
let result = match self.pipelines.get(&pipeline_id) {
|
||||||
Some(pipeline) => pipeline.event_loop.send(msg),
|
Some(pipeline) => pipeline.event_loop.send(msg),
|
||||||
None => {
|
None => {
|
||||||
|
@ -1998,7 +1997,7 @@ where
|
||||||
self.webrender_wgpu.wgpu_image_map.clone(),
|
self.webrender_wgpu.wgpu_image_map.clone(),
|
||||||
)
|
)
|
||||||
.map(|webgpu| {
|
.map(|webgpu| {
|
||||||
let msg = ConstellationControlMsg::SetWebGPUPort(webgpu.1);
|
let msg = ScriptThreadMessage::SetWebGPUPort(webgpu.1);
|
||||||
if let Err(e) = source_pipeline.event_loop.send(msg) {
|
if let Err(e) = source_pipeline.event_loop.send(msg) {
|
||||||
warn!(
|
warn!(
|
||||||
"{}: Failed to send SetWebGPUPort to pipeline ({:?})",
|
"{}: Failed to send SetWebGPUPort to pipeline ({:?})",
|
||||||
|
@ -2512,7 +2511,7 @@ where
|
||||||
let origin = url.origin();
|
let origin = url.origin();
|
||||||
for pipeline in self.pipelines.values() {
|
for pipeline in self.pipelines.values() {
|
||||||
if (pipeline.id != pipeline_id) && (pipeline.url.origin() == origin) {
|
if (pipeline.id != pipeline_id) && (pipeline.url.origin() == origin) {
|
||||||
let msg = ConstellationControlMsg::DispatchStorageEvent(
|
let msg = ScriptThreadMessage::DispatchStorageEvent(
|
||||||
pipeline.id,
|
pipeline.id,
|
||||||
storage,
|
storage,
|
||||||
url.clone(),
|
url.clone(),
|
||||||
|
@ -2949,7 +2948,7 @@ where
|
||||||
(&event).into(),
|
(&event).into(),
|
||||||
));
|
));
|
||||||
|
|
||||||
if let Err(e) = pipeline.event_loop.send(ConstellationControlMsg::SendEvent(
|
if let Err(e) = pipeline.event_loop.send(ScriptThreadMessage::SendEvent(
|
||||||
destination_pipeline_id,
|
destination_pipeline_id,
|
||||||
event,
|
event,
|
||||||
)) {
|
)) {
|
||||||
|
@ -3124,7 +3123,7 @@ where
|
||||||
// https://html.spec.whatwg.org/multipage/#the-iframe-element:completely-loaded
|
// https://html.spec.whatwg.org/multipage/#the-iframe-element:completely-loaded
|
||||||
// When a Document in an iframe is marked as completely loaded,
|
// When a Document in an iframe is marked as completely loaded,
|
||||||
// the user agent must run the iframe load event steps.
|
// the user agent must run the iframe load event steps.
|
||||||
let msg = ConstellationControlMsg::DispatchIFrameLoadEvent {
|
let msg = ScriptThreadMessage::DispatchIFrameLoadEvent {
|
||||||
target: browsing_context_id,
|
target: browsing_context_id,
|
||||||
parent: parent_pipeline_id,
|
parent: parent_pipeline_id,
|
||||||
child: pipeline_id,
|
child: pipeline_id,
|
||||||
|
@ -3458,7 +3457,7 @@ where
|
||||||
None => return warn!("{}: Got script tick after closure", pipeline_id),
|
None => return warn!("{}: Got script tick after closure", pipeline_id),
|
||||||
};
|
};
|
||||||
|
|
||||||
let message = ConstellationControlMsg::TickAllAnimations(pipeline_id, tick_type);
|
let message = ScriptThreadMessage::TickAllAnimations(pipeline_id, tick_type);
|
||||||
if let Err(e) = pipeline.event_loop.send(message) {
|
if let Err(e) = pipeline.event_loop.send(message) {
|
||||||
self.handle_send_error(pipeline_id, e);
|
self.handle_send_error(pipeline_id, e);
|
||||||
}
|
}
|
||||||
|
@ -3558,7 +3557,7 @@ where
|
||||||
Some(parent_pipeline_id) => {
|
Some(parent_pipeline_id) => {
|
||||||
// Find the script thread for the pipeline containing the iframe
|
// Find the script thread for the pipeline containing the iframe
|
||||||
// and issue an iframe load through there.
|
// and issue an iframe load through there.
|
||||||
let msg = ConstellationControlMsg::NavigateIframe(
|
let msg = ScriptThreadMessage::NavigateIframe(
|
||||||
parent_pipeline_id,
|
parent_pipeline_id,
|
||||||
browsing_context_id,
|
browsing_context_id,
|
||||||
load_data,
|
load_data,
|
||||||
|
@ -3996,7 +3995,7 @@ where
|
||||||
self.update_activity(new_pipeline_id);
|
self.update_activity(new_pipeline_id);
|
||||||
|
|
||||||
if let Some(parent_pipeline_id) = parent_pipeline_id {
|
if let Some(parent_pipeline_id) = parent_pipeline_id {
|
||||||
let msg = ConstellationControlMsg::UpdatePipelineId(
|
let msg = ScriptThreadMessage::UpdatePipelineId(
|
||||||
parent_pipeline_id,
|
parent_pipeline_id,
|
||||||
browsing_context_id,
|
browsing_context_id,
|
||||||
top_level_id,
|
top_level_id,
|
||||||
|
@ -4030,7 +4029,7 @@ where
|
||||||
return warn!("{}: History state updated after closure", pipeline_id);
|
return warn!("{}: History state updated after closure", pipeline_id);
|
||||||
},
|
},
|
||||||
Some(pipeline) => {
|
Some(pipeline) => {
|
||||||
let msg = ConstellationControlMsg::UpdateHistoryState(
|
let msg = ScriptThreadMessage::UpdateHistoryState(
|
||||||
pipeline_id,
|
pipeline_id,
|
||||||
history_state_id,
|
history_state_id,
|
||||||
url.clone(),
|
url.clone(),
|
||||||
|
@ -4154,7 +4153,7 @@ where
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let msg =
|
let msg =
|
||||||
ConstellationControlMsg::SendEvent(pipeline_id, CompositorEvent::IMEDismissedEvent);
|
ScriptThreadMessage::SendEvent(pipeline_id, CompositorEvent::IMEDismissedEvent);
|
||||||
let result = match self.pipelines.get(&pipeline_id) {
|
let result = match self.pipelines.get(&pipeline_id) {
|
||||||
Some(pipeline) => pipeline.event_loop.send(msg),
|
Some(pipeline) => pipeline.event_loop.send(msg),
|
||||||
None => {
|
None => {
|
||||||
|
@ -4191,7 +4190,7 @@ where
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let msg = ConstellationControlMsg::SendEvent(pipeline_id, event);
|
let msg = ScriptThreadMessage::SendEvent(pipeline_id, event);
|
||||||
let result = match self.pipelines.get(&pipeline_id) {
|
let result = match self.pipelines.get(&pipeline_id) {
|
||||||
Some(pipeline) => pipeline.event_loop.send(msg),
|
Some(pipeline) => pipeline.event_loop.send(msg),
|
||||||
None => {
|
None => {
|
||||||
|
@ -4225,7 +4224,7 @@ where
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let msg = ConstellationControlMsg::SendEvent(pipeline_id, event);
|
let msg = ScriptThreadMessage::SendEvent(pipeline_id, event);
|
||||||
let result = match self.pipelines.get(&pipeline_id) {
|
let result = match self.pipelines.get(&pipeline_id) {
|
||||||
Some(pipeline) => pipeline.event_loop.send(msg),
|
Some(pipeline) => pipeline.event_loop.send(msg),
|
||||||
None => {
|
None => {
|
||||||
|
@ -4258,7 +4257,7 @@ where
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let msg = ConstellationControlMsg::SendEvent(pipeline_id, event);
|
let msg = ScriptThreadMessage::SendEvent(pipeline_id, event);
|
||||||
let result = match self.pipelines.get(&pipeline_id) {
|
let result = match self.pipelines.get(&pipeline_id) {
|
||||||
Some(pipeline) => pipeline.event_loop.send(msg),
|
Some(pipeline) => pipeline.event_loop.send(msg),
|
||||||
None => {
|
None => {
|
||||||
|
@ -4283,7 +4282,7 @@ where
|
||||||
return warn!("{}: Got reload event after closure", browsing_context_id);
|
return warn!("{}: Got reload event after closure", browsing_context_id);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let msg = ConstellationControlMsg::Reload(pipeline_id);
|
let msg = ScriptThreadMessage::Reload(pipeline_id);
|
||||||
let result = match self.pipelines.get(&pipeline_id) {
|
let result = match self.pipelines.get(&pipeline_id) {
|
||||||
None => return warn!("{}: Got reload event after closure", pipeline_id),
|
None => return warn!("{}: Got reload event after closure", pipeline_id),
|
||||||
Some(pipeline) => pipeline.event_loop.send(msg),
|
Some(pipeline) => pipeline.event_loop.send(msg),
|
||||||
|
@ -4318,7 +4317,7 @@ where
|
||||||
Some(pipeline) => pipeline.top_level_browsing_context_id,
|
Some(pipeline) => pipeline.top_level_browsing_context_id,
|
||||||
None => return warn!("{}: PostMessage from closed pipeline", source_pipeline),
|
None => return warn!("{}: PostMessage from closed pipeline", source_pipeline),
|
||||||
};
|
};
|
||||||
let msg = ConstellationControlMsg::PostMessage {
|
let msg = ScriptThreadMessage::PostMessage {
|
||||||
target: pipeline_id,
|
target: pipeline_id,
|
||||||
source: source_pipeline,
|
source: source_pipeline,
|
||||||
source_browsing_context,
|
source_browsing_context,
|
||||||
|
@ -4434,7 +4433,7 @@ where
|
||||||
|
|
||||||
// Send a message to the parent of the provided browsing context (if it
|
// Send a message to the parent of the provided browsing context (if it
|
||||||
// exists) telling it to mark the iframe element as focused.
|
// exists) telling it to mark the iframe element as focused.
|
||||||
let msg = ConstellationControlMsg::FocusIFrame(parent_pipeline_id, browsing_context_id);
|
let msg = ScriptThreadMessage::FocusIFrame(parent_pipeline_id, browsing_context_id);
|
||||||
let (result, parent_browsing_context_id) = match self.pipelines.get(&parent_pipeline_id) {
|
let (result, parent_browsing_context_id) = match self.pipelines.get(&parent_pipeline_id) {
|
||||||
Some(pipeline) => {
|
Some(pipeline) => {
|
||||||
let result = pipeline.event_loop.send(msg);
|
let result = pipeline.event_loop.send(msg);
|
||||||
|
@ -4486,7 +4485,7 @@ where
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(parent_pipeline_id) = parent_pipeline_id {
|
if let Some(parent_pipeline_id) = parent_pipeline_id {
|
||||||
let msg = ConstellationControlMsg::SetThrottledInContainingIframe(
|
let msg = ScriptThreadMessage::SetThrottledInContainingIframe(
|
||||||
parent_pipeline_id,
|
parent_pipeline_id,
|
||||||
browsing_context_id,
|
browsing_context_id,
|
||||||
throttled,
|
throttled,
|
||||||
|
@ -4611,7 +4610,7 @@ where
|
||||||
return warn!("{}: ScriptCommand after closure", browsing_context_id);
|
return warn!("{}: ScriptCommand after closure", browsing_context_id);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let control_msg = ConstellationControlMsg::WebDriverScriptCommand(pipeline_id, cmd);
|
let control_msg = ScriptThreadMessage::WebDriverScriptCommand(pipeline_id, cmd);
|
||||||
let result = match self.pipelines.get(&pipeline_id) {
|
let result = match self.pipelines.get(&pipeline_id) {
|
||||||
Some(pipeline) => pipeline.event_loop.send(control_msg),
|
Some(pipeline) => pipeline.event_loop.send(control_msg),
|
||||||
None => return warn!("{}: ScriptCommand after closure", pipeline_id),
|
None => return warn!("{}: ScriptCommand after closure", pipeline_id),
|
||||||
|
@ -4640,7 +4639,7 @@ where
|
||||||
CompositorEvent::CompositionEvent(event)
|
CompositorEvent::CompositionEvent(event)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let control_msg = ConstellationControlMsg::SendEvent(pipeline_id, event);
|
let control_msg = ScriptThreadMessage::SendEvent(pipeline_id, event);
|
||||||
if let Err(e) = event_loop.send(control_msg) {
|
if let Err(e) = event_loop.send(control_msg) {
|
||||||
return self.handle_send_error(pipeline_id, e);
|
return self.handle_send_error(pipeline_id, e);
|
||||||
}
|
}
|
||||||
|
@ -4657,7 +4656,7 @@ where
|
||||||
Some(pipeline) => pipeline.event_loop.clone(),
|
Some(pipeline) => pipeline.event_loop.clone(),
|
||||||
None => return warn!("{}: KeyboardAction after closure", pipeline_id),
|
None => return warn!("{}: KeyboardAction after closure", pipeline_id),
|
||||||
};
|
};
|
||||||
let control_msg = ConstellationControlMsg::SendEvent(
|
let control_msg = ScriptThreadMessage::SendEvent(
|
||||||
pipeline_id,
|
pipeline_id,
|
||||||
CompositorEvent::KeyboardEvent(event),
|
CompositorEvent::KeyboardEvent(event),
|
||||||
);
|
);
|
||||||
|
@ -4980,7 +4979,7 @@ where
|
||||||
|
|
||||||
if let Some(states_to_close) = states_to_close {
|
if let Some(states_to_close) = states_to_close {
|
||||||
for (pipeline_id, states) in states_to_close {
|
for (pipeline_id, states) in states_to_close {
|
||||||
let msg = ConstellationControlMsg::RemoveHistoryStates(pipeline_id, states);
|
let msg = ScriptThreadMessage::RemoveHistoryStates(pipeline_id, states);
|
||||||
let result = match self.pipelines.get(&pipeline_id) {
|
let result = match self.pipelines.get(&pipeline_id) {
|
||||||
None => {
|
None => {
|
||||||
return warn!(
|
return warn!(
|
||||||
|
@ -5132,7 +5131,7 @@ where
|
||||||
};
|
};
|
||||||
if let Some(parent_pipeline_id) = parent_pipeline_id {
|
if let Some(parent_pipeline_id) = parent_pipeline_id {
|
||||||
if let Some(parent_pipeline) = self.pipelines.get(&parent_pipeline_id) {
|
if let Some(parent_pipeline) = self.pipelines.get(&parent_pipeline_id) {
|
||||||
let msg = ConstellationControlMsg::UpdatePipelineId(
|
let msg = ScriptThreadMessage::UpdatePipelineId(
|
||||||
parent_pipeline_id,
|
parent_pipeline_id,
|
||||||
change.browsing_context_id,
|
change.browsing_context_id,
|
||||||
change.top_level_browsing_context_id,
|
change.top_level_browsing_context_id,
|
||||||
|
@ -5357,7 +5356,7 @@ where
|
||||||
None => return warn!("{}: Resized after closing", pipeline_id),
|
None => return warn!("{}: Resized after closing", pipeline_id),
|
||||||
Some(pipeline) => pipeline,
|
Some(pipeline) => pipeline,
|
||||||
};
|
};
|
||||||
let _ = pipeline.event_loop.send(ConstellationControlMsg::Resize(
|
let _ = pipeline.event_loop.send(ScriptThreadMessage::Resize(
|
||||||
pipeline.id,
|
pipeline.id,
|
||||||
new_size,
|
new_size,
|
||||||
size_type,
|
size_type,
|
||||||
|
@ -5370,10 +5369,7 @@ where
|
||||||
if let Some(pipeline) = self.pipelines.get(id) {
|
if let Some(pipeline) = self.pipelines.get(id) {
|
||||||
let _ = pipeline
|
let _ = pipeline
|
||||||
.event_loop
|
.event_loop
|
||||||
.send(ConstellationControlMsg::ResizeInactive(
|
.send(ScriptThreadMessage::ResizeInactive(pipeline.id, new_size));
|
||||||
pipeline.id,
|
|
||||||
new_size,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5389,7 +5385,7 @@ where
|
||||||
Some(pipeline) => pipeline,
|
Some(pipeline) => pipeline,
|
||||||
};
|
};
|
||||||
if pipeline.browsing_context_id == browsing_context_id {
|
if pipeline.browsing_context_id == browsing_context_id {
|
||||||
let _ = pipeline.event_loop.send(ConstellationControlMsg::Resize(
|
let _ = pipeline.event_loop.send(ScriptThreadMessage::Resize(
|
||||||
pipeline.id,
|
pipeline.id,
|
||||||
new_size,
|
new_size,
|
||||||
size_type,
|
size_type,
|
||||||
|
@ -5405,7 +5401,7 @@ where
|
||||||
)]
|
)]
|
||||||
fn handle_theme_change(&mut self, theme: Theme) {
|
fn handle_theme_change(&mut self, theme: Theme) {
|
||||||
for pipeline in self.pipelines.values() {
|
for pipeline in self.pipelines.values() {
|
||||||
let msg = ConstellationControlMsg::ThemeChange(pipeline.id, theme);
|
let msg = ScriptThreadMessage::ThemeChange(pipeline.id, theme);
|
||||||
if let Err(err) = pipeline.event_loop.send(msg) {
|
if let Err(err) = pipeline.event_loop.send(msg) {
|
||||||
warn!(
|
warn!(
|
||||||
"{}: Failed to send theme change event to pipeline ({:?}).",
|
"{}: Failed to send theme change event to pipeline ({:?}).",
|
||||||
|
@ -5434,7 +5430,7 @@ where
|
||||||
};
|
};
|
||||||
let _ = pipeline
|
let _ = pipeline
|
||||||
.event_loop
|
.event_loop
|
||||||
.send(ConstellationControlMsg::ExitFullScreen(pipeline.id));
|
.send(ScriptThreadMessage::ExitFullScreen(pipeline.id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5557,7 +5553,7 @@ where
|
||||||
)]
|
)]
|
||||||
fn unload_document(&self, pipeline_id: PipelineId) {
|
fn unload_document(&self, pipeline_id: PipelineId) {
|
||||||
if let Some(pipeline) = self.pipelines.get(&pipeline_id) {
|
if let Some(pipeline) = self.pipelines.get(&pipeline_id) {
|
||||||
let msg = ConstellationControlMsg::UnloadDocument(pipeline_id);
|
let msg = ScriptThreadMessage::UnloadDocument(pipeline_id);
|
||||||
let _ = pipeline.event_loop.send(msg);
|
let _ = pipeline.event_loop.send(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5749,10 +5745,8 @@ where
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
Some(pipeline) => {
|
Some(pipeline) => {
|
||||||
let msg = ConstellationControlMsg::MediaSessionAction(
|
let msg =
|
||||||
media_session_pipeline_id,
|
ScriptThreadMessage::MediaSessionAction(media_session_pipeline_id, action);
|
||||||
action,
|
|
||||||
);
|
|
||||||
pipeline.event_loop.send(msg)
|
pipeline.event_loop.send(msg)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -5787,7 +5781,7 @@ where
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let msg = ConstellationControlMsg::SendEvent(pipeline_id, event);
|
let msg = ScriptThreadMessage::SendEvent(pipeline_id, event);
|
||||||
let result = match self.pipelines.get(&pipeline_id) {
|
let result = match self.pipelines.get(&pipeline_id) {
|
||||||
Some(pipeline) => pipeline.event_loop.send(msg),
|
Some(pipeline) => pipeline.event_loop.send(msg),
|
||||||
None => {
|
None => {
|
||||||
|
|
|
@ -11,25 +11,23 @@ use std::rc::Rc;
|
||||||
|
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use ipc_channel::Error;
|
use ipc_channel::Error;
|
||||||
use script_traits::ConstellationControlMsg;
|
use script_traits::ScriptThreadMessage;
|
||||||
|
|
||||||
/// <https://html.spec.whatwg.org/multipage/#event-loop>
|
/// <https://html.spec.whatwg.org/multipage/#event-loop>
|
||||||
pub struct EventLoop {
|
pub struct EventLoop {
|
||||||
script_chan: IpcSender<ConstellationControlMsg>,
|
script_chan: IpcSender<ScriptThreadMessage>,
|
||||||
dont_send_or_sync: PhantomData<Rc<()>>,
|
dont_send_or_sync: PhantomData<Rc<()>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for EventLoop {
|
impl Drop for EventLoop {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
let _ = self
|
let _ = self.script_chan.send(ScriptThreadMessage::ExitScriptThread);
|
||||||
.script_chan
|
|
||||||
.send(ConstellationControlMsg::ExitScriptThread);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EventLoop {
|
impl EventLoop {
|
||||||
/// Create a new event loop from the channel to its script thread.
|
/// Create a new event loop from the channel to its script thread.
|
||||||
pub fn new(script_chan: IpcSender<ConstellationControlMsg>) -> Rc<EventLoop> {
|
pub fn new(script_chan: IpcSender<ScriptThreadMessage>) -> Rc<EventLoop> {
|
||||||
Rc::new(EventLoop {
|
Rc::new(EventLoop {
|
||||||
script_chan,
|
script_chan,
|
||||||
dont_send_or_sync: PhantomData,
|
dont_send_or_sync: PhantomData,
|
||||||
|
@ -37,12 +35,12 @@ impl EventLoop {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send a message to the event loop.
|
/// Send a message to the event loop.
|
||||||
pub fn send(&self, msg: ConstellationControlMsg) -> Result<(), Error> {
|
pub fn send(&self, msg: ScriptThreadMessage) -> Result<(), Error> {
|
||||||
self.script_chan.send(msg)
|
self.script_chan.send(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The underlying channel to the script thread.
|
/// The underlying channel to the script thread.
|
||||||
pub fn sender(&self) -> IpcSender<ConstellationControlMsg> {
|
pub fn sender(&self) -> IpcSender<ScriptThreadMessage> {
|
||||||
self.script_chan.clone()
|
self.script_chan.clone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,9 @@ use net_traits::ResourceThreads;
|
||||||
use profile_traits::{mem as profile_mem, time};
|
use profile_traits::{mem as profile_mem, time};
|
||||||
use script_layout_interface::{LayoutFactory, ScriptThreadFactory};
|
use script_layout_interface::{LayoutFactory, ScriptThreadFactory};
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
AnimationState, ConstellationControlMsg, DiscardBrowsingContext, DocumentActivity,
|
AnimationState, DiscardBrowsingContext, DocumentActivity, InitialScriptState, LayoutMsg,
|
||||||
InitialScriptState, LayoutMsg, LoadData, NewLayoutInfo, SWManagerMsg,
|
LoadData, NewLayoutInfo, SWManagerMsg, ScriptThreadMessage, ScriptToConstellationChan,
|
||||||
ScriptToConstellationChan, WindowSizeData,
|
WindowSizeData,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use servo_config::opts::{self, Opts};
|
use servo_config::opts::{self, Opts};
|
||||||
|
@ -223,8 +223,7 @@ impl Pipeline {
|
||||||
window_size: state.window_size,
|
window_size: state.window_size,
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(e) =
|
if let Err(e) = script_chan.send(ScriptThreadMessage::AttachLayout(new_layout_info))
|
||||||
script_chan.send(ConstellationControlMsg::AttachLayout(new_layout_info))
|
|
||||||
{
|
{
|
||||||
warn!("Sending to script during pipeline creation failed ({})", e);
|
warn!("Sending to script during pipeline creation failed ({})", e);
|
||||||
}
|
}
|
||||||
|
@ -393,7 +392,7 @@ impl Pipeline {
|
||||||
|
|
||||||
// Script thread handles shutting down layout, and layout handles shutting down the painter.
|
// Script thread handles shutting down layout, and layout handles shutting down the painter.
|
||||||
// For now, if the script thread has failed, we give up on clean shutdown.
|
// For now, if the script thread has failed, we give up on clean shutdown.
|
||||||
let msg = ConstellationControlMsg::ExitPipeline(self.id, discard_bc);
|
let msg = ScriptThreadMessage::ExitPipeline(self.id, discard_bc);
|
||||||
if let Err(e) = self.event_loop.send(msg) {
|
if let Err(e) = self.event_loop.send(msg) {
|
||||||
warn!("Sending script exit message failed ({}).", e);
|
warn!("Sending script exit message failed ({}).", e);
|
||||||
}
|
}
|
||||||
|
@ -402,7 +401,7 @@ impl Pipeline {
|
||||||
/// A forced exit of the shutdown, which does not wait for the compositor,
|
/// A forced exit of the shutdown, which does not wait for the compositor,
|
||||||
/// or for the script thread to shut down layout.
|
/// or for the script thread to shut down layout.
|
||||||
pub fn force_exit(&self, discard_bc: DiscardBrowsingContext) {
|
pub fn force_exit(&self, discard_bc: DiscardBrowsingContext) {
|
||||||
let msg = ConstellationControlMsg::ExitPipeline(self.id, discard_bc);
|
let msg = ScriptThreadMessage::ExitPipeline(self.id, discard_bc);
|
||||||
if let Err(e) = self.event_loop.send(msg) {
|
if let Err(e) = self.event_loop.send(msg) {
|
||||||
warn!("Sending script exit message failed ({}).", e);
|
warn!("Sending script exit message failed ({}).", e);
|
||||||
}
|
}
|
||||||
|
@ -410,7 +409,7 @@ impl Pipeline {
|
||||||
|
|
||||||
/// Notify this pipeline of its activity.
|
/// Notify this pipeline of its activity.
|
||||||
pub fn set_activity(&self, activity: DocumentActivity) {
|
pub fn set_activity(&self, activity: DocumentActivity) {
|
||||||
let msg = ConstellationControlMsg::SetDocumentActivity(self.id, activity);
|
let msg = ScriptThreadMessage::SetDocumentActivity(self.id, activity);
|
||||||
if let Err(e) = self.event_loop.send(msg) {
|
if let Err(e) = self.event_loop.send(msg) {
|
||||||
warn!("Sending activity message failed ({}).", e);
|
warn!("Sending activity message failed ({}).", e);
|
||||||
}
|
}
|
||||||
|
@ -452,7 +451,7 @@ impl Pipeline {
|
||||||
/// Set whether to make pipeline use less resources, by stopping animations and
|
/// Set whether to make pipeline use less resources, by stopping animations and
|
||||||
/// running timers at a heavily limited rate.
|
/// running timers at a heavily limited rate.
|
||||||
pub fn set_throttled(&self, throttled: bool) {
|
pub fn set_throttled(&self, throttled: bool) {
|
||||||
let script_msg = ConstellationControlMsg::SetThrottled(self.id, throttled);
|
let script_msg = ScriptThreadMessage::SetThrottled(self.id, throttled);
|
||||||
let compositor_msg = CompositorMsg::SetThrottled(self.id, throttled);
|
let compositor_msg = CompositorMsg::SetThrottled(self.id, throttled);
|
||||||
let err = self.event_loop.send(script_msg);
|
let err = self.event_loop.send(script_msg);
|
||||||
if let Err(e) = err {
|
if let Err(e) = err {
|
||||||
|
@ -485,9 +484,9 @@ pub struct UnprivilegedPipelineContent {
|
||||||
time_profiler_chan: time::ProfilerChan,
|
time_profiler_chan: time::ProfilerChan,
|
||||||
mem_profiler_chan: profile_mem::ProfilerChan,
|
mem_profiler_chan: profile_mem::ProfilerChan,
|
||||||
window_size: WindowSizeData,
|
window_size: WindowSizeData,
|
||||||
script_chan: IpcSender<ConstellationControlMsg>,
|
script_chan: IpcSender<ScriptThreadMessage>,
|
||||||
load_data: LoadData,
|
load_data: LoadData,
|
||||||
script_port: IpcReceiver<ConstellationControlMsg>,
|
script_port: IpcReceiver<ScriptThreadMessage>,
|
||||||
opts: Opts,
|
opts: Opts,
|
||||||
prefs: Box<Preferences>,
|
prefs: Box<Preferences>,
|
||||||
pipeline_namespace_id: PipelineNamespaceId,
|
pipeline_namespace_id: PipelineNamespaceId,
|
||||||
|
|
|
@ -63,7 +63,7 @@ use script_layout_interface::{
|
||||||
OffsetParentResponse, Reflow, ReflowGoal, ReflowRequest, ReflowResult, TrustedNodeAddress,
|
OffsetParentResponse, Reflow, ReflowGoal, ReflowRequest, ReflowResult, TrustedNodeAddress,
|
||||||
};
|
};
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
ConstellationControlMsg, DrawAPaintImageResult, PaintWorkletError, Painter, ScrollState,
|
DrawAPaintImageResult, PaintWorkletError, Painter, ScriptThreadMessage, ScrollState,
|
||||||
UntrustedNodeAddress, WindowSizeData,
|
UntrustedNodeAddress, WindowSizeData,
|
||||||
};
|
};
|
||||||
use servo_arc::Arc as ServoArc;
|
use servo_arc::Arc as ServoArc;
|
||||||
|
@ -132,7 +132,7 @@ pub struct LayoutThread {
|
||||||
is_iframe: bool,
|
is_iframe: bool,
|
||||||
|
|
||||||
/// The channel on which messages can be sent to the script thread.
|
/// The channel on which messages can be sent to the script thread.
|
||||||
script_chan: IpcSender<ConstellationControlMsg>,
|
script_chan: IpcSender<ScriptThreadMessage>,
|
||||||
|
|
||||||
/// The channel on which messages can be sent to the time profiler.
|
/// The channel on which messages can be sent to the time profiler.
|
||||||
time_profiler_chan: profile_time::ProfilerChan,
|
time_profiler_chan: profile_time::ProfilerChan,
|
||||||
|
@ -615,11 +615,11 @@ impl LayoutThread {
|
||||||
|
|
||||||
let locked_script_channel = Mutex::new(self.script_chan.clone());
|
let locked_script_channel = Mutex::new(self.script_chan.clone());
|
||||||
let pipeline_id = self.id;
|
let pipeline_id = self.id;
|
||||||
let web_font_finished_loading_callback =
|
let web_font_finished_loading_callback = move |succeeded: bool| {
|
||||||
move |succeeded: bool| {
|
let _ = locked_script_channel
|
||||||
let _ = locked_script_channel.lock().unwrap().send(
|
.lock()
|
||||||
ConstellationControlMsg::WebFontLoaded(pipeline_id, succeeded),
|
.unwrap()
|
||||||
);
|
.send(ScriptThreadMessage::WebFontLoaded(pipeline_id, succeeded));
|
||||||
};
|
};
|
||||||
|
|
||||||
self.font_context.add_all_web_fonts_from_stylesheet(
|
self.font_context.add_all_web_fonts_from_stylesheet(
|
||||||
|
|
|
@ -51,7 +51,7 @@ use script_layout_interface::{
|
||||||
ReflowRequest, ReflowResult, TrustedNodeAddress,
|
ReflowRequest, ReflowResult, TrustedNodeAddress,
|
||||||
};
|
};
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
ConstellationControlMsg, DrawAPaintImageResult, PaintWorkletError, Painter, ScrollState,
|
DrawAPaintImageResult, PaintWorkletError, Painter, ScriptThreadMessage, ScrollState,
|
||||||
UntrustedNodeAddress, WindowSizeData,
|
UntrustedNodeAddress, WindowSizeData,
|
||||||
};
|
};
|
||||||
use servo_arc::Arc as ServoArc;
|
use servo_arc::Arc as ServoArc;
|
||||||
|
@ -118,7 +118,7 @@ pub struct LayoutThread {
|
||||||
is_iframe: bool,
|
is_iframe: bool,
|
||||||
|
|
||||||
/// The channel on which messages can be sent to the script thread.
|
/// The channel on which messages can be sent to the script thread.
|
||||||
script_chan: IpcSender<ConstellationControlMsg>,
|
script_chan: IpcSender<ScriptThreadMessage>,
|
||||||
|
|
||||||
/// The channel on which messages can be sent to the time profiler.
|
/// The channel on which messages can be sent to the time profiler.
|
||||||
time_profiler_chan: profile_time::ProfilerChan,
|
time_profiler_chan: profile_time::ProfilerChan,
|
||||||
|
@ -594,10 +594,7 @@ impl LayoutThread {
|
||||||
let web_font_finished_loading_callback = move |succeeded: bool| {
|
let web_font_finished_loading_callback = move |succeeded: bool| {
|
||||||
let _ = locked_script_channel
|
let _ = locked_script_channel
|
||||||
.lock()
|
.lock()
|
||||||
.send(ConstellationControlMsg::WebFontLoaded(
|
.send(ScriptThreadMessage::WebFontLoaded(pipeline_id, succeeded));
|
||||||
pipeline_id,
|
|
||||||
succeeded,
|
|
||||||
));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.font_context.add_all_web_fonts_from_stylesheet(
|
self.font_context.add_all_web_fonts_from_stylesheet(
|
||||||
|
|
|
@ -14,7 +14,7 @@ use ipc_channel::ipc::IpcSender;
|
||||||
use log::warn;
|
use log::warn;
|
||||||
use malloc_size_of_derive::MallocSizeOf;
|
use malloc_size_of_derive::MallocSizeOf;
|
||||||
use profile_traits::time::{send_profile_data, ProfilerCategory, ProfilerChan, TimerMetadata};
|
use profile_traits::time::{send_profile_data, ProfilerCategory, ProfilerChan, TimerMetadata};
|
||||||
use script_traits::{ConstellationControlMsg, LayoutMsg, ProgressiveWebMetricType};
|
use script_traits::{LayoutMsg, ProgressiveWebMetricType, ScriptThreadMessage};
|
||||||
use servo_config::opts;
|
use servo_config::opts;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ pub struct PaintTimeMetrics {
|
||||||
pipeline_id: PipelineId,
|
pipeline_id: PipelineId,
|
||||||
time_profiler_chan: ProfilerChan,
|
time_profiler_chan: ProfilerChan,
|
||||||
constellation_chan: IpcSender<LayoutMsg>,
|
constellation_chan: IpcSender<LayoutMsg>,
|
||||||
script_chan: IpcSender<ConstellationControlMsg>,
|
script_chan: IpcSender<ScriptThreadMessage>,
|
||||||
url: ServoUrl,
|
url: ServoUrl,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ impl PaintTimeMetrics {
|
||||||
pipeline_id: PipelineId,
|
pipeline_id: PipelineId,
|
||||||
time_profiler_chan: ProfilerChan,
|
time_profiler_chan: ProfilerChan,
|
||||||
constellation_chan: IpcSender<LayoutMsg>,
|
constellation_chan: IpcSender<LayoutMsg>,
|
||||||
script_chan: IpcSender<ConstellationControlMsg>,
|
script_chan: IpcSender<ScriptThreadMessage>,
|
||||||
url: ServoUrl,
|
url: ServoUrl,
|
||||||
navigation_start: CrossProcessInstant,
|
navigation_start: CrossProcessInstant,
|
||||||
) -> PaintTimeMetrics {
|
) -> PaintTimeMetrics {
|
||||||
|
@ -369,7 +369,7 @@ impl ProgressiveWebMetric for PaintTimeMetrics {
|
||||||
name: ProgressiveWebMetricType,
|
name: ProgressiveWebMetricType,
|
||||||
time: CrossProcessInstant,
|
time: CrossProcessInstant,
|
||||||
) {
|
) {
|
||||||
let msg = ConstellationControlMsg::PaintMetric(self.pipeline_id, name, time);
|
let msg = ScriptThreadMessage::PaintMetric(self.pipeline_id, name, time);
|
||||||
if let Err(e) = self.script_chan.send(msg) {
|
if let Err(e) = self.script_chan.send(msg) {
|
||||||
warn!("Sending metric to script thread failed ({}).", e);
|
warn!("Sending metric to script thread failed ({}).", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,8 +58,8 @@ use script_layout_interface::{
|
||||||
};
|
};
|
||||||
use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
|
use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
ConstellationControlMsg, DocumentState, LoadData, LoadOrigin, NavigationHistoryBehavior,
|
DocumentState, LoadData, LoadOrigin, NavigationHistoryBehavior, ScriptMsg, ScriptThreadMessage,
|
||||||
ScriptMsg, ScriptToConstellationChan, ScrollState, StructuredSerializedData, WindowSizeData,
|
ScriptToConstellationChan, ScrollState, StructuredSerializedData, WindowSizeData,
|
||||||
WindowSizeType,
|
WindowSizeType,
|
||||||
};
|
};
|
||||||
use selectors::attr::CaseSensitivity;
|
use selectors::attr::CaseSensitivity;
|
||||||
|
@ -2760,7 +2760,7 @@ impl Window {
|
||||||
time_profiler_chan: TimeProfilerChan,
|
time_profiler_chan: TimeProfilerChan,
|
||||||
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||||
constellation_chan: ScriptToConstellationChan,
|
constellation_chan: ScriptToConstellationChan,
|
||||||
control_chan: IpcSender<ConstellationControlMsg>,
|
control_chan: IpcSender<ScriptThreadMessage>,
|
||||||
pipeline_id: PipelineId,
|
pipeline_id: PipelineId,
|
||||||
parent_info: Option<PipelineId>,
|
parent_info: Option<PipelineId>,
|
||||||
window_size: WindowSizeData,
|
window_size: WindowSizeData,
|
||||||
|
@ -3035,7 +3035,7 @@ pub(crate) struct CSSErrorReporter {
|
||||||
// which is necessary to fulfill the bounds required by the
|
// which is necessary to fulfill the bounds required by the
|
||||||
// uses of the ParseErrorReporter trait.
|
// uses of the ParseErrorReporter trait.
|
||||||
#[ignore_malloc_size_of = "Arc is defined in libstd"]
|
#[ignore_malloc_size_of = "Arc is defined in libstd"]
|
||||||
pub(crate) script_chan: Arc<Mutex<IpcSender<ConstellationControlMsg>>>,
|
pub(crate) script_chan: Arc<Mutex<IpcSender<ScriptThreadMessage>>>,
|
||||||
}
|
}
|
||||||
unsafe_no_jsmanaged_fields!(CSSErrorReporter);
|
unsafe_no_jsmanaged_fields!(CSSErrorReporter);
|
||||||
|
|
||||||
|
@ -3061,7 +3061,7 @@ impl ParseErrorReporter for CSSErrorReporter {
|
||||||
.script_chan
|
.script_chan
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.send(ConstellationControlMsg::ReportCSSError(
|
.send(ScriptThreadMessage::ReportCSSError(
|
||||||
self.pipelineid,
|
self.pipelineid,
|
||||||
url.0.to_string(),
|
url.0.to_string(),
|
||||||
location.line,
|
location.line,
|
||||||
|
|
|
@ -16,7 +16,7 @@ use net_traits::image_cache::PendingImageResponse;
|
||||||
use net_traits::FetchResponseMsg;
|
use net_traits::FetchResponseMsg;
|
||||||
use profile_traits::mem::{self as profile_mem, OpaqueSender, ReportsChan};
|
use profile_traits::mem::{self as profile_mem, OpaqueSender, ReportsChan};
|
||||||
use profile_traits::time::{self as profile_time};
|
use profile_traits::time::{self as profile_time};
|
||||||
use script_traits::{ConstellationControlMsg, LayoutMsg, Painter, ScriptMsg};
|
use script_traits::{LayoutMsg, Painter, ScriptMsg, ScriptThreadMessage};
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
use timers::TimerScheduler;
|
use timers::TimerScheduler;
|
||||||
#[cfg(feature = "webgpu")]
|
#[cfg(feature = "webgpu")]
|
||||||
|
@ -34,7 +34,7 @@ use crate::task_source::TaskSourceName;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) enum MixedMessage {
|
pub(crate) enum MixedMessage {
|
||||||
FromConstellation(ConstellationControlMsg),
|
FromConstellation(ScriptThreadMessage),
|
||||||
FromScript(MainThreadScriptMsg),
|
FromScript(MainThreadScriptMsg),
|
||||||
FromDevtools(DevtoolScriptControlMsg),
|
FromDevtools(DevtoolScriptControlMsg),
|
||||||
FromImageCache(PendingImageResponse),
|
FromImageCache(PendingImageResponse),
|
||||||
|
@ -47,46 +47,46 @@ impl MixedMessage {
|
||||||
pub(crate) fn pipeline_id(&self) -> Option<PipelineId> {
|
pub(crate) fn pipeline_id(&self) -> Option<PipelineId> {
|
||||||
match self {
|
match self {
|
||||||
MixedMessage::FromConstellation(ref inner_msg) => match *inner_msg {
|
MixedMessage::FromConstellation(ref inner_msg) => match *inner_msg {
|
||||||
ConstellationControlMsg::StopDelayingLoadEventsMode(id) => Some(id),
|
ScriptThreadMessage::StopDelayingLoadEventsMode(id) => Some(id),
|
||||||
ConstellationControlMsg::AttachLayout(ref new_layout_info) => new_layout_info
|
ScriptThreadMessage::AttachLayout(ref new_layout_info) => new_layout_info
|
||||||
.parent_info
|
.parent_info
|
||||||
.or(Some(new_layout_info.new_pipeline_id)),
|
.or(Some(new_layout_info.new_pipeline_id)),
|
||||||
ConstellationControlMsg::Resize(id, ..) => Some(id),
|
ScriptThreadMessage::Resize(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::ThemeChange(id, ..) => Some(id),
|
ScriptThreadMessage::ThemeChange(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::ResizeInactive(id, ..) => Some(id),
|
ScriptThreadMessage::ResizeInactive(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::UnloadDocument(id) => Some(id),
|
ScriptThreadMessage::UnloadDocument(id) => Some(id),
|
||||||
ConstellationControlMsg::ExitPipeline(id, ..) => Some(id),
|
ScriptThreadMessage::ExitPipeline(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::ExitScriptThread => None,
|
ScriptThreadMessage::ExitScriptThread => None,
|
||||||
ConstellationControlMsg::SendEvent(id, ..) => Some(id),
|
ScriptThreadMessage::SendEvent(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::Viewport(id, ..) => Some(id),
|
ScriptThreadMessage::Viewport(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::GetTitle(id) => Some(id),
|
ScriptThreadMessage::GetTitle(id) => Some(id),
|
||||||
ConstellationControlMsg::SetDocumentActivity(id, ..) => Some(id),
|
ScriptThreadMessage::SetDocumentActivity(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::SetThrottled(id, ..) => Some(id),
|
ScriptThreadMessage::SetThrottled(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::SetThrottledInContainingIframe(id, ..) => Some(id),
|
ScriptThreadMessage::SetThrottledInContainingIframe(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::NavigateIframe(id, ..) => Some(id),
|
ScriptThreadMessage::NavigateIframe(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::PostMessage { target: id, .. } => Some(id),
|
ScriptThreadMessage::PostMessage { target: id, .. } => Some(id),
|
||||||
ConstellationControlMsg::UpdatePipelineId(_, _, _, id, _) => Some(id),
|
ScriptThreadMessage::UpdatePipelineId(_, _, _, id, _) => Some(id),
|
||||||
ConstellationControlMsg::UpdateHistoryState(id, ..) => Some(id),
|
ScriptThreadMessage::UpdateHistoryState(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::RemoveHistoryStates(id, ..) => Some(id),
|
ScriptThreadMessage::RemoveHistoryStates(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::FocusIFrame(id, ..) => Some(id),
|
ScriptThreadMessage::FocusIFrame(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::WebDriverScriptCommand(id, ..) => Some(id),
|
ScriptThreadMessage::WebDriverScriptCommand(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::TickAllAnimations(id, ..) => Some(id),
|
ScriptThreadMessage::TickAllAnimations(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::WebFontLoaded(id, ..) => Some(id),
|
ScriptThreadMessage::WebFontLoaded(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::DispatchIFrameLoadEvent {
|
ScriptThreadMessage::DispatchIFrameLoadEvent {
|
||||||
target: _,
|
target: _,
|
||||||
parent: id,
|
parent: id,
|
||||||
child: _,
|
child: _,
|
||||||
} => Some(id),
|
} => Some(id),
|
||||||
ConstellationControlMsg::DispatchStorageEvent(id, ..) => Some(id),
|
ScriptThreadMessage::DispatchStorageEvent(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::ReportCSSError(id, ..) => Some(id),
|
ScriptThreadMessage::ReportCSSError(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::Reload(id, ..) => Some(id),
|
ScriptThreadMessage::Reload(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::PaintMetric(id, ..) => Some(id),
|
ScriptThreadMessage::PaintMetric(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::ExitFullScreen(id, ..) => Some(id),
|
ScriptThreadMessage::ExitFullScreen(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::MediaSessionAction(..) => None,
|
ScriptThreadMessage::MediaSessionAction(..) => None,
|
||||||
#[cfg(feature = "webgpu")]
|
#[cfg(feature = "webgpu")]
|
||||||
ConstellationControlMsg::SetWebGPUPort(..) => None,
|
ScriptThreadMessage::SetWebGPUPort(..) => None,
|
||||||
ConstellationControlMsg::SetScrollStates(id, ..) => Some(id),
|
ScriptThreadMessage::SetScrollStates(id, ..) => Some(id),
|
||||||
ConstellationControlMsg::SetEpochPaintTime(id, ..) => Some(id),
|
ScriptThreadMessage::SetEpochPaintTime(id, ..) => Some(id),
|
||||||
},
|
},
|
||||||
MixedMessage::FromScript(ref inner_msg) => match *inner_msg {
|
MixedMessage::FromScript(ref inner_msg) => match *inner_msg {
|
||||||
MainThreadScriptMsg::Common(CommonScriptMsg::Task(_, _, pipeline_id, _)) => {
|
MainThreadScriptMsg::Common(CommonScriptMsg::Task(_, _, pipeline_id, _)) => {
|
||||||
|
@ -308,7 +308,7 @@ pub(crate) struct ScriptThreadSenders {
|
||||||
|
|
||||||
/// A [`Sender`] that sends messages to the `Constellation`.
|
/// A [`Sender`] that sends messages to the `Constellation`.
|
||||||
#[no_trace]
|
#[no_trace]
|
||||||
pub(crate) constellation_sender: IpcSender<ConstellationControlMsg>,
|
pub(crate) constellation_sender: IpcSender<ScriptThreadMessage>,
|
||||||
|
|
||||||
/// A [`Sender`] that sends messages to the `Constellation` associated with
|
/// A [`Sender`] that sends messages to the `Constellation` associated with
|
||||||
/// particular pipelines.
|
/// particular pipelines.
|
||||||
|
@ -348,7 +348,7 @@ pub(crate) struct ScriptThreadSenders {
|
||||||
pub(crate) struct ScriptThreadReceivers {
|
pub(crate) struct ScriptThreadReceivers {
|
||||||
/// A [`Receiver`] that receives messages from the constellation.
|
/// A [`Receiver`] that receives messages from the constellation.
|
||||||
#[no_trace]
|
#[no_trace]
|
||||||
pub(crate) constellation_receiver: Receiver<ConstellationControlMsg>,
|
pub(crate) constellation_receiver: Receiver<ScriptThreadMessage>,
|
||||||
|
|
||||||
/// The [`Receiver`] which receives incoming messages from the `ImageCache`.
|
/// The [`Receiver`] which receives incoming messages from the `ImageCache`.
|
||||||
#[no_trace]
|
#[no_trace]
|
||||||
|
|
|
@ -82,9 +82,9 @@ use script_layout_interface::{
|
||||||
};
|
};
|
||||||
use script_traits::webdriver_msg::WebDriverScriptCommand;
|
use script_traits::webdriver_msg::WebDriverScriptCommand;
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
CompositorEvent, ConstellationControlMsg, DiscardBrowsingContext, DocumentActivity,
|
CompositorEvent, DiscardBrowsingContext, DocumentActivity, EventResult, InitialScriptState,
|
||||||
EventResult, InitialScriptState, JsEvalResult, LoadData, LoadOrigin, NavigationHistoryBehavior,
|
JsEvalResult, LoadData, LoadOrigin, NavigationHistoryBehavior, NewLayoutInfo, Painter,
|
||||||
NewLayoutInfo, Painter, ProgressiveWebMetricType, ScriptMsg, ScriptToConstellationChan,
|
ProgressiveWebMetricType, ScriptMsg, ScriptThreadMessage, ScriptToConstellationChan,
|
||||||
ScrollState, StructuredSerializedData, UntrustedNodeAddress, UpdatePipelineIdReason,
|
ScrollState, StructuredSerializedData, UntrustedNodeAddress, UpdatePipelineIdReason,
|
||||||
WindowSizeData, WindowSizeType,
|
WindowSizeData, WindowSizeType,
|
||||||
};
|
};
|
||||||
|
@ -1411,7 +1411,7 @@ impl ScriptThread {
|
||||||
// This has to be handled before the ResizeMsg below,
|
// This has to be handled before the ResizeMsg below,
|
||||||
// otherwise the page may not have been added to the
|
// otherwise the page may not have been added to the
|
||||||
// child list yet, causing the find() to fail.
|
// child list yet, causing the find() to fail.
|
||||||
MixedMessage::FromConstellation(ConstellationControlMsg::AttachLayout(
|
MixedMessage::FromConstellation(ScriptThreadMessage::AttachLayout(
|
||||||
new_layout_info,
|
new_layout_info,
|
||||||
)) => {
|
)) => {
|
||||||
let pipeline_id = new_layout_info.new_pipeline_id;
|
let pipeline_id = new_layout_info.new_pipeline_id;
|
||||||
|
@ -1449,19 +1449,18 @@ impl ScriptThread {
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
MixedMessage::FromConstellation(ConstellationControlMsg::Resize(
|
MixedMessage::FromConstellation(ScriptThreadMessage::Resize(
|
||||||
id,
|
id,
|
||||||
size,
|
size,
|
||||||
size_type,
|
size_type,
|
||||||
)) => {
|
)) => {
|
||||||
self.handle_resize_message(id, size, size_type);
|
self.handle_resize_message(id, size, size_type);
|
||||||
},
|
},
|
||||||
MixedMessage::FromConstellation(ConstellationControlMsg::Viewport(id, rect)) => {
|
MixedMessage::FromConstellation(ScriptThreadMessage::Viewport(id, rect)) => self
|
||||||
self.profile_event(ScriptThreadEventCategory::SetViewport, Some(id), || {
|
.profile_event(ScriptThreadEventCategory::SetViewport, Some(id), || {
|
||||||
self.handle_viewport(id, rect);
|
self.handle_viewport(id, rect);
|
||||||
})
|
}),
|
||||||
},
|
MixedMessage::FromConstellation(ScriptThreadMessage::TickAllAnimations(
|
||||||
MixedMessage::FromConstellation(ConstellationControlMsg::TickAllAnimations(
|
|
||||||
pipeline_id,
|
pipeline_id,
|
||||||
tick_type,
|
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)
|
self.handle_event(id, event)
|
||||||
},
|
},
|
||||||
MixedMessage::FromScript(MainThreadScriptMsg::Common(CommonScriptMsg::Task(
|
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.
|
// 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".
|
// Continue without adding it to "sequential".
|
||||||
},
|
},
|
||||||
MixedMessage::FromConstellation(ConstellationControlMsg::ExitFullScreen(id)) => {
|
MixedMessage::FromConstellation(ScriptThreadMessage::ExitFullScreen(id)) => self
|
||||||
self.profile_event(ScriptThreadEventCategory::ExitFullscreen, Some(id), || {
|
.profile_event(ScriptThreadEventCategory::ExitFullscreen, Some(id), || {
|
||||||
self.handle_exit_fullscreen(id, can_gc);
|
self.handle_exit_fullscreen(id, can_gc);
|
||||||
})
|
}),
|
||||||
},
|
|
||||||
_ => {
|
_ => {
|
||||||
sequential.push(event);
|
sequential.push(event);
|
||||||
},
|
},
|
||||||
|
@ -1525,11 +1523,11 @@ impl ScriptThread {
|
||||||
if self.closing.load(Ordering::SeqCst) {
|
if self.closing.load(Ordering::SeqCst) {
|
||||||
// If we've received the closed signal from the BHM, only handle exit messages.
|
// If we've received the closed signal from the BHM, only handle exit messages.
|
||||||
match msg {
|
match msg {
|
||||||
MixedMessage::FromConstellation(ConstellationControlMsg::ExitScriptThread) => {
|
MixedMessage::FromConstellation(ScriptThreadMessage::ExitScriptThread) => {
|
||||||
self.handle_exit_script_thread_msg(can_gc);
|
self.handle_exit_script_thread_msg(can_gc);
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
MixedMessage::FromConstellation(ConstellationControlMsg::ExitPipeline(
|
MixedMessage::FromConstellation(ScriptThreadMessage::ExitPipeline(
|
||||||
pipeline_id,
|
pipeline_id,
|
||||||
discard_browsing_context,
|
discard_browsing_context,
|
||||||
)) => {
|
)) => {
|
||||||
|
@ -1546,7 +1544,7 @@ impl ScriptThread {
|
||||||
|
|
||||||
let exiting = self.profile_event(category, pipeline_id, move || {
|
let exiting = self.profile_event(category, pipeline_id, move || {
|
||||||
match msg {
|
match msg {
|
||||||
MixedMessage::FromConstellation(ConstellationControlMsg::ExitScriptThread) => {
|
MixedMessage::FromConstellation(ScriptThreadMessage::ExitScriptThread) => {
|
||||||
self.handle_exit_script_thread_msg(can_gc);
|
self.handle_exit_script_thread_msg(can_gc);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
@ -1601,7 +1599,7 @@ impl ScriptThread {
|
||||||
fn categorize_msg(&self, msg: &MixedMessage) -> ScriptThreadEventCategory {
|
fn categorize_msg(&self, msg: &MixedMessage) -> ScriptThreadEventCategory {
|
||||||
match *msg {
|
match *msg {
|
||||||
MixedMessage::FromConstellation(ref inner_msg) => match *inner_msg {
|
MixedMessage::FromConstellation(ref inner_msg) => match *inner_msg {
|
||||||
ConstellationControlMsg::SendEvent(_, _) => ScriptThreadEventCategory::DomEvent,
|
ScriptThreadMessage::SendEvent(_, _) => ScriptThreadEventCategory::DomEvent,
|
||||||
_ => ScriptThreadEventCategory::ConstellationMsg,
|
_ => ScriptThreadEventCategory::ConstellationMsg,
|
||||||
},
|
},
|
||||||
// TODO https://github.com/servo/servo/issues/18998
|
// TODO https://github.com/servo/servo/issues/18998
|
||||||
|
@ -1779,12 +1777,12 @@ impl ScriptThread {
|
||||||
value
|
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 {
|
match msg {
|
||||||
ConstellationControlMsg::StopDelayingLoadEventsMode(pipeline_id) => {
|
ScriptThreadMessage::StopDelayingLoadEventsMode(pipeline_id) => {
|
||||||
self.handle_stop_delaying_load_events_mode(pipeline_id)
|
self.handle_stop_delaying_load_events_mode(pipeline_id)
|
||||||
},
|
},
|
||||||
ConstellationControlMsg::NavigateIframe(
|
ScriptThreadMessage::NavigateIframe(
|
||||||
parent_pipeline_id,
|
parent_pipeline_id,
|
||||||
browsing_context_id,
|
browsing_context_id,
|
||||||
load_data,
|
load_data,
|
||||||
|
@ -1796,25 +1794,23 @@ impl ScriptThread {
|
||||||
history_handling,
|
history_handling,
|
||||||
can_gc,
|
can_gc,
|
||||||
),
|
),
|
||||||
ConstellationControlMsg::UnloadDocument(pipeline_id) => {
|
ScriptThreadMessage::UnloadDocument(pipeline_id) => {
|
||||||
self.handle_unload_document(pipeline_id, can_gc)
|
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)
|
self.handle_resize_inactive_msg(id, new_size)
|
||||||
},
|
},
|
||||||
ConstellationControlMsg::ThemeChange(_, theme) => {
|
ScriptThreadMessage::ThemeChange(_, theme) => {
|
||||||
self.handle_theme_change_msg(theme);
|
self.handle_theme_change_msg(theme);
|
||||||
},
|
},
|
||||||
ConstellationControlMsg::GetTitle(pipeline_id) => {
|
ScriptThreadMessage::GetTitle(pipeline_id) => self.handle_get_title_msg(pipeline_id),
|
||||||
self.handle_get_title_msg(pipeline_id)
|
ScriptThreadMessage::SetDocumentActivity(pipeline_id, activity) => {
|
||||||
},
|
|
||||||
ConstellationControlMsg::SetDocumentActivity(pipeline_id, activity) => {
|
|
||||||
self.handle_set_document_activity_msg(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)
|
self.handle_set_throttled_msg(pipeline_id, throttled)
|
||||||
},
|
},
|
||||||
ConstellationControlMsg::SetThrottledInContainingIframe(
|
ScriptThreadMessage::SetThrottledInContainingIframe(
|
||||||
parent_pipeline_id,
|
parent_pipeline_id,
|
||||||
browsing_context_id,
|
browsing_context_id,
|
||||||
throttled,
|
throttled,
|
||||||
|
@ -1823,7 +1819,7 @@ impl ScriptThread {
|
||||||
browsing_context_id,
|
browsing_context_id,
|
||||||
throttled,
|
throttled,
|
||||||
),
|
),
|
||||||
ConstellationControlMsg::PostMessage {
|
ScriptThreadMessage::PostMessage {
|
||||||
target: target_pipeline_id,
|
target: target_pipeline_id,
|
||||||
source: source_pipeline_id,
|
source: source_pipeline_id,
|
||||||
source_browsing_context,
|
source_browsing_context,
|
||||||
|
@ -1838,7 +1834,7 @@ impl ScriptThread {
|
||||||
source_origin,
|
source_origin,
|
||||||
data,
|
data,
|
||||||
),
|
),
|
||||||
ConstellationControlMsg::UpdatePipelineId(
|
ScriptThreadMessage::UpdatePipelineId(
|
||||||
parent_pipeline_id,
|
parent_pipeline_id,
|
||||||
browsing_context_id,
|
browsing_context_id,
|
||||||
top_level_browsing_context_id,
|
top_level_browsing_context_id,
|
||||||
|
@ -1852,27 +1848,27 @@ impl ScriptThread {
|
||||||
reason,
|
reason,
|
||||||
can_gc,
|
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)
|
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)
|
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)
|
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)
|
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)
|
self.handle_web_font_loaded(pipeline_id, success)
|
||||||
},
|
},
|
||||||
ConstellationControlMsg::DispatchIFrameLoadEvent {
|
ScriptThreadMessage::DispatchIFrameLoadEvent {
|
||||||
target: browsing_context_id,
|
target: browsing_context_id,
|
||||||
parent: parent_id,
|
parent: parent_id,
|
||||||
child: child_id,
|
child: child_id,
|
||||||
} => self.handle_iframe_load_event(parent_id, browsing_context_id, child_id, can_gc),
|
} => self.handle_iframe_load_event(parent_id, browsing_context_id, child_id, can_gc),
|
||||||
ConstellationControlMsg::DispatchStorageEvent(
|
ScriptThreadMessage::DispatchStorageEvent(
|
||||||
pipeline_id,
|
pipeline_id,
|
||||||
storage,
|
storage,
|
||||||
url,
|
url,
|
||||||
|
@ -1880,37 +1876,37 @@ impl ScriptThread {
|
||||||
old_value,
|
old_value,
|
||||||
new_value,
|
new_value,
|
||||||
) => self.handle_storage_event(pipeline_id, storage, url, key, 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)
|
self.handle_css_error_reporting(pipeline_id, filename, line, column, msg)
|
||||||
},
|
},
|
||||||
ConstellationControlMsg::Reload(pipeline_id) => self.handle_reload(pipeline_id, can_gc),
|
ScriptThreadMessage::Reload(pipeline_id) => self.handle_reload(pipeline_id, can_gc),
|
||||||
ConstellationControlMsg::ExitPipeline(pipeline_id, discard_browsing_context) => {
|
ScriptThreadMessage::ExitPipeline(pipeline_id, discard_browsing_context) => {
|
||||||
self.handle_exit_pipeline_msg(pipeline_id, discard_browsing_context, can_gc)
|
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)
|
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)
|
self.handle_media_session_action(pipeline_id, action, can_gc)
|
||||||
},
|
},
|
||||||
#[cfg(feature = "webgpu")]
|
#[cfg(feature = "webgpu")]
|
||||||
ConstellationControlMsg::SetWebGPUPort(port) => {
|
ScriptThreadMessage::SetWebGPUPort(port) => {
|
||||||
*self.receivers.webgpu_receiver.borrow_mut() =
|
*self.receivers.webgpu_receiver.borrow_mut() =
|
||||||
ROUTER.route_ipc_receiver_to_new_crossbeam_receiver(port);
|
ROUTER.route_ipc_receiver_to_new_crossbeam_receiver(port);
|
||||||
},
|
},
|
||||||
msg @ ConstellationControlMsg::AttachLayout(..) |
|
msg @ ScriptThreadMessage::AttachLayout(..) |
|
||||||
msg @ ConstellationControlMsg::Viewport(..) |
|
msg @ ScriptThreadMessage::Viewport(..) |
|
||||||
msg @ ConstellationControlMsg::Resize(..) |
|
msg @ ScriptThreadMessage::Resize(..) |
|
||||||
msg @ ConstellationControlMsg::ExitFullScreen(..) |
|
msg @ ScriptThreadMessage::ExitFullScreen(..) |
|
||||||
msg @ ConstellationControlMsg::SendEvent(..) |
|
msg @ ScriptThreadMessage::SendEvent(..) |
|
||||||
msg @ ConstellationControlMsg::TickAllAnimations(..) |
|
msg @ ScriptThreadMessage::TickAllAnimations(..) |
|
||||||
msg @ ConstellationControlMsg::ExitScriptThread => {
|
msg @ ScriptThreadMessage::ExitScriptThread => {
|
||||||
panic!("should have handled {:?} already", msg)
|
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)
|
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)
|
self.handle_set_epoch_paint_time(pipeline_id, epoch, time)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ use euclid::Rect;
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use log::warn;
|
use log::warn;
|
||||||
use pixels::Image;
|
use pixels::Image;
|
||||||
use script_traits::{AnimationState, ConstellationControlMsg, EventResult};
|
use script_traits::{AnimationState, EventResult, ScriptThreadMessage};
|
||||||
use style_traits::CSSPixel;
|
use style_traits::CSSPixel;
|
||||||
use webrender_api::DocumentId;
|
use webrender_api::DocumentId;
|
||||||
use webrender_traits::{CrossProcessCompositorApi, CrossProcessCompositorMessage};
|
use webrender_traits::{CrossProcessCompositorApi, CrossProcessCompositorMessage};
|
||||||
|
@ -112,7 +112,7 @@ pub struct SendableFrameTree {
|
||||||
pub struct CompositionPipeline {
|
pub struct CompositionPipeline {
|
||||||
pub id: PipelineId,
|
pub id: PipelineId,
|
||||||
pub top_level_browsing_context_id: TopLevelBrowsingContextId,
|
pub top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||||
pub script_chan: IpcSender<ConstellationControlMsg>,
|
pub script_chan: IpcSender<ScriptThreadMessage>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Debug for CompositorMsg {
|
impl Debug for CompositorMsg {
|
||||||
|
|
|
@ -286,10 +286,10 @@ pub enum UpdatePipelineIdReason {
|
||||||
Traversal,
|
Traversal,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Messages sent from the constellation or layout to the script thread.
|
/// Messages sent to the `ScriptThread` event loop from the `Constellation`, `Compositor`, and (for
|
||||||
// FIXME: https://github.com/servo/servo/issues/34591
|
/// now) `Layout`.
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub enum ConstellationControlMsg {
|
pub enum ScriptThreadMessage {
|
||||||
/// Takes the associated window proxy out of "delaying-load-events-mode",
|
/// Takes the associated window proxy out of "delaying-load-events-mode",
|
||||||
/// used if a scheduled navigated was refused by the embedder.
|
/// used if a scheduled navigated was refused by the embedder.
|
||||||
/// <https://html.spec.whatwg.org/multipage/#delaying-load-events-mode>
|
/// <https://html.spec.whatwg.org/multipage/#delaying-load-events-mode>
|
||||||
|
@ -406,9 +406,9 @@ pub enum ConstellationControlMsg {
|
||||||
SetEpochPaintTime(PipelineId, Epoch, CrossProcessInstant),
|
SetEpochPaintTime(PipelineId, Epoch, CrossProcessInstant),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for ConstellationControlMsg {
|
impl fmt::Debug for ScriptThreadMessage {
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||||
use self::ConstellationControlMsg::*;
|
use self::ScriptThreadMessage::*;
|
||||||
let variant = match *self {
|
let variant = match *self {
|
||||||
StopDelayingLoadEventsMode(..) => "StopDelayingLoadsEventMode",
|
StopDelayingLoadEventsMode(..) => "StopDelayingLoadsEventMode",
|
||||||
AttachLayout(..) => "AttachLayout",
|
AttachLayout(..) => "AttachLayout",
|
||||||
|
@ -551,9 +551,9 @@ pub struct InitialScriptState {
|
||||||
/// Loading into a Secure Context
|
/// Loading into a Secure Context
|
||||||
pub inherited_secure_context: Option<bool>,
|
pub inherited_secure_context: Option<bool>,
|
||||||
/// A channel with which messages can be sent to us (the script thread).
|
/// A channel with which messages can be sent to us (the script thread).
|
||||||
pub constellation_sender: IpcSender<ConstellationControlMsg>,
|
pub constellation_sender: IpcSender<ScriptThreadMessage>,
|
||||||
/// A port on which messages sent by the constellation to script can be received.
|
/// A port on which messages sent by the constellation to script can be received.
|
||||||
pub constellation_receiver: IpcReceiver<ConstellationControlMsg>,
|
pub constellation_receiver: IpcReceiver<ScriptThreadMessage>,
|
||||||
/// A channel on which messages can be sent to the constellation from script.
|
/// A channel on which messages can be sent to the constellation from script.
|
||||||
pub pipeline_to_constellation_sender: ScriptToConstellationChan,
|
pub pipeline_to_constellation_sender: ScriptToConstellationChan,
|
||||||
/// A handle to register script-(and associated layout-)threads for hang monitoring.
|
/// A handle to register script-(and associated layout-)threads for hang monitoring.
|
||||||
|
|
|
@ -33,8 +33,8 @@ use net_traits::image_cache::{ImageCache, PendingImageId};
|
||||||
use profile_traits::mem::Report;
|
use profile_traits::mem::Report;
|
||||||
use profile_traits::time;
|
use profile_traits::time;
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
ConstellationControlMsg, InitialScriptState, LoadData, Painter, ScrollState,
|
InitialScriptState, LoadData, Painter, ScriptThreadMessage, ScrollState, UntrustedNodeAddress,
|
||||||
UntrustedNodeAddress, WindowSizeData,
|
WindowSizeData,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use servo_arc::Arc as ServoArc;
|
use servo_arc::Arc as ServoArc;
|
||||||
|
@ -185,7 +185,7 @@ pub struct LayoutConfig {
|
||||||
pub webview_id: WebViewId,
|
pub webview_id: WebViewId,
|
||||||
pub url: ServoUrl,
|
pub url: ServoUrl,
|
||||||
pub is_iframe: bool,
|
pub is_iframe: bool,
|
||||||
pub script_chan: IpcSender<ConstellationControlMsg>,
|
pub script_chan: IpcSender<ScriptThreadMessage>,
|
||||||
pub image_cache: Arc<dyn ImageCache>,
|
pub image_cache: Arc<dyn ImageCache>,
|
||||||
pub font_context: Arc<FontContext>,
|
pub font_context: Arc<FontContext>,
|
||||||
pub time_profiler_chan: time::ProfilerChan,
|
pub time_profiler_chan: time::ProfilerChan,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue