mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +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
|
@ -20,7 +20,7 @@ use compositing_traits::{
|
||||||
CompositionPipeline, CompositorMsg, CompositorReceiver, SendableFrameTree,
|
CompositionPipeline, CompositorMsg, CompositorReceiver, SendableFrameTree,
|
||||||
};
|
};
|
||||||
use constellation_traits::{
|
use constellation_traits::{
|
||||||
AnimationTickType, CompositorHitTestResult, ConstellationMsg, PaintMetricEvent,
|
AnimationTickType, CompositorHitTestResult, EmbedderToConstellationMessage, PaintMetricEvent,
|
||||||
UntrustedNodeAddress, WindowSizeType,
|
UntrustedNodeAddress, WindowSizeType,
|
||||||
};
|
};
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
|
@ -101,7 +101,7 @@ pub struct ServoRenderer {
|
||||||
compositor_receiver: CompositorReceiver,
|
compositor_receiver: CompositorReceiver,
|
||||||
|
|
||||||
/// The channel on which messages can be sent to the constellation.
|
/// The channel on which messages can be sent to the constellation.
|
||||||
pub(crate) constellation_sender: Sender<ConstellationMsg>,
|
pub(crate) constellation_sender: Sender<EmbedderToConstellationMessage>,
|
||||||
|
|
||||||
/// 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,
|
||||||
|
@ -279,7 +279,7 @@ impl PipelineDetails {
|
||||||
tick_type.insert(AnimationTickType::REQUEST_ANIMATION_FRAME);
|
tick_type.insert(AnimationTickType::REQUEST_ANIMATION_FRAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
let msg = ConstellationMsg::TickAnimation(self.id, tick_type);
|
let msg = EmbedderToConstellationMessage::TickAnimation(self.id, tick_type);
|
||||||
if let Err(e) = compositor.global.borrow().constellation_sender.send(msg) {
|
if let Err(e) = compositor.global.borrow().constellation_sender.send(msg) {
|
||||||
warn!("Sending tick to constellation failed ({:?}).", e);
|
warn!("Sending tick to constellation failed ({:?}).", e);
|
||||||
}
|
}
|
||||||
|
@ -415,7 +415,9 @@ impl ServoRenderer {
|
||||||
self.cursor = cursor;
|
self.cursor = cursor;
|
||||||
if let Err(e) = self
|
if let Err(e) = self
|
||||||
.constellation_sender
|
.constellation_sender
|
||||||
.send(ConstellationMsg::SetCursor(webview_id, cursor))
|
.send(EmbedderToConstellationMessage::SetCursor(
|
||||||
|
webview_id, cursor,
|
||||||
|
))
|
||||||
{
|
{
|
||||||
warn!("Sending event to constellation failed ({:?}).", e);
|
warn!("Sending event to constellation failed ({:?}).", e);
|
||||||
}
|
}
|
||||||
|
@ -1261,7 +1263,7 @@ impl IOCompositor {
|
||||||
// to device pixels, but not including any pinch zoom.
|
// to device pixels, but not including any pinch zoom.
|
||||||
let hidpi_scale_factor = self.device_pixels_per_page_pixel_not_including_page_zoom();
|
let hidpi_scale_factor = self.device_pixels_per_page_pixel_not_including_page_zoom();
|
||||||
let size = rect.size().to_f32() / hidpi_scale_factor;
|
let size = rect.size().to_f32() / hidpi_scale_factor;
|
||||||
let msg = ConstellationMsg::ChangeViewportDetails(
|
let msg = EmbedderToConstellationMessage::ChangeViewportDetails(
|
||||||
webview_id,
|
webview_id,
|
||||||
ViewportDetails {
|
ViewportDetails {
|
||||||
size,
|
size,
|
||||||
|
@ -1420,7 +1422,7 @@ impl IOCompositor {
|
||||||
|
|
||||||
// Pass the pipeline/epoch states to the constellation and check
|
// Pass the pipeline/epoch states to the constellation and check
|
||||||
// if it's safe to output the image.
|
// if it's safe to output the image.
|
||||||
let msg = ConstellationMsg::IsReadyToSaveImage(pipeline_epochs);
|
let msg = EmbedderToConstellationMessage::IsReadyToSaveImage(pipeline_epochs);
|
||||||
if let Err(e) = self.global.borrow().constellation_sender.send(msg) {
|
if let Err(e) = self.global.borrow().constellation_sender.send(msg) {
|
||||||
warn!("Sending ready to save to constellation failed ({:?}).", e);
|
warn!("Sending ready to save to constellation failed ({:?}).", e);
|
||||||
}
|
}
|
||||||
|
@ -1585,7 +1587,7 @@ impl IOCompositor {
|
||||||
PaintMetricState::Seen(epoch, first_reflow) if epoch <= current_epoch => {
|
PaintMetricState::Seen(epoch, first_reflow) if epoch <= current_epoch => {
|
||||||
assert!(epoch <= current_epoch);
|
assert!(epoch <= current_epoch);
|
||||||
if let Err(error) = self.global.borrow().constellation_sender.send(
|
if let Err(error) = self.global.borrow().constellation_sender.send(
|
||||||
ConstellationMsg::PaintMetric(
|
EmbedderToConstellationMessage::PaintMetric(
|
||||||
*pipeline_id,
|
*pipeline_id,
|
||||||
PaintMetricEvent::FirstPaint(paint_time, first_reflow),
|
PaintMetricEvent::FirstPaint(paint_time, first_reflow),
|
||||||
),
|
),
|
||||||
|
@ -1602,7 +1604,7 @@ impl IOCompositor {
|
||||||
match pipeline.first_contentful_paint_metric {
|
match pipeline.first_contentful_paint_metric {
|
||||||
PaintMetricState::Seen(epoch, first_reflow) if epoch <= current_epoch => {
|
PaintMetricState::Seen(epoch, first_reflow) if epoch <= current_epoch => {
|
||||||
if let Err(error) = self.global.borrow().constellation_sender.send(
|
if let Err(error) = self.global.borrow().constellation_sender.send(
|
||||||
ConstellationMsg::PaintMetric(
|
EmbedderToConstellationMessage::PaintMetric(
|
||||||
*pipeline_id,
|
*pipeline_id,
|
||||||
PaintMetricEvent::FirstContentfulPaint(paint_time, first_reflow),
|
PaintMetricEvent::FirstContentfulPaint(paint_time, first_reflow),
|
||||||
),
|
),
|
||||||
|
|
|
@ -8,7 +8,7 @@ use std::cell::Cell;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use compositing_traits::{CompositorProxy, CompositorReceiver};
|
use compositing_traits::{CompositorProxy, CompositorReceiver};
|
||||||
use constellation_traits::ConstellationMsg;
|
use constellation_traits::EmbedderToConstellationMessage;
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use embedder_traits::ShutdownState;
|
use embedder_traits::ShutdownState;
|
||||||
use profile_traits::{mem, time};
|
use profile_traits::{mem, time};
|
||||||
|
@ -34,7 +34,7 @@ pub struct InitialCompositorState {
|
||||||
/// A port on which messages inbound to the compositor can be received.
|
/// A port on which messages inbound to the compositor can be received.
|
||||||
pub receiver: CompositorReceiver,
|
pub receiver: CompositorReceiver,
|
||||||
/// A channel to the constellation.
|
/// A channel to the constellation.
|
||||||
pub constellation_chan: Sender<ConstellationMsg>,
|
pub constellation_chan: Sender<EmbedderToConstellationMessage>,
|
||||||
/// A channel to the time profiler thread.
|
/// A channel to the time profiler thread.
|
||||||
pub time_profiler_chan: time::ProfilerChan,
|
pub time_profiler_chan: time::ProfilerChan,
|
||||||
/// A channel to the memory profiler thread.
|
/// A channel to the memory profiler thread.
|
||||||
|
|
|
@ -9,7 +9,7 @@ use std::rc::Rc;
|
||||||
|
|
||||||
use base::id::{PipelineId, WebViewId};
|
use base::id::{PipelineId, WebViewId};
|
||||||
use compositing_traits::SendableFrameTree;
|
use compositing_traits::SendableFrameTree;
|
||||||
use constellation_traits::{CompositorHitTestResult, ConstellationMsg, ScrollState};
|
use constellation_traits::{CompositorHitTestResult, EmbedderToConstellationMessage, ScrollState};
|
||||||
use embedder_traits::{
|
use embedder_traits::{
|
||||||
InputEvent, MouseButton, MouseButtonAction, MouseButtonEvent, MouseMoveEvent, ShutdownState,
|
InputEvent, MouseButton, MouseButtonAction, MouseButtonEvent, MouseMoveEvent, ShutdownState,
|
||||||
TouchEvent, TouchEventType, TouchId,
|
TouchEvent, TouchEventType, TouchId,
|
||||||
|
@ -168,14 +168,9 @@ impl WebView {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let _ = self
|
let _ = self.global.borrow().constellation_sender.send(
|
||||||
.global
|
EmbedderToConstellationMessage::SetScrollStates(pipeline_id, scroll_states),
|
||||||
.borrow()
|
);
|
||||||
.constellation_sender
|
|
||||||
.send(ConstellationMsg::SetScrollStates(
|
|
||||||
pipeline_id,
|
|
||||||
scroll_states,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn set_frame_tree_on_pipeline_details(
|
pub(crate) fn set_frame_tree_on_pipeline_details(
|
||||||
|
@ -295,16 +290,9 @@ impl WebView {
|
||||||
|
|
||||||
self.global.borrow_mut().update_cursor(point, &result);
|
self.global.borrow_mut().update_cursor(point, &result);
|
||||||
|
|
||||||
if let Err(error) =
|
if let Err(error) = self.global.borrow().constellation_sender.send(
|
||||||
self.global
|
EmbedderToConstellationMessage::ForwardInputEvent(self.id, event, Some(result)),
|
||||||
.borrow()
|
) {
|
||||||
.constellation_sender
|
|
||||||
.send(ConstellationMsg::ForwardInputEvent(
|
|
||||||
self.id,
|
|
||||||
event,
|
|
||||||
Some(result),
|
|
||||||
))
|
|
||||||
{
|
|
||||||
warn!("Sending event to constellation failed ({error:?}).");
|
warn!("Sending event to constellation failed ({error:?}).");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -364,16 +352,9 @@ impl WebView {
|
||||||
|
|
||||||
event.init_sequence_id(self.touch_handler.current_sequence_id);
|
event.init_sequence_id(self.touch_handler.current_sequence_id);
|
||||||
let event = InputEvent::Touch(event);
|
let event = InputEvent::Touch(event);
|
||||||
if let Err(e) =
|
if let Err(e) = self.global.borrow().constellation_sender.send(
|
||||||
self.global
|
EmbedderToConstellationMessage::ForwardInputEvent(self.id, event, Some(result)),
|
||||||
.borrow()
|
) {
|
||||||
.constellation_sender
|
|
||||||
.send(ConstellationMsg::ForwardInputEvent(
|
|
||||||
self.id,
|
|
||||||
event,
|
|
||||||
Some(result),
|
|
||||||
))
|
|
||||||
{
|
|
||||||
warn!("Sending event to constellation failed ({:?}).", e);
|
warn!("Sending event to constellation failed ({:?}).", e);
|
||||||
false
|
false
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -110,7 +110,7 @@ use canvas_traits::canvas::{CanvasId, CanvasMsg};
|
||||||
use canvas_traits::webgl::WebGLThreads;
|
use canvas_traits::webgl::WebGLThreads;
|
||||||
use compositing_traits::{CompositorMsg, CompositorProxy, SendableFrameTree};
|
use compositing_traits::{CompositorMsg, CompositorProxy, SendableFrameTree};
|
||||||
use constellation_traits::{
|
use constellation_traits::{
|
||||||
AnimationTickType, CompositorHitTestResult, ConstellationMsg as FromCompositorMsg, LogEntry,
|
AnimationTickType, CompositorHitTestResult, EmbedderToConstellationMessage, LogEntry,
|
||||||
PaintMetricEvent, ScrollState, TraversalDirection, WindowSizeType,
|
PaintMetricEvent, ScrollState, TraversalDirection, WindowSizeType,
|
||||||
};
|
};
|
||||||
use crossbeam_channel::{Receiver, Select, Sender, unbounded};
|
use crossbeam_channel::{Receiver, Select, Sender, unbounded};
|
||||||
|
@ -146,9 +146,9 @@ use script_traits::{
|
||||||
BroadcastMsg, ConstellationInputEvent, DiscardBrowsingContext, DocumentActivity, DocumentState,
|
BroadcastMsg, ConstellationInputEvent, DiscardBrowsingContext, DocumentActivity, DocumentState,
|
||||||
IFrameLoadInfo, IFrameLoadInfoWithData, IFrameSandboxState, IFrameSizeMsg, Job, LoadData,
|
IFrameLoadInfo, IFrameLoadInfoWithData, IFrameSandboxState, IFrameSizeMsg, Job, LoadData,
|
||||||
LoadOrigin, MessagePortMsg, NavigationHistoryBehavior, PortMessageTask,
|
LoadOrigin, MessagePortMsg, NavigationHistoryBehavior, PortMessageTask,
|
||||||
ProgressiveWebMetricType, SWManagerMsg, SWManagerSenders, ScriptMsg as FromScriptMsg,
|
ProgressiveWebMetricType, SWManagerMsg, SWManagerSenders, ScriptThreadMessage,
|
||||||
ScriptThreadMessage, ScriptToConstellationChan, ServiceWorkerManagerFactory, ServiceWorkerMsg,
|
ScriptToConstellationChan, ScriptToConstellationMessage, ServiceWorkerManagerFactory,
|
||||||
StructuredSerializedData, UpdatePipelineIdReason,
|
ServiceWorkerMsg, StructuredSerializedData, UpdatePipelineIdReason,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use servo_config::{opts, pref};
|
use servo_config::{opts, pref};
|
||||||
|
@ -285,11 +285,11 @@ pub struct Constellation<STF, SWF> {
|
||||||
|
|
||||||
/// An IPC channel for script threads to send messages to the constellation.
|
/// An IPC channel for script threads to send messages to the constellation.
|
||||||
/// This is the script threads' view of `script_receiver`.
|
/// This is the script threads' view of `script_receiver`.
|
||||||
script_sender: IpcSender<(PipelineId, FromScriptMsg)>,
|
script_sender: IpcSender<(PipelineId, ScriptToConstellationMessage)>,
|
||||||
|
|
||||||
/// A channel for the constellation to receive messages from script threads.
|
/// A channel for the constellation to receive messages from script threads.
|
||||||
/// This is the constellation's view of `script_sender`.
|
/// This is the constellation's view of `script_sender`.
|
||||||
script_receiver: Receiver<Result<(PipelineId, FromScriptMsg), IpcError>>,
|
script_receiver: Receiver<Result<(PipelineId, ScriptToConstellationMessage), IpcError>>,
|
||||||
|
|
||||||
/// A handle to register components for hang monitoring.
|
/// A handle to register components for hang monitoring.
|
||||||
/// None when in multiprocess mode.
|
/// None when in multiprocess mode.
|
||||||
|
@ -314,7 +314,7 @@ pub struct Constellation<STF, SWF> {
|
||||||
layout_factory: Arc<dyn LayoutFactory>,
|
layout_factory: Arc<dyn LayoutFactory>,
|
||||||
|
|
||||||
/// A channel for the constellation to receive messages from the compositor thread.
|
/// A channel for the constellation to receive messages from the compositor thread.
|
||||||
compositor_receiver: Receiver<FromCompositorMsg>,
|
compositor_receiver: Receiver<EmbedderToConstellationMessage>,
|
||||||
|
|
||||||
/// A channel through which messages can be sent to the embedder.
|
/// A channel through which messages can be sent to the embedder.
|
||||||
embedder_proxy: EmbedderProxy,
|
embedder_proxy: EmbedderProxy,
|
||||||
|
@ -607,7 +607,7 @@ where
|
||||||
hard_fail: bool,
|
hard_fail: bool,
|
||||||
canvas_create_sender: Sender<ConstellationCanvasMsg>,
|
canvas_create_sender: Sender<ConstellationCanvasMsg>,
|
||||||
canvas_ipc_sender: IpcSender<CanvasMsg>,
|
canvas_ipc_sender: IpcSender<CanvasMsg>,
|
||||||
) -> Sender<FromCompositorMsg> {
|
) -> Sender<EmbedderToConstellationMessage> {
|
||||||
let (compositor_sender, compositor_receiver) = unbounded();
|
let (compositor_sender, compositor_receiver) = unbounded();
|
||||||
|
|
||||||
// service worker manager to communicate with constellation
|
// service worker manager to communicate with constellation
|
||||||
|
@ -1121,9 +1121,9 @@ where
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum Request {
|
enum Request {
|
||||||
PipelineNamespace(PipelineNamespaceRequest),
|
PipelineNamespace(PipelineNamespaceRequest),
|
||||||
Script((PipelineId, FromScriptMsg)),
|
Script((PipelineId, ScriptToConstellationMessage)),
|
||||||
BackgroundHangMonitor(HangMonitorAlert),
|
BackgroundHangMonitor(HangMonitorAlert),
|
||||||
Compositor(FromCompositorMsg),
|
Compositor(EmbedderToConstellationMessage),
|
||||||
FromSWManager(SWManagerMsg),
|
FromSWManager(SWManagerMsg),
|
||||||
RemoveProcess(usize),
|
RemoveProcess(usize),
|
||||||
}
|
}
|
||||||
|
@ -1246,19 +1246,19 @@ where
|
||||||
feature = "tracing",
|
feature = "tracing",
|
||||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||||
)]
|
)]
|
||||||
fn handle_request_from_compositor(&mut self, message: FromCompositorMsg) {
|
fn handle_request_from_compositor(&mut self, message: EmbedderToConstellationMessage) {
|
||||||
trace_msg_from_compositor!(message, "{message:?}");
|
trace_msg_from_compositor!(message, "{message:?}");
|
||||||
match message {
|
match message {
|
||||||
FromCompositorMsg::Exit => {
|
EmbedderToConstellationMessage::Exit => {
|
||||||
self.handle_exit();
|
self.handle_exit();
|
||||||
},
|
},
|
||||||
FromCompositorMsg::GetFocusTopLevelBrowsingContext(resp_chan) => {
|
EmbedderToConstellationMessage::GetFocusTopLevelBrowsingContext(resp_chan) => {
|
||||||
let _ = resp_chan.send(self.webviews.focused_webview().map(|(id, _)| id));
|
let _ = resp_chan.send(self.webviews.focused_webview().map(|(id, _)| id));
|
||||||
},
|
},
|
||||||
// Perform a navigation previously requested by script, if approved by the embedder.
|
// Perform a navigation previously requested by script, if approved by the embedder.
|
||||||
// If there is already a pending page (self.pending_changes), it will not be overridden;
|
// If there is already a pending page (self.pending_changes), it will not be overridden;
|
||||||
// However, if the id is not encompassed by another change, it will be.
|
// However, if the id is not encompassed by another change, it will be.
|
||||||
FromCompositorMsg::AllowNavigationResponse(pipeline_id, allowed) => {
|
EmbedderToConstellationMessage::AllowNavigationResponse(pipeline_id, allowed) => {
|
||||||
let pending = self.pending_approval_navigations.remove(&pipeline_id);
|
let pending = self.pending_approval_navigations.remove(&pipeline_id);
|
||||||
|
|
||||||
let webview_id = match self.pipelines.get(&pipeline_id) {
|
let webview_id = match self.pipelines.get(&pipeline_id) {
|
||||||
|
@ -1305,14 +1305,14 @@ where
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
FromCompositorMsg::ClearCache => {
|
EmbedderToConstellationMessage::ClearCache => {
|
||||||
self.public_resource_threads.clear_cache();
|
self.public_resource_threads.clear_cache();
|
||||||
self.private_resource_threads.clear_cache();
|
self.private_resource_threads.clear_cache();
|
||||||
},
|
},
|
||||||
// Load a new page from a typed url
|
// Load a new page from a typed url
|
||||||
// If there is already a pending page (self.pending_changes), it will not be overridden;
|
// If there is already a pending page (self.pending_changes), it will not be overridden;
|
||||||
// However, if the id is not encompassed by another change, it will be.
|
// However, if the id is not encompassed by another change, it will be.
|
||||||
FromCompositorMsg::LoadUrl(webview_id, url) => {
|
EmbedderToConstellationMessage::LoadUrl(webview_id, url) => {
|
||||||
let load_data = LoadData::new(
|
let load_data = LoadData::new(
|
||||||
LoadOrigin::Constellation,
|
LoadOrigin::Constellation,
|
||||||
url,
|
url,
|
||||||
|
@ -1338,7 +1338,7 @@ where
|
||||||
NavigationHistoryBehavior::Push,
|
NavigationHistoryBehavior::Push,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
FromCompositorMsg::IsReadyToSaveImage(pipeline_states) => {
|
EmbedderToConstellationMessage::IsReadyToSaveImage(pipeline_states) => {
|
||||||
let is_ready = self.handle_is_ready_to_save_image(pipeline_states);
|
let is_ready = self.handle_is_ready_to_save_image(pipeline_states);
|
||||||
debug!("Ready to save image {:?}.", is_ready);
|
debug!("Ready to save image {:?}.", is_ready);
|
||||||
self.compositor_proxy
|
self.compositor_proxy
|
||||||
|
@ -1348,33 +1348,33 @@ where
|
||||||
},
|
},
|
||||||
// Create a new top level browsing context. Will use response_chan to return
|
// Create a new top level browsing context. Will use response_chan to return
|
||||||
// the browsing context id.
|
// the browsing context id.
|
||||||
FromCompositorMsg::NewWebView(url, webview_id, viewport_details) => {
|
EmbedderToConstellationMessage::NewWebView(url, webview_id, viewport_details) => {
|
||||||
self.handle_new_top_level_browsing_context(url, webview_id, viewport_details, None);
|
self.handle_new_top_level_browsing_context(url, webview_id, viewport_details, None);
|
||||||
},
|
},
|
||||||
// Close a top level browsing context.
|
// Close a top level browsing context.
|
||||||
FromCompositorMsg::CloseWebView(webview_id) => {
|
EmbedderToConstellationMessage::CloseWebView(webview_id) => {
|
||||||
self.handle_close_top_level_browsing_context(webview_id);
|
self.handle_close_top_level_browsing_context(webview_id);
|
||||||
},
|
},
|
||||||
// Panic a top level browsing context.
|
// Panic a top level browsing context.
|
||||||
FromCompositorMsg::SendError(webview_id, error) => {
|
EmbedderToConstellationMessage::SendError(webview_id, error) => {
|
||||||
debug!("constellation got SendError message");
|
debug!("constellation got SendError message");
|
||||||
if webview_id.is_none() {
|
if webview_id.is_none() {
|
||||||
warn!("constellation got a SendError message without top level id");
|
warn!("constellation got a SendError message without top level id");
|
||||||
}
|
}
|
||||||
self.handle_panic(webview_id, error, None);
|
self.handle_panic(webview_id, error, None);
|
||||||
},
|
},
|
||||||
FromCompositorMsg::FocusWebView(webview_id) => {
|
EmbedderToConstellationMessage::FocusWebView(webview_id) => {
|
||||||
self.handle_focus_web_view(webview_id);
|
self.handle_focus_web_view(webview_id);
|
||||||
},
|
},
|
||||||
FromCompositorMsg::BlurWebView => {
|
EmbedderToConstellationMessage::BlurWebView => {
|
||||||
self.webviews.unfocus();
|
self.webviews.unfocus();
|
||||||
self.embedder_proxy.send(EmbedderMsg::WebViewBlurred);
|
self.embedder_proxy.send(EmbedderMsg::WebViewBlurred);
|
||||||
},
|
},
|
||||||
// Handle a forward or back request
|
// Handle a forward or back request
|
||||||
FromCompositorMsg::TraverseHistory(webview_id, direction) => {
|
EmbedderToConstellationMessage::TraverseHistory(webview_id, direction) => {
|
||||||
self.handle_traverse_history_msg(webview_id, direction);
|
self.handle_traverse_history_msg(webview_id, direction);
|
||||||
},
|
},
|
||||||
FromCompositorMsg::ChangeViewportDetails(
|
EmbedderToConstellationMessage::ChangeViewportDetails(
|
||||||
webview_id,
|
webview_id,
|
||||||
new_viewport_details,
|
new_viewport_details,
|
||||||
size_type,
|
size_type,
|
||||||
|
@ -1385,28 +1385,28 @@ where
|
||||||
size_type,
|
size_type,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
FromCompositorMsg::ThemeChange(theme) => {
|
EmbedderToConstellationMessage::ThemeChange(theme) => {
|
||||||
self.handle_theme_change(theme);
|
self.handle_theme_change(theme);
|
||||||
},
|
},
|
||||||
FromCompositorMsg::TickAnimation(pipeline_id, tick_type) => {
|
EmbedderToConstellationMessage::TickAnimation(pipeline_id, tick_type) => {
|
||||||
self.handle_tick_animation(pipeline_id, tick_type)
|
self.handle_tick_animation(pipeline_id, tick_type)
|
||||||
},
|
},
|
||||||
FromCompositorMsg::WebDriverCommand(command) => {
|
EmbedderToConstellationMessage::WebDriverCommand(command) => {
|
||||||
self.handle_webdriver_msg(command);
|
self.handle_webdriver_msg(command);
|
||||||
},
|
},
|
||||||
FromCompositorMsg::Reload(webview_id) => {
|
EmbedderToConstellationMessage::Reload(webview_id) => {
|
||||||
self.handle_reload_msg(webview_id);
|
self.handle_reload_msg(webview_id);
|
||||||
},
|
},
|
||||||
FromCompositorMsg::LogEntry(webview_id, thread_name, entry) => {
|
EmbedderToConstellationMessage::LogEntry(webview_id, thread_name, entry) => {
|
||||||
self.handle_log_entry(webview_id, thread_name, entry);
|
self.handle_log_entry(webview_id, thread_name, entry);
|
||||||
},
|
},
|
||||||
FromCompositorMsg::ForwardInputEvent(webview_id, event, hit_test) => {
|
EmbedderToConstellationMessage::ForwardInputEvent(webview_id, event, hit_test) => {
|
||||||
self.forward_input_event(webview_id, event, hit_test);
|
self.forward_input_event(webview_id, event, hit_test);
|
||||||
},
|
},
|
||||||
FromCompositorMsg::SetCursor(webview_id, cursor) => {
|
EmbedderToConstellationMessage::SetCursor(webview_id, cursor) => {
|
||||||
self.handle_set_cursor_msg(webview_id, cursor)
|
self.handle_set_cursor_msg(webview_id, cursor)
|
||||||
},
|
},
|
||||||
FromCompositorMsg::ToggleProfiler(rate, max_duration) => {
|
EmbedderToConstellationMessage::ToggleProfiler(rate, max_duration) => {
|
||||||
for background_monitor_control_sender in &self.background_monitor_control_senders {
|
for background_monitor_control_sender in &self.background_monitor_control_senders {
|
||||||
if let Err(e) = background_monitor_control_sender.send(
|
if let Err(e) = background_monitor_control_sender.send(
|
||||||
BackgroundHangMonitorControlMsg::ToggleSampler(rate, max_duration),
|
BackgroundHangMonitorControlMsg::ToggleSampler(rate, max_duration),
|
||||||
|
@ -1415,19 +1415,19 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
FromCompositorMsg::ExitFullScreen(webview_id) => {
|
EmbedderToConstellationMessage::ExitFullScreen(webview_id) => {
|
||||||
self.handle_exit_fullscreen_msg(webview_id);
|
self.handle_exit_fullscreen_msg(webview_id);
|
||||||
},
|
},
|
||||||
FromCompositorMsg::MediaSessionAction(action) => {
|
EmbedderToConstellationMessage::MediaSessionAction(action) => {
|
||||||
self.handle_media_session_action_msg(action);
|
self.handle_media_session_action_msg(action);
|
||||||
},
|
},
|
||||||
FromCompositorMsg::SetWebViewThrottled(webview_id, throttled) => {
|
EmbedderToConstellationMessage::SetWebViewThrottled(webview_id, throttled) => {
|
||||||
self.set_webview_throttled(webview_id, throttled);
|
self.set_webview_throttled(webview_id, throttled);
|
||||||
},
|
},
|
||||||
FromCompositorMsg::SetScrollStates(pipeline_id, scroll_states) => {
|
EmbedderToConstellationMessage::SetScrollStates(pipeline_id, scroll_states) => {
|
||||||
self.handle_set_scroll_states(pipeline_id, scroll_states)
|
self.handle_set_scroll_states(pipeline_id, scroll_states)
|
||||||
},
|
},
|
||||||
FromCompositorMsg::PaintMetric(pipeline_id, paint_metric_event) => {
|
EmbedderToConstellationMessage::PaintMetric(pipeline_id, paint_metric_event) => {
|
||||||
self.handle_paint_metric(pipeline_id, paint_metric_event);
|
self.handle_paint_metric(pipeline_id, paint_metric_event);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1437,7 +1437,7 @@ where
|
||||||
feature = "tracing",
|
feature = "tracing",
|
||||||
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
|
||||||
)]
|
)]
|
||||||
fn handle_request_from_script(&mut self, message: (PipelineId, FromScriptMsg)) {
|
fn handle_request_from_script(&mut self, message: (PipelineId, ScriptToConstellationMessage)) {
|
||||||
let (source_pipeline_id, content) = message;
|
let (source_pipeline_id, content) = message;
|
||||||
trace_script_msg!(content, "{source_pipeline_id}: {content:?}");
|
trace_script_msg!(content, "{source_pipeline_id}: {content:?}");
|
||||||
|
|
||||||
|
@ -1451,35 +1451,43 @@ where
|
||||||
};
|
};
|
||||||
|
|
||||||
match content {
|
match content {
|
||||||
FromScriptMsg::CompleteMessagePortTransfer(router_id, ports) => {
|
ScriptToConstellationMessage::CompleteMessagePortTransfer(router_id, ports) => {
|
||||||
self.handle_complete_message_port_transfer(router_id, ports);
|
self.handle_complete_message_port_transfer(router_id, ports);
|
||||||
},
|
},
|
||||||
FromScriptMsg::MessagePortTransferResult(router_id, succeeded, failed) => {
|
ScriptToConstellationMessage::MessagePortTransferResult(
|
||||||
|
router_id,
|
||||||
|
succeeded,
|
||||||
|
failed,
|
||||||
|
) => {
|
||||||
self.handle_message_port_transfer_completed(router_id, succeeded);
|
self.handle_message_port_transfer_completed(router_id, succeeded);
|
||||||
self.handle_message_port_transfer_failed(failed);
|
self.handle_message_port_transfer_failed(failed);
|
||||||
},
|
},
|
||||||
FromScriptMsg::RerouteMessagePort(port_id, task) => {
|
ScriptToConstellationMessage::RerouteMessagePort(port_id, task) => {
|
||||||
self.handle_reroute_messageport(port_id, task);
|
self.handle_reroute_messageport(port_id, task);
|
||||||
},
|
},
|
||||||
FromScriptMsg::MessagePortShipped(port_id) => {
|
ScriptToConstellationMessage::MessagePortShipped(port_id) => {
|
||||||
self.handle_messageport_shipped(port_id);
|
self.handle_messageport_shipped(port_id);
|
||||||
},
|
},
|
||||||
FromScriptMsg::NewMessagePortRouter(router_id, ipc_sender) => {
|
ScriptToConstellationMessage::NewMessagePortRouter(router_id, ipc_sender) => {
|
||||||
self.handle_new_messageport_router(router_id, ipc_sender);
|
self.handle_new_messageport_router(router_id, ipc_sender);
|
||||||
},
|
},
|
||||||
FromScriptMsg::RemoveMessagePortRouter(router_id) => {
|
ScriptToConstellationMessage::RemoveMessagePortRouter(router_id) => {
|
||||||
self.handle_remove_messageport_router(router_id);
|
self.handle_remove_messageport_router(router_id);
|
||||||
},
|
},
|
||||||
FromScriptMsg::NewMessagePort(router_id, port_id) => {
|
ScriptToConstellationMessage::NewMessagePort(router_id, port_id) => {
|
||||||
self.handle_new_messageport(router_id, port_id);
|
self.handle_new_messageport(router_id, port_id);
|
||||||
},
|
},
|
||||||
FromScriptMsg::RemoveMessagePort(port_id) => {
|
ScriptToConstellationMessage::RemoveMessagePort(port_id) => {
|
||||||
self.handle_remove_messageport(port_id);
|
self.handle_remove_messageport(port_id);
|
||||||
},
|
},
|
||||||
FromScriptMsg::EntanglePorts(port1, port2) => {
|
ScriptToConstellationMessage::EntanglePorts(port1, port2) => {
|
||||||
self.handle_entangle_messageports(port1, port2);
|
self.handle_entangle_messageports(port1, port2);
|
||||||
},
|
},
|
||||||
FromScriptMsg::NewBroadcastChannelRouter(router_id, response_sender, origin) => {
|
ScriptToConstellationMessage::NewBroadcastChannelRouter(
|
||||||
|
router_id,
|
||||||
|
response_sender,
|
||||||
|
origin,
|
||||||
|
) => {
|
||||||
self.handle_new_broadcast_channel_router(
|
self.handle_new_broadcast_channel_router(
|
||||||
source_pipeline_id,
|
source_pipeline_id,
|
||||||
router_id,
|
router_id,
|
||||||
|
@ -1487,7 +1495,11 @@ where
|
||||||
origin,
|
origin,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
FromScriptMsg::NewBroadcastChannelNameInRouter(router_id, channel_name, origin) => {
|
ScriptToConstellationMessage::NewBroadcastChannelNameInRouter(
|
||||||
|
router_id,
|
||||||
|
channel_name,
|
||||||
|
origin,
|
||||||
|
) => {
|
||||||
self.handle_new_broadcast_channel_name_in_router(
|
self.handle_new_broadcast_channel_name_in_router(
|
||||||
source_pipeline_id,
|
source_pipeline_id,
|
||||||
router_id,
|
router_id,
|
||||||
|
@ -1495,7 +1507,11 @@ where
|
||||||
origin,
|
origin,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
FromScriptMsg::RemoveBroadcastChannelNameInRouter(router_id, channel_name, origin) => {
|
ScriptToConstellationMessage::RemoveBroadcastChannelNameInRouter(
|
||||||
|
router_id,
|
||||||
|
channel_name,
|
||||||
|
origin,
|
||||||
|
) => {
|
||||||
self.handle_remove_broadcast_channel_name_in_router(
|
self.handle_remove_broadcast_channel_name_in_router(
|
||||||
source_pipeline_id,
|
source_pipeline_id,
|
||||||
router_id,
|
router_id,
|
||||||
|
@ -1503,38 +1519,38 @@ where
|
||||||
origin,
|
origin,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
FromScriptMsg::RemoveBroadcastChannelRouter(router_id, origin) => {
|
ScriptToConstellationMessage::RemoveBroadcastChannelRouter(router_id, origin) => {
|
||||||
self.handle_remove_broadcast_channel_router(source_pipeline_id, router_id, origin);
|
self.handle_remove_broadcast_channel_router(source_pipeline_id, router_id, origin);
|
||||||
},
|
},
|
||||||
FromScriptMsg::ScheduleBroadcast(router_id, message) => {
|
ScriptToConstellationMessage::ScheduleBroadcast(router_id, message) => {
|
||||||
self.handle_schedule_broadcast(source_pipeline_id, router_id, message);
|
self.handle_schedule_broadcast(source_pipeline_id, router_id, message);
|
||||||
},
|
},
|
||||||
FromScriptMsg::ForwardToEmbedder(embedder_msg) => {
|
ScriptToConstellationMessage::ForwardToEmbedder(embedder_msg) => {
|
||||||
self.embedder_proxy.send(embedder_msg);
|
self.embedder_proxy.send(embedder_msg);
|
||||||
},
|
},
|
||||||
FromScriptMsg::PipelineExited => {
|
ScriptToConstellationMessage::PipelineExited => {
|
||||||
self.handle_pipeline_exited(source_pipeline_id);
|
self.handle_pipeline_exited(source_pipeline_id);
|
||||||
},
|
},
|
||||||
FromScriptMsg::DiscardDocument => {
|
ScriptToConstellationMessage::DiscardDocument => {
|
||||||
self.handle_discard_document(webview_id, source_pipeline_id);
|
self.handle_discard_document(webview_id, source_pipeline_id);
|
||||||
},
|
},
|
||||||
FromScriptMsg::DiscardTopLevelBrowsingContext => {
|
ScriptToConstellationMessage::DiscardTopLevelBrowsingContext => {
|
||||||
self.handle_close_top_level_browsing_context(webview_id);
|
self.handle_close_top_level_browsing_context(webview_id);
|
||||||
},
|
},
|
||||||
FromScriptMsg::ScriptLoadedURLInIFrame(load_info) => {
|
ScriptToConstellationMessage::ScriptLoadedURLInIFrame(load_info) => {
|
||||||
self.handle_script_loaded_url_in_iframe_msg(load_info);
|
self.handle_script_loaded_url_in_iframe_msg(load_info);
|
||||||
},
|
},
|
||||||
FromScriptMsg::ScriptNewIFrame(load_info) => {
|
ScriptToConstellationMessage::ScriptNewIFrame(load_info) => {
|
||||||
self.handle_script_new_iframe(load_info);
|
self.handle_script_new_iframe(load_info);
|
||||||
},
|
},
|
||||||
FromScriptMsg::CreateAuxiliaryWebView(load_info) => {
|
ScriptToConstellationMessage::CreateAuxiliaryWebView(load_info) => {
|
||||||
self.handle_script_new_auxiliary(load_info);
|
self.handle_script_new_auxiliary(load_info);
|
||||||
},
|
},
|
||||||
FromScriptMsg::ChangeRunningAnimationsState(animation_state) => {
|
ScriptToConstellationMessage::ChangeRunningAnimationsState(animation_state) => {
|
||||||
self.handle_change_running_animations_state(source_pipeline_id, animation_state)
|
self.handle_change_running_animations_state(source_pipeline_id, animation_state)
|
||||||
},
|
},
|
||||||
// Ask the embedder for permission to load a new page.
|
// Ask the embedder for permission to load a new page.
|
||||||
FromScriptMsg::LoadUrl(load_data, history_handling) => {
|
ScriptToConstellationMessage::LoadUrl(load_data, history_handling) => {
|
||||||
self.schedule_navigation(
|
self.schedule_navigation(
|
||||||
webview_id,
|
webview_id,
|
||||||
source_pipeline_id,
|
source_pipeline_id,
|
||||||
|
@ -1542,38 +1558,38 @@ where
|
||||||
history_handling,
|
history_handling,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
FromScriptMsg::AbortLoadUrl => {
|
ScriptToConstellationMessage::AbortLoadUrl => {
|
||||||
self.handle_abort_load_url_msg(source_pipeline_id);
|
self.handle_abort_load_url_msg(source_pipeline_id);
|
||||||
},
|
},
|
||||||
// A page loaded has completed all parsing, script, and reflow messages have been sent.
|
// A page loaded has completed all parsing, script, and reflow messages have been sent.
|
||||||
FromScriptMsg::LoadComplete => {
|
ScriptToConstellationMessage::LoadComplete => {
|
||||||
self.handle_load_complete_msg(webview_id, source_pipeline_id)
|
self.handle_load_complete_msg(webview_id, source_pipeline_id)
|
||||||
},
|
},
|
||||||
// Handle navigating to a fragment
|
// Handle navigating to a fragment
|
||||||
FromScriptMsg::NavigatedToFragment(new_url, replacement_enabled) => {
|
ScriptToConstellationMessage::NavigatedToFragment(new_url, replacement_enabled) => {
|
||||||
self.handle_navigated_to_fragment(source_pipeline_id, new_url, replacement_enabled);
|
self.handle_navigated_to_fragment(source_pipeline_id, new_url, replacement_enabled);
|
||||||
},
|
},
|
||||||
// Handle a forward or back request
|
// Handle a forward or back request
|
||||||
FromScriptMsg::TraverseHistory(direction) => {
|
ScriptToConstellationMessage::TraverseHistory(direction) => {
|
||||||
self.handle_traverse_history_msg(webview_id, direction);
|
self.handle_traverse_history_msg(webview_id, direction);
|
||||||
},
|
},
|
||||||
// Handle a push history state request.
|
// Handle a push history state request.
|
||||||
FromScriptMsg::PushHistoryState(history_state_id, url) => {
|
ScriptToConstellationMessage::PushHistoryState(history_state_id, url) => {
|
||||||
self.handle_push_history_state_msg(source_pipeline_id, history_state_id, url);
|
self.handle_push_history_state_msg(source_pipeline_id, history_state_id, url);
|
||||||
},
|
},
|
||||||
FromScriptMsg::ReplaceHistoryState(history_state_id, url) => {
|
ScriptToConstellationMessage::ReplaceHistoryState(history_state_id, url) => {
|
||||||
self.handle_replace_history_state_msg(source_pipeline_id, history_state_id, url);
|
self.handle_replace_history_state_msg(source_pipeline_id, history_state_id, url);
|
||||||
},
|
},
|
||||||
// Handle a joint session history length request.
|
// Handle a joint session history length request.
|
||||||
FromScriptMsg::JointSessionHistoryLength(response_sender) => {
|
ScriptToConstellationMessage::JointSessionHistoryLength(response_sender) => {
|
||||||
self.handle_joint_session_history_length(webview_id, response_sender);
|
self.handle_joint_session_history_length(webview_id, response_sender);
|
||||||
},
|
},
|
||||||
// Notification that the new document is ready to become active
|
// Notification that the new document is ready to become active
|
||||||
FromScriptMsg::ActivateDocument => {
|
ScriptToConstellationMessage::ActivateDocument => {
|
||||||
self.handle_activate_document_msg(source_pipeline_id);
|
self.handle_activate_document_msg(source_pipeline_id);
|
||||||
},
|
},
|
||||||
// Update pipeline url after redirections
|
// Update pipeline url after redirections
|
||||||
FromScriptMsg::SetFinalUrl(final_url) => {
|
ScriptToConstellationMessage::SetFinalUrl(final_url) => {
|
||||||
// The script may have finished loading after we already started shutting down.
|
// The script may have finished loading after we already started shutting down.
|
||||||
if let Some(ref mut pipeline) = self.pipelines.get_mut(&source_pipeline_id) {
|
if let Some(ref mut pipeline) = self.pipelines.get_mut(&source_pipeline_id) {
|
||||||
pipeline.url = final_url;
|
pipeline.url = final_url;
|
||||||
|
@ -1581,7 +1597,7 @@ where
|
||||||
warn!("constellation got set final url message for dead pipeline");
|
warn!("constellation got set final url message for dead pipeline");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
FromScriptMsg::PostMessage {
|
ScriptToConstellationMessage::PostMessage {
|
||||||
target: browsing_context_id,
|
target: browsing_context_id,
|
||||||
source: source_pipeline_id,
|
source: source_pipeline_id,
|
||||||
target_origin: origin,
|
target_origin: origin,
|
||||||
|
@ -1596,38 +1612,38 @@ where
|
||||||
data,
|
data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
FromScriptMsg::Focus => {
|
ScriptToConstellationMessage::Focus => {
|
||||||
self.handle_focus_msg(source_pipeline_id);
|
self.handle_focus_msg(source_pipeline_id);
|
||||||
},
|
},
|
||||||
FromScriptMsg::SetThrottledComplete(throttled) => {
|
ScriptToConstellationMessage::SetThrottledComplete(throttled) => {
|
||||||
self.handle_set_throttled_complete(source_pipeline_id, throttled);
|
self.handle_set_throttled_complete(source_pipeline_id, throttled);
|
||||||
},
|
},
|
||||||
FromScriptMsg::RemoveIFrame(browsing_context_id, response_sender) => {
|
ScriptToConstellationMessage::RemoveIFrame(browsing_context_id, response_sender) => {
|
||||||
let removed_pipeline_ids = self.handle_remove_iframe_msg(browsing_context_id);
|
let removed_pipeline_ids = self.handle_remove_iframe_msg(browsing_context_id);
|
||||||
if let Err(e) = response_sender.send(removed_pipeline_ids) {
|
if let Err(e) = response_sender.send(removed_pipeline_ids) {
|
||||||
warn!("Error replying to remove iframe ({})", e);
|
warn!("Error replying to remove iframe ({})", e);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
FromScriptMsg::CreateCanvasPaintThread(size, response_sender) => {
|
ScriptToConstellationMessage::CreateCanvasPaintThread(size, response_sender) => {
|
||||||
self.handle_create_canvas_paint_thread_msg(size, response_sender)
|
self.handle_create_canvas_paint_thread_msg(size, response_sender)
|
||||||
},
|
},
|
||||||
FromScriptMsg::SetDocumentState(state) => {
|
ScriptToConstellationMessage::SetDocumentState(state) => {
|
||||||
self.document_states.insert(source_pipeline_id, state);
|
self.document_states.insert(source_pipeline_id, state);
|
||||||
},
|
},
|
||||||
FromScriptMsg::SetLayoutEpoch(epoch, response_sender) => {
|
ScriptToConstellationMessage::SetLayoutEpoch(epoch, response_sender) => {
|
||||||
if let Some(pipeline) = self.pipelines.get_mut(&source_pipeline_id) {
|
if let Some(pipeline) = self.pipelines.get_mut(&source_pipeline_id) {
|
||||||
pipeline.layout_epoch = epoch;
|
pipeline.layout_epoch = epoch;
|
||||||
}
|
}
|
||||||
|
|
||||||
response_sender.send(true).unwrap_or_default();
|
response_sender.send(true).unwrap_or_default();
|
||||||
},
|
},
|
||||||
FromScriptMsg::LogEntry(thread_name, entry) => {
|
ScriptToConstellationMessage::LogEntry(thread_name, entry) => {
|
||||||
self.handle_log_entry(Some(webview_id), thread_name, entry);
|
self.handle_log_entry(Some(webview_id), thread_name, entry);
|
||||||
},
|
},
|
||||||
FromScriptMsg::TouchEventProcessed(result) => self
|
ScriptToConstellationMessage::TouchEventProcessed(result) => self
|
||||||
.compositor_proxy
|
.compositor_proxy
|
||||||
.send(CompositorMsg::TouchEventProcessed(webview_id, result)),
|
.send(CompositorMsg::TouchEventProcessed(webview_id, result)),
|
||||||
FromScriptMsg::GetBrowsingContextInfo(pipeline_id, response_sender) => {
|
ScriptToConstellationMessage::GetBrowsingContextInfo(pipeline_id, response_sender) => {
|
||||||
let result = self
|
let result = self
|
||||||
.pipelines
|
.pipelines
|
||||||
.get(&pipeline_id)
|
.get(&pipeline_id)
|
||||||
|
@ -1640,7 +1656,10 @@ where
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
FromScriptMsg::GetTopForBrowsingContext(browsing_context_id, response_sender) => {
|
ScriptToConstellationMessage::GetTopForBrowsingContext(
|
||||||
|
browsing_context_id,
|
||||||
|
response_sender,
|
||||||
|
) => {
|
||||||
let result = self
|
let result = self
|
||||||
.browsing_contexts
|
.browsing_contexts
|
||||||
.get(&browsing_context_id)
|
.get(&browsing_context_id)
|
||||||
|
@ -1652,7 +1671,7 @@ where
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
FromScriptMsg::GetChildBrowsingContextId(
|
ScriptToConstellationMessage::GetChildBrowsingContextId(
|
||||||
browsing_context_id,
|
browsing_context_id,
|
||||||
index,
|
index,
|
||||||
response_sender,
|
response_sender,
|
||||||
|
@ -1670,17 +1689,23 @@ where
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
FromScriptMsg::ScheduleJob(job) => {
|
ScriptToConstellationMessage::ScheduleJob(job) => {
|
||||||
self.handle_schedule_serviceworker_job(source_pipeline_id, job);
|
self.handle_schedule_serviceworker_job(source_pipeline_id, job);
|
||||||
},
|
},
|
||||||
FromScriptMsg::ForwardDOMMessage(msg_vec, scope_url) => {
|
ScriptToConstellationMessage::ForwardDOMMessage(msg_vec, scope_url) => {
|
||||||
if let Some(mgr) = self.sw_managers.get(&scope_url.origin()) {
|
if let Some(mgr) = self.sw_managers.get(&scope_url.origin()) {
|
||||||
let _ = mgr.send(ServiceWorkerMsg::ForwardDOMMessage(msg_vec, scope_url));
|
let _ = mgr.send(ServiceWorkerMsg::ForwardDOMMessage(msg_vec, scope_url));
|
||||||
} else {
|
} else {
|
||||||
warn!("Unable to forward DOMMessage for postMessage call");
|
warn!("Unable to forward DOMMessage for postMessage call");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
FromScriptMsg::BroadcastStorageEvent(storage, url, key, old_value, new_value) => {
|
ScriptToConstellationMessage::BroadcastStorageEvent(
|
||||||
|
storage,
|
||||||
|
url,
|
||||||
|
key,
|
||||||
|
old_value,
|
||||||
|
new_value,
|
||||||
|
) => {
|
||||||
self.handle_broadcast_storage_event(
|
self.handle_broadcast_storage_event(
|
||||||
source_pipeline_id,
|
source_pipeline_id,
|
||||||
storage,
|
storage,
|
||||||
|
@ -1690,7 +1715,7 @@ where
|
||||||
new_value,
|
new_value,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
FromScriptMsg::MediaSessionEvent(pipeline_id, event) => {
|
ScriptToConstellationMessage::MediaSessionEvent(pipeline_id, event) => {
|
||||||
// Unlikely at this point, but we may receive events coming from
|
// Unlikely at this point, but we may receive events coming from
|
||||||
// different media sessions, so we set the active media session based
|
// different media sessions, so we set the active media session based
|
||||||
// on Playing events.
|
// on Playing events.
|
||||||
|
@ -1712,25 +1737,28 @@ where
|
||||||
.send(EmbedderMsg::MediaSessionEvent(webview_id, event));
|
.send(EmbedderMsg::MediaSessionEvent(webview_id, event));
|
||||||
},
|
},
|
||||||
#[cfg(feature = "webgpu")]
|
#[cfg(feature = "webgpu")]
|
||||||
FromScriptMsg::RequestAdapter(response_sender, options, ids) => self
|
ScriptToConstellationMessage::RequestAdapter(response_sender, options, ids) => self
|
||||||
.handle_wgpu_request(
|
.handle_wgpu_request(
|
||||||
source_pipeline_id,
|
source_pipeline_id,
|
||||||
BrowsingContextId::from(webview_id),
|
BrowsingContextId::from(webview_id),
|
||||||
FromScriptMsg::RequestAdapter(response_sender, options, ids),
|
ScriptToConstellationMessage::RequestAdapter(response_sender, options, ids),
|
||||||
),
|
),
|
||||||
#[cfg(feature = "webgpu")]
|
#[cfg(feature = "webgpu")]
|
||||||
FromScriptMsg::GetWebGPUChan(response_sender) => self.handle_wgpu_request(
|
ScriptToConstellationMessage::GetWebGPUChan(response_sender) => self
|
||||||
source_pipeline_id,
|
.handle_wgpu_request(
|
||||||
BrowsingContextId::from(webview_id),
|
source_pipeline_id,
|
||||||
FromScriptMsg::GetWebGPUChan(response_sender),
|
BrowsingContextId::from(webview_id),
|
||||||
),
|
ScriptToConstellationMessage::GetWebGPUChan(response_sender),
|
||||||
FromScriptMsg::TitleChanged(pipeline, title) => {
|
),
|
||||||
|
ScriptToConstellationMessage::TitleChanged(pipeline, title) => {
|
||||||
if let Some(pipeline) = self.pipelines.get_mut(&pipeline) {
|
if let Some(pipeline) = self.pipelines.get_mut(&pipeline) {
|
||||||
pipeline.title = title;
|
pipeline.title = title;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
FromScriptMsg::IFrameSizes(iframe_sizes) => self.handle_iframe_size_msg(iframe_sizes),
|
ScriptToConstellationMessage::IFrameSizes(iframe_sizes) => {
|
||||||
FromScriptMsg::ReportMemory(sender) => {
|
self.handle_iframe_size_msg(iframe_sizes)
|
||||||
|
},
|
||||||
|
ScriptToConstellationMessage::ReportMemory(sender) => {
|
||||||
// get memory report and send it back.
|
// get memory report and send it back.
|
||||||
self.mem_profiler_chan
|
self.mem_profiler_chan
|
||||||
.send(mem::ProfilerMsg::Report(sender));
|
.send(mem::ProfilerMsg::Report(sender));
|
||||||
|
@ -1928,7 +1956,7 @@ where
|
||||||
&mut self,
|
&mut self,
|
||||||
source_pipeline_id: PipelineId,
|
source_pipeline_id: PipelineId,
|
||||||
browsing_context_id: BrowsingContextId,
|
browsing_context_id: BrowsingContextId,
|
||||||
request: FromScriptMsg,
|
request: ScriptToConstellationMessage,
|
||||||
) {
|
) {
|
||||||
use webgpu::start_webgpu_thread;
|
use webgpu::start_webgpu_thread;
|
||||||
|
|
||||||
|
@ -1972,7 +2000,7 @@ where
|
||||||
Entry::Occupied(o) => Some(o.get().clone()),
|
Entry::Occupied(o) => Some(o.get().clone()),
|
||||||
};
|
};
|
||||||
match request {
|
match request {
|
||||||
FromScriptMsg::RequestAdapter(response_sender, options, adapter_id) => {
|
ScriptToConstellationMessage::RequestAdapter(response_sender, options, adapter_id) => {
|
||||||
match webgpu_chan {
|
match webgpu_chan {
|
||||||
None => {
|
None => {
|
||||||
if let Err(e) = response_sender.send(None) {
|
if let Err(e) = response_sender.send(None) {
|
||||||
|
@ -1991,7 +2019,7 @@ where
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
FromScriptMsg::GetWebGPUChan(response_sender) => {
|
ScriptToConstellationMessage::GetWebGPUChan(response_sender) => {
|
||||||
if response_sender.send(webgpu_chan).is_err() {
|
if response_sender.send(webgpu_chan).is_err() {
|
||||||
warn!(
|
warn!(
|
||||||
"{}: Failed to send WebGPU channel to pipeline",
|
"{}: Failed to send WebGPU channel to pipeline",
|
||||||
|
|
|
@ -19,6 +19,6 @@ mod session_history;
|
||||||
mod webview_manager;
|
mod webview_manager;
|
||||||
|
|
||||||
pub use crate::constellation::{Constellation, InitialConstellationState};
|
pub use crate::constellation::{Constellation, InitialConstellationState};
|
||||||
pub use crate::logging::{FromCompositorLogger, FromScriptLogger};
|
pub use crate::logging::{FromEmbedderLogger, FromScriptLogger};
|
||||||
pub use crate::pipeline::UnprivilegedPipelineContent;
|
pub use crate::pipeline::UnprivilegedPipelineContent;
|
||||||
pub use crate::sandboxing::{UnprivilegedContent, content_process_sandbox_profile};
|
pub use crate::sandboxing::{UnprivilegedContent, content_process_sandbox_profile};
|
||||||
|
|
|
@ -12,11 +12,11 @@ use std::thread;
|
||||||
|
|
||||||
use backtrace::Backtrace;
|
use backtrace::Backtrace;
|
||||||
use base::id::WebViewId;
|
use base::id::WebViewId;
|
||||||
use constellation_traits::{ConstellationMsg as FromCompositorMsg, LogEntry};
|
use constellation_traits::{EmbedderToConstellationMessage, LogEntry};
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use log::{Level, LevelFilter, Log, Metadata, Record};
|
use log::{Level, LevelFilter, Log, Metadata, Record};
|
||||||
use parking_lot::ReentrantMutex;
|
use parking_lot::ReentrantMutex;
|
||||||
use script_traits::{ScriptMsg as FromScriptMsg, ScriptToConstellationChan};
|
use script_traits::{ScriptToConstellationChan, ScriptToConstellationMessage};
|
||||||
|
|
||||||
/// A logger directed at the constellation from content processes
|
/// A logger directed at the constellation from content processes
|
||||||
/// #[derive(Clone)]
|
/// #[derive(Clone)]
|
||||||
|
@ -50,7 +50,7 @@ impl Log for FromScriptLogger {
|
||||||
fn log(&self, record: &Record) {
|
fn log(&self, record: &Record) {
|
||||||
if let Some(entry) = log_entry(record) {
|
if let Some(entry) = log_entry(record) {
|
||||||
let thread_name = thread::current().name().map(ToOwned::to_owned);
|
let thread_name = thread::current().name().map(ToOwned::to_owned);
|
||||||
let msg = FromScriptMsg::LogEntry(thread_name, entry);
|
let msg = ScriptToConstellationMessage::LogEntry(thread_name, entry);
|
||||||
let chan = self.script_to_constellation_chan.lock();
|
let chan = self.script_to_constellation_chan.lock();
|
||||||
let _ = chan.send(msg);
|
let _ = chan.send(msg);
|
||||||
}
|
}
|
||||||
|
@ -61,15 +61,15 @@ impl Log for FromScriptLogger {
|
||||||
|
|
||||||
/// A logger directed at the constellation from the compositor
|
/// A logger directed at the constellation from the compositor
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct FromCompositorLogger {
|
pub struct FromEmbedderLogger {
|
||||||
/// A channel to the constellation
|
/// A channel to the constellation
|
||||||
pub constellation_chan: Arc<ReentrantMutex<Sender<FromCompositorMsg>>>,
|
pub constellation_chan: Arc<ReentrantMutex<Sender<EmbedderToConstellationMessage>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromCompositorLogger {
|
impl FromEmbedderLogger {
|
||||||
/// Create a new constellation logger.
|
/// Create a new constellation logger.
|
||||||
pub fn new(constellation_chan: Sender<FromCompositorMsg>) -> FromCompositorLogger {
|
pub fn new(constellation_chan: Sender<EmbedderToConstellationMessage>) -> FromEmbedderLogger {
|
||||||
FromCompositorLogger {
|
FromEmbedderLogger {
|
||||||
constellation_chan: Arc::new(ReentrantMutex::new(constellation_chan)),
|
constellation_chan: Arc::new(ReentrantMutex::new(constellation_chan)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ impl FromCompositorLogger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Log for FromCompositorLogger {
|
impl Log for FromEmbedderLogger {
|
||||||
fn enabled(&self, metadata: &Metadata) -> bool {
|
fn enabled(&self, metadata: &Metadata) -> bool {
|
||||||
metadata.level() <= Level::Warn
|
metadata.level() <= Level::Warn
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ impl Log for FromCompositorLogger {
|
||||||
if let Some(entry) = log_entry(record) {
|
if let Some(entry) = log_entry(record) {
|
||||||
let top_level_id = WebViewId::installed();
|
let top_level_id = WebViewId::installed();
|
||||||
let thread_name = thread::current().name().map(ToOwned::to_owned);
|
let thread_name = thread::current().name().map(ToOwned::to_owned);
|
||||||
let msg = FromCompositorMsg::LogEntry(top_level_id, thread_name, entry);
|
let msg = EmbedderToConstellationMessage::LogEntry(top_level_id, thread_name, entry);
|
||||||
let chan = self.constellation_chan.lock();
|
let chan = self.constellation_chan.lock();
|
||||||
let _ = chan.send(msg);
|
let _ = chan.send(msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ mod from_compositor {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LogTarget for constellation_traits::ConstellationMsg {
|
impl LogTarget for constellation_traits::EmbedderToConstellationMessage {
|
||||||
fn log_target(&self) -> &'static str {
|
fn log_target(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
Self::Exit => target!("Exit"),
|
Self::Exit => target!("Exit"),
|
||||||
|
@ -113,7 +113,7 @@ mod from_script {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LogTarget for script_traits::ScriptMsg {
|
impl LogTarget for script_traits::ScriptToConstellationMessage {
|
||||||
fn log_target(&self) -> &'static str {
|
fn log_target(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
Self::CompleteMessagePortTransfer(..) => target!("CompleteMessagePortTransfer"),
|
Self::CompleteMessagePortTransfer(..) => target!("CompleteMessagePortTransfer"),
|
||||||
|
|
|
@ -11,7 +11,7 @@ use constellation_traits::UntrustedNodeAddress;
|
||||||
use cssparser::ToCss;
|
use cssparser::ToCss;
|
||||||
use fxhash::{FxHashMap, FxHashSet};
|
use fxhash::{FxHashMap, FxHashSet};
|
||||||
use libc::c_void;
|
use libc::c_void;
|
||||||
use script_traits::{AnimationState as AnimationsPresentState, ScriptMsg};
|
use script_traits::{AnimationState as AnimationsPresentState, ScriptToConstellationMessage};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use style::animation::{
|
use style::animation::{
|
||||||
Animation, AnimationSetKey, AnimationState, DocumentAnimationSet, ElementAnimationSet,
|
Animation, AnimationSetKey, AnimationState, DocumentAnimationSet, ElementAnimationSet,
|
||||||
|
@ -186,7 +186,9 @@ impl Animations {
|
||||||
true => AnimationsPresentState::AnimationsPresent,
|
true => AnimationsPresentState::AnimationsPresent,
|
||||||
false => AnimationsPresentState::NoAnimationsPresent,
|
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 {
|
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 net_traits::request::CorsSettings;
|
||||||
use pixels::PixelFormat;
|
use pixels::PixelFormat;
|
||||||
use profile_traits::ipc as profiled_ipc;
|
use profile_traits::ipc as profiled_ipc;
|
||||||
use script_traits::ScriptMsg;
|
use script_traits::ScriptToConstellationMessage;
|
||||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||||
use style::color::{AbsoluteColor, ColorFlags, ColorSpace};
|
use style::color::{AbsoluteColor, ColorFlags, ColorSpace};
|
||||||
use style::context::QuirksMode;
|
use style::context::QuirksMode;
|
||||||
|
@ -177,7 +177,9 @@ impl CanvasState {
|
||||||
let script_to_constellation_chan = global.script_to_constellation_chan();
|
let script_to_constellation_chan = global.script_to_constellation_chan();
|
||||||
debug!("Asking constellation to create new canvas thread.");
|
debug!("Asking constellation to create new canvas thread.");
|
||||||
script_to_constellation_chan
|
script_to_constellation_chan
|
||||||
.send(ScriptMsg::CreateCanvasPaintThread(size, sender))
|
.send(ScriptToConstellationMessage::CreateCanvasPaintThread(
|
||||||
|
size, sender,
|
||||||
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let (ipc_renderer, canvas_id, image_key) = receiver.recv().unwrap();
|
let (ipc_renderer, canvas_id, image_key) = receiver.recv().unwrap();
|
||||||
debug!("Done.");
|
debug!("Done.");
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
use base::id::WebViewId;
|
use base::id::WebViewId;
|
||||||
use embedder_traits::EmbedderMsg;
|
use embedder_traits::EmbedderMsg;
|
||||||
use ipc_channel::ipc::channel;
|
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
|
/// A trait which abstracts access to the embedder's clipboard in order to allow unit
|
||||||
/// testing clipboard-dependent parts of `script`.
|
/// testing clipboard-dependent parts of `script`.
|
||||||
|
@ -25,19 +25,17 @@ impl ClipboardProvider for EmbedderClipboardProvider {
|
||||||
fn get_text(&mut self) -> Result<String, String> {
|
fn get_text(&mut self) -> Result<String, String> {
|
||||||
let (tx, rx) = channel().unwrap();
|
let (tx, rx) = channel().unwrap();
|
||||||
self.constellation_sender
|
self.constellation_sender
|
||||||
.send(ScriptMsg::ForwardToEmbedder(EmbedderMsg::GetClipboardText(
|
.send(ScriptToConstellationMessage::ForwardToEmbedder(
|
||||||
self.webview_id,
|
EmbedderMsg::GetClipboardText(self.webview_id, tx),
|
||||||
tx,
|
))
|
||||||
)))
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
rx.recv().unwrap()
|
rx.recv().unwrap()
|
||||||
}
|
}
|
||||||
fn set_text(&mut self, s: String) {
|
fn set_text(&mut self, s: String) {
|
||||||
self.constellation_sender
|
self.constellation_sender
|
||||||
.send(ScriptMsg::ForwardToEmbedder(EmbedderMsg::SetClipboardText(
|
.send(ScriptToConstellationMessage::ForwardToEmbedder(
|
||||||
self.webview_id,
|
EmbedderMsg::SetClipboardText(self.webview_id, s),
|
||||||
s,
|
))
|
||||||
)))
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ use dom_struct::dom_struct;
|
||||||
use js::jsapi::{Heap, JSObject};
|
use js::jsapi::{Heap, JSObject};
|
||||||
use js::jsval::UndefinedValue;
|
use js::jsval::UndefinedValue;
|
||||||
use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue, MutableHandleValue};
|
use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue, MutableHandleValue};
|
||||||
use script_traits::{ScriptMsg, StructuredSerializedData};
|
use script_traits::{ScriptToConstellationMessage, StructuredSerializedData};
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
|
|
||||||
use crate::dom::bindings::codegen::Bindings::DissimilarOriginWindowBinding;
|
use crate::dom::bindings::codegen::Bindings::DissimilarOriginWindowBinding;
|
||||||
|
@ -236,7 +236,7 @@ impl DissimilarOriginWindow {
|
||||||
Err(_) => return Err(Error::Syntax),
|
Err(_) => return Err(Error::Syntax),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let msg = ScriptMsg::PostMessage {
|
let msg = ScriptToConstellationMessage::PostMessage {
|
||||||
target,
|
target,
|
||||||
source: incumbent.pipeline_id(),
|
source: incumbent.pipeline_id(),
|
||||||
source_origin,
|
source_origin,
|
||||||
|
|
|
@ -54,7 +54,8 @@ use profile_traits::time::TimerMetadataFrameType;
|
||||||
use script_bindings::interfaces::DocumentHelpers;
|
use script_bindings::interfaces::DocumentHelpers;
|
||||||
use script_layout_interface::{PendingRestyle, TrustedNodeAddress};
|
use script_layout_interface::{PendingRestyle, TrustedNodeAddress};
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
AnimationState, ConstellationInputEvent, DocumentActivity, ProgressiveWebMetricType, ScriptMsg,
|
AnimationState, ConstellationInputEvent, DocumentActivity, ProgressiveWebMetricType,
|
||||||
|
ScriptToConstellationMessage,
|
||||||
};
|
};
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
use servo_config::pref;
|
use servo_config::pref;
|
||||||
|
@ -1178,7 +1179,8 @@ impl Document {
|
||||||
// Update the focus state for all elements in the focus chain.
|
// Update the focus state for all elements in the focus chain.
|
||||||
// https://html.spec.whatwg.org/multipage/#focus-chain
|
// https://html.spec.whatwg.org/multipage/#focus-chain
|
||||||
if focus_type == FocusType::Element {
|
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.
|
// Notify the embedder to display an input method.
|
||||||
|
@ -1223,10 +1225,11 @@ impl Document {
|
||||||
if self.browsing_context().is_some() {
|
if self.browsing_context().is_some() {
|
||||||
self.send_title_to_embedder();
|
self.send_title_to_embedder();
|
||||||
let title = String::from(self.Title());
|
let title = String::from(self.Title());
|
||||||
self.window.send_to_constellation(ScriptMsg::TitleChanged(
|
self.window
|
||||||
self.window.pipeline_id(),
|
.send_to_constellation(ScriptToConstellationMessage::TitleChanged(
|
||||||
title.clone(),
|
self.window.pipeline_id(),
|
||||||
));
|
title.clone(),
|
||||||
|
));
|
||||||
if let Some(chan) = self.window.as_global_scope().devtools_chan() {
|
if let Some(chan) = self.window.as_global_scope().devtools_chan() {
|
||||||
let _ = chan.send(ScriptToDevtoolsControlMsg::TitleChanged(
|
let _ = chan.send(ScriptToDevtoolsControlMsg::TitleChanged(
|
||||||
self.window.pipeline_id(),
|
self.window.pipeline_id(),
|
||||||
|
@ -1665,7 +1668,7 @@ impl Document {
|
||||||
ClipboardEventType::Paste => {
|
ClipboardEventType::Paste => {
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
self.window
|
self.window
|
||||||
.send_to_constellation(ScriptMsg::ForwardToEmbedder(
|
.send_to_constellation(ScriptToConstellationMessage::ForwardToEmbedder(
|
||||||
EmbedderMsg::GetClipboardText(self.window.webview_id(), sender),
|
EmbedderMsg::GetClipboardText(self.window.webview_id(), sender),
|
||||||
));
|
));
|
||||||
let text_contents = receiver
|
let text_contents = receiver
|
||||||
|
@ -2343,8 +2346,9 @@ impl Document {
|
||||||
// This reduces CPU usage by avoiding needless thread wakeups in the common case of
|
// This reduces CPU usage by avoiding needless thread wakeups in the common case of
|
||||||
// repeated rAF.
|
// repeated rAF.
|
||||||
|
|
||||||
let event =
|
let event = ScriptToConstellationMessage::ChangeRunningAnimationsState(
|
||||||
ScriptMsg::ChangeRunningAnimationsState(AnimationState::AnimationCallbacksPresent);
|
AnimationState::AnimationCallbacksPresent,
|
||||||
|
);
|
||||||
self.window().send_to_constellation(event);
|
self.window().send_to_constellation(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2439,7 +2443,7 @@ impl Document {
|
||||||
// to expliclty trigger a OneshotTimerCallback for these queued callbacks.
|
// to expliclty trigger a OneshotTimerCallback for these queued callbacks.
|
||||||
self.schedule_fake_animation_frame();
|
self.schedule_fake_animation_frame();
|
||||||
}
|
}
|
||||||
let event = ScriptMsg::ChangeRunningAnimationsState(
|
let event = ScriptToConstellationMessage::ChangeRunningAnimationsState(
|
||||||
AnimationState::NoAnimationCallbacksPresent,
|
AnimationState::NoAnimationCallbacksPresent,
|
||||||
);
|
);
|
||||||
self.window().send_to_constellation(event);
|
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
|
// If we were previously faking animation frames, we need to re-enable video refresh
|
||||||
// callbacks when we stop seeing spurious animation frames.
|
// callbacks when we stop seeing spurious animation frames.
|
||||||
if was_faking_animation_frames && !self.is_faking_animation_frames() && !is_empty {
|
if was_faking_animation_frames && !self.is_faking_animation_frames() && !is_empty {
|
||||||
self.window()
|
self.window().send_to_constellation(
|
||||||
.send_to_constellation(ScriptMsg::ChangeRunningAnimationsState(
|
ScriptToConstellationMessage::ChangeRunningAnimationsState(
|
||||||
AnimationState::AnimationCallbacksPresent,
|
AnimationState::AnimationCallbacksPresent,
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2690,7 +2695,7 @@ impl Document {
|
||||||
if !self.salvageable.get() {
|
if !self.salvageable.get() {
|
||||||
// Step 1 of clean-up steps.
|
// Step 1 of clean-up steps.
|
||||||
global_scope.close_event_sources();
|
global_scope.close_event_sources();
|
||||||
let msg = ScriptMsg::DiscardDocument;
|
let msg = ScriptToConstellationMessage::DiscardDocument;
|
||||||
let _ = global_scope.script_to_constellation_chan().send(msg);
|
let _ = global_scope.script_to_constellation_chan().send(msg);
|
||||||
}
|
}
|
||||||
// https://w3c.github.io/FileAPI/#lifeTime
|
// https://w3c.github.io/FileAPI/#lifeTime
|
||||||
|
@ -3064,7 +3069,8 @@ impl Document {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn notify_constellation_load(&self) {
|
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>) {
|
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::serializable::{BlobData, BlobImpl, FileBlob};
|
||||||
use script_traits::transferable::MessagePortImpl;
|
use script_traits::transferable::MessagePortImpl;
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
BroadcastMsg, MessagePortMsg, PortMessageTask, ScriptMsg, ScriptToConstellationChan,
|
BroadcastMsg, MessagePortMsg, PortMessageTask, ScriptToConstellationChan,
|
||||||
|
ScriptToConstellationMessage,
|
||||||
};
|
};
|
||||||
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
|
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
|
||||||
use timers::{TimerEventId, TimerEventRequest, TimerSource};
|
use timers::{TimerEventId, TimerEventRequest, TimerSource};
|
||||||
|
@ -526,7 +527,7 @@ impl MessageListener {
|
||||||
// If not managing any ports, no transfer can succeed,
|
// If not managing any ports, no transfer can succeed,
|
||||||
// so just send back everything.
|
// so just send back everything.
|
||||||
let _ = global.script_to_constellation_chan().send(
|
let _ = global.script_to_constellation_chan().send(
|
||||||
ScriptMsg::MessagePortTransferResult(None, vec![], ports),
|
ScriptToConstellationMessage::MessagePortTransferResult(None, vec![], ports),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -544,7 +545,7 @@ impl MessageListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let _ = global.script_to_constellation_chan().send(
|
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) =
|
if let MessagePortState::Managed(router_id, _message_ports) =
|
||||||
&*self.message_port_state.borrow()
|
&*self.message_port_state.borrow()
|
||||||
{
|
{
|
||||||
let _ = self
|
let _ = self.script_to_constellation_chan().send(
|
||||||
.script_to_constellation_chan()
|
ScriptToConstellationMessage::RemoveMessagePortRouter(*router_id),
|
||||||
.send(ScriptMsg::RemoveMessagePortRouter(*router_id));
|
);
|
||||||
}
|
}
|
||||||
*self.message_port_state.borrow_mut() = MessagePortState::UnManaged;
|
*self.message_port_state.borrow_mut() = MessagePortState::UnManaged;
|
||||||
}
|
}
|
||||||
|
@ -929,12 +930,12 @@ impl GlobalScope {
|
||||||
if let BroadcastChannelState::Managed(router_id, _channels) =
|
if let BroadcastChannelState::Managed(router_id, _channels) =
|
||||||
&*self.broadcast_channel_state.borrow()
|
&*self.broadcast_channel_state.borrow()
|
||||||
{
|
{
|
||||||
let _ =
|
let _ = self.script_to_constellation_chan().send(
|
||||||
self.script_to_constellation_chan()
|
ScriptToConstellationMessage::RemoveBroadcastChannelRouter(
|
||||||
.send(ScriptMsg::RemoveBroadcastChannelRouter(
|
*router_id,
|
||||||
*router_id,
|
self.origin().immutable().clone(),
|
||||||
self.origin().immutable().clone(),
|
),
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
*self.broadcast_channel_state.borrow_mut() = BroadcastChannelState::UnManaged;
|
*self.broadcast_channel_state.borrow_mut() = BroadcastChannelState::UnManaged;
|
||||||
}
|
}
|
||||||
|
@ -965,7 +966,7 @@ impl GlobalScope {
|
||||||
|
|
||||||
let _ = self
|
let _ = self
|
||||||
.script_to_constellation_chan()
|
.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.
|
/// 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();
|
port_impl.set_has_been_shipped();
|
||||||
let _ = self
|
let _ = self
|
||||||
.script_to_constellation_chan()
|
.script_to_constellation_chan()
|
||||||
.send(ScriptMsg::MessagePortShipped(*port_id));
|
.send(ScriptToConstellationMessage::MessagePortShipped(*port_id));
|
||||||
port_impl
|
port_impl
|
||||||
} else {
|
} else {
|
||||||
panic!("mark_port_as_transferred called on a global not managing any ports.");
|
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,
|
/// If we don't know about the port,
|
||||||
/// send the message to the constellation for routing.
|
/// send the message to the constellation for routing.
|
||||||
fn re_route_port_task(&self, port_id: MessagePortId, task: PortMessageTask) {
|
fn re_route_port_task(&self, port_id: MessagePortId, task: PortMessageTask) {
|
||||||
let _ = self
|
let _ = self.script_to_constellation_chan().send(
|
||||||
.script_to_constellation_chan()
|
ScriptToConstellationMessage::RerouteMessagePort(port_id, task),
|
||||||
.send(ScriptMsg::RerouteMessagePort(port_id, task));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://html.spec.whatwg.org/multipage/#dom-broadcastchannel-postmessage>
|
/// <https://html.spec.whatwg.org/multipage/#dom-broadcastchannel-postmessage>
|
||||||
|
@ -1111,9 +1112,9 @@ impl GlobalScope {
|
||||||
//
|
//
|
||||||
// Note: for globals in the same script-thread,
|
// Note: for globals in the same script-thread,
|
||||||
// we could skip the hop to the constellation.
|
// we could skip the hop to the constellation.
|
||||||
let _ = self
|
let _ = self.script_to_constellation_chan().send(
|
||||||
.script_to_constellation_chan()
|
ScriptToConstellationMessage::ScheduleBroadcast(*router_id, msg),
|
||||||
.send(ScriptMsg::ScheduleBroadcast(*router_id, msg));
|
);
|
||||||
} else {
|
} else {
|
||||||
panic!("Attemps to broadcast a message via global not managing any channels.");
|
panic!("Attemps to broadcast a message via global not managing any channels.");
|
||||||
}
|
}
|
||||||
|
@ -1286,12 +1287,9 @@ impl GlobalScope {
|
||||||
}
|
}
|
||||||
managed_port.pending = false;
|
managed_port.pending = false;
|
||||||
}
|
}
|
||||||
let _ =
|
let _ = self.script_to_constellation_chan().send(
|
||||||
self.script_to_constellation_chan()
|
ScriptToConstellationMessage::CompleteMessagePortTransfer(*router_id, to_be_added),
|
||||||
.send(ScriptMsg::CompleteMessagePortTransfer(
|
);
|
||||||
*router_id,
|
|
||||||
to_be_added,
|
|
||||||
));
|
|
||||||
} else {
|
} else {
|
||||||
warn!("maybe_add_pending_ports called on a global not managing any ports.");
|
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.
|
// and to forward this message to the script-process where the entangled is found.
|
||||||
let _ = self
|
let _ = self
|
||||||
.script_to_constellation_chan()
|
.script_to_constellation_chan()
|
||||||
.send(ScriptMsg::RemoveMessagePort(*id));
|
.send(ScriptToConstellationMessage::RemoveMessagePort(*id));
|
||||||
Some(*id)
|
Some(*id)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
@ -1340,7 +1338,7 @@ impl GlobalScope {
|
||||||
channels.retain(|chan| !chan.closed());
|
channels.retain(|chan| !chan.closed());
|
||||||
if channels.is_empty() {
|
if channels.is_empty() {
|
||||||
let _ = self.script_to_constellation_chan().send(
|
let _ = self.script_to_constellation_chan().send(
|
||||||
ScriptMsg::RemoveBroadcastChannelNameInRouter(
|
ScriptToConstellationMessage::RemoveBroadcastChannelNameInRouter(
|
||||||
*router_id,
|
*router_id,
|
||||||
name.to_string(),
|
name.to_string(),
|
||||||
self.origin().immutable().clone(),
|
self.origin().immutable().clone(),
|
||||||
|
@ -1382,19 +1380,19 @@ impl GlobalScope {
|
||||||
);
|
);
|
||||||
let router_id = BroadcastChannelRouterId::new();
|
let router_id = BroadcastChannelRouterId::new();
|
||||||
*current_state = BroadcastChannelState::Managed(router_id, HashMap::new());
|
*current_state = BroadcastChannelState::Managed(router_id, HashMap::new());
|
||||||
let _ = self
|
let _ = self.script_to_constellation_chan().send(
|
||||||
.script_to_constellation_chan()
|
ScriptToConstellationMessage::NewBroadcastChannelRouter(
|
||||||
.send(ScriptMsg::NewBroadcastChannelRouter(
|
|
||||||
router_id,
|
router_id,
|
||||||
broadcast_control_sender,
|
broadcast_control_sender,
|
||||||
self.origin().immutable().clone(),
|
self.origin().immutable().clone(),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let BroadcastChannelState::Managed(router_id, channels) = &mut *current_state {
|
if let BroadcastChannelState::Managed(router_id, channels) = &mut *current_state {
|
||||||
let entry = channels.entry(dom_channel.Name()).or_insert_with(|| {
|
let entry = channels.entry(dom_channel.Name()).or_insert_with(|| {
|
||||||
let _ = self.script_to_constellation_chan().send(
|
let _ = self.script_to_constellation_chan().send(
|
||||||
ScriptMsg::NewBroadcastChannelNameInRouter(
|
ScriptToConstellationMessage::NewBroadcastChannelNameInRouter(
|
||||||
*router_id,
|
*router_id,
|
||||||
dom_channel.Name().to_string(),
|
dom_channel.Name().to_string(),
|
||||||
self.origin().immutable().clone(),
|
self.origin().immutable().clone(),
|
||||||
|
@ -1434,12 +1432,9 @@ impl GlobalScope {
|
||||||
);
|
);
|
||||||
let router_id = MessagePortRouterId::new();
|
let router_id = MessagePortRouterId::new();
|
||||||
*current_state = MessagePortState::Managed(router_id, HashMapTracedValues::new());
|
*current_state = MessagePortState::Managed(router_id, HashMapTracedValues::new());
|
||||||
let _ = self
|
let _ = self.script_to_constellation_chan().send(
|
||||||
.script_to_constellation_chan()
|
ScriptToConstellationMessage::NewMessagePortRouter(router_id, port_control_sender),
|
||||||
.send(ScriptMsg::NewMessagePortRouter(
|
);
|
||||||
router_id,
|
|
||||||
port_control_sender,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let MessagePortState::Managed(router_id, message_ports) = &mut *current_state {
|
if let MessagePortState::Managed(router_id, message_ports) = &mut *current_state {
|
||||||
|
@ -1478,12 +1473,12 @@ impl GlobalScope {
|
||||||
closed: false,
|
closed: false,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
let _ = self
|
let _ = self.script_to_constellation_chan().send(
|
||||||
.script_to_constellation_chan()
|
ScriptToConstellationMessage::NewMessagePort(
|
||||||
.send(ScriptMsg::NewMessagePort(
|
|
||||||
*router_id,
|
*router_id,
|
||||||
*dom_port.message_port_id(),
|
*dom_port.message_port_id(),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
panic!("track_message_port should have first switched the state to managed.");
|
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) {
|
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();
|
self.script_to_constellation_chan().send(msg).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ use js::rust::{HandleValue, MutableHandleValue};
|
||||||
use net_traits::{CoreResourceMsg, IpcSend};
|
use net_traits::{CoreResourceMsg, IpcSend};
|
||||||
use profile_traits::ipc;
|
use profile_traits::ipc;
|
||||||
use profile_traits::ipc::channel;
|
use profile_traits::ipc::channel;
|
||||||
use script_traits::{ScriptMsg, StructuredSerializedData};
|
use script_traits::{ScriptToConstellationMessage, StructuredSerializedData};
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
|
|
||||||
use crate::dom::bindings::codegen::Bindings::HistoryBinding::HistoryMethods;
|
use crate::dom::bindings::codegen::Bindings::HistoryBinding::HistoryMethods;
|
||||||
|
@ -72,7 +72,7 @@ impl History {
|
||||||
if !self.window.Document().is_fully_active() {
|
if !self.window.Document().is_fully_active() {
|
||||||
return Err(Error::Security);
|
return Err(Error::Security);
|
||||||
}
|
}
|
||||||
let msg = ScriptMsg::TraverseHistory(direction);
|
let msg = ScriptToConstellationMessage::TraverseHistory(direction);
|
||||||
let _ = self
|
let _ = self
|
||||||
.window
|
.window
|
||||||
.as_global_scope()
|
.as_global_scope()
|
||||||
|
@ -227,7 +227,7 @@ impl History {
|
||||||
PushOrReplace::Push => {
|
PushOrReplace::Push => {
|
||||||
let state_id = HistoryStateId::new();
|
let state_id = HistoryStateId::new();
|
||||||
self.state_id.set(Some(state_id));
|
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
|
let _ = self
|
||||||
.window
|
.window
|
||||||
.as_global_scope()
|
.as_global_scope()
|
||||||
|
@ -244,7 +244,8 @@ impl History {
|
||||||
state_id
|
state_id
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let msg = ScriptMsg::ReplaceHistoryState(state_id, new_url.clone());
|
let msg =
|
||||||
|
ScriptToConstellationMessage::ReplaceHistoryState(state_id, new_url.clone());
|
||||||
let _ = self
|
let _ = self
|
||||||
.window
|
.window
|
||||||
.as_global_scope()
|
.as_global_scope()
|
||||||
|
@ -339,7 +340,7 @@ impl HistoryMethods<crate::DomTypeHolder> for History {
|
||||||
}
|
}
|
||||||
let (sender, recv) = channel(self.global().time_profiler_chan().clone())
|
let (sender, recv) = channel(self.global().time_profiler_chan().clone())
|
||||||
.expect("Failed to create channel to send jsh length.");
|
.expect("Failed to create channel to send jsh length.");
|
||||||
let msg = ScriptMsg::JointSessionHistoryLength(sender);
|
let msg = ScriptToConstellationMessage::JointSessionHistoryLength(sender);
|
||||||
let _ = self
|
let _ = self
|
||||||
.window
|
.window
|
||||||
.as_global_scope()
|
.as_global_scope()
|
||||||
|
|
|
@ -21,7 +21,7 @@ use js::error::throw_type_error;
|
||||||
use js::rust::{HandleObject, HandleValue};
|
use js::rust::{HandleObject, HandleValue};
|
||||||
use script_layout_interface::{HTMLCanvasData, HTMLCanvasDataSource};
|
use script_layout_interface::{HTMLCanvasData, HTMLCanvasDataSource};
|
||||||
#[cfg(feature = "webgpu")]
|
#[cfg(feature = "webgpu")]
|
||||||
use script_traits::ScriptMsg;
|
use script_traits::ScriptToConstellationMessage;
|
||||||
use script_traits::serializable::BlobImpl;
|
use script_traits::serializable::BlobImpl;
|
||||||
use servo_media::streams::MediaStreamType;
|
use servo_media::streams::MediaStreamType;
|
||||||
use servo_media::streams::registry::MediaStreamId;
|
use servo_media::streams::registry::MediaStreamId;
|
||||||
|
@ -334,7 +334,7 @@ impl HTMLCanvasElement {
|
||||||
let global_scope = self.owner_global();
|
let global_scope = self.owner_global();
|
||||||
let _ = global_scope
|
let _ = global_scope
|
||||||
.script_to_constellation_chan()
|
.script_to_constellation_chan()
|
||||||
.send(ScriptMsg::GetWebGPUChan(sender));
|
.send(ScriptToConstellationMessage::GetWebGPUChan(sender));
|
||||||
receiver
|
receiver
|
||||||
.recv()
|
.recv()
|
||||||
.expect("Failed to get WebGPU channel")
|
.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::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
IFrameLoadInfo, IFrameLoadInfoWithData, JsEvalResult, LoadData, LoadOrigin,
|
IFrameLoadInfo, IFrameLoadInfoWithData, JsEvalResult, LoadData, LoadOrigin,
|
||||||
NavigationHistoryBehavior, NewLayoutInfo, ScriptMsg, UpdatePipelineIdReason,
|
NavigationHistoryBehavior, NewLayoutInfo, ScriptToConstellationMessage, UpdatePipelineIdReason,
|
||||||
};
|
};
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
||||||
|
@ -217,7 +217,7 @@ impl HTMLIFrameElement {
|
||||||
window
|
window
|
||||||
.as_global_scope()
|
.as_global_scope()
|
||||||
.script_to_constellation_chan()
|
.script_to_constellation_chan()
|
||||||
.send(ScriptMsg::ScriptNewIFrame(load_info))
|
.send(ScriptToConstellationMessage::ScriptNewIFrame(load_info))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let new_layout_info = NewLayoutInfo {
|
let new_layout_info = NewLayoutInfo {
|
||||||
|
@ -244,7 +244,9 @@ impl HTMLIFrameElement {
|
||||||
window
|
window
|
||||||
.as_global_scope()
|
.as_global_scope()
|
||||||
.script_to_constellation_chan()
|
.script_to_constellation_chan()
|
||||||
.send(ScriptMsg::ScriptLoadedURLInIFrame(load_info))
|
.send(ScriptToConstellationMessage::ScriptLoadedURLInIFrame(
|
||||||
|
load_info,
|
||||||
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -782,7 +784,7 @@ impl VirtualMethods for HTMLIFrameElement {
|
||||||
};
|
};
|
||||||
debug!("Unbinding frame {}.", browsing_context_id);
|
debug!("Unbinding frame {}.", browsing_context_id);
|
||||||
|
|
||||||
let msg = ScriptMsg::RemoveIFrame(browsing_context_id, sender);
|
let msg = ScriptToConstellationMessage::RemoveIFrame(browsing_context_id, sender);
|
||||||
window
|
window
|
||||||
.as_global_scope()
|
.as_global_scope()
|
||||||
.script_to_constellation_chan()
|
.script_to_constellation_chan()
|
||||||
|
|
|
@ -8,7 +8,7 @@ use dom_struct::dom_struct;
|
||||||
use embedder_traits::{
|
use embedder_traits::{
|
||||||
MediaMetadata as EmbedderMediaMetadata, MediaSessionActionType, MediaSessionEvent,
|
MediaMetadata as EmbedderMediaMetadata, MediaSessionActionType, MediaSessionEvent,
|
||||||
};
|
};
|
||||||
use script_traits::ScriptMsg;
|
use script_traits::ScriptToConstellationMessage;
|
||||||
|
|
||||||
use super::bindings::trace::HashMapTracedValues;
|
use super::bindings::trace::HashMapTracedValues;
|
||||||
use crate::conversions::Convert;
|
use crate::conversions::Convert;
|
||||||
|
@ -106,7 +106,10 @@ impl MediaSession {
|
||||||
let global = self.global();
|
let global = self.global();
|
||||||
let window = global.as_window();
|
let window = global.as_window();
|
||||||
let pipeline_id = window.pipeline_id();
|
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) {
|
pub(crate) fn update_title(&self, title: String) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ use base::id::ServiceWorkerId;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use js::jsapi::{Heap, JSObject};
|
use js::jsapi::{Heap, JSObject};
|
||||||
use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue};
|
use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue};
|
||||||
use script_traits::{DOMMessage, ScriptMsg};
|
use script_traits::{DOMMessage, ScriptToConstellationMessage};
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
|
|
||||||
use crate::dom::abstractworker::SimpleWorkerErrorHandler;
|
use crate::dom::abstractworker::SimpleWorkerErrorHandler;
|
||||||
|
@ -109,13 +109,9 @@ impl ServiceWorker {
|
||||||
origin: incumbent.origin().immutable().clone(),
|
origin: incumbent.origin().immutable().clone(),
|
||||||
data,
|
data,
|
||||||
};
|
};
|
||||||
let _ = self
|
let _ = self.global().script_to_constellation_chan().send(
|
||||||
.global()
|
ScriptToConstellationMessage::ForwardDOMMessage(msg_vec, self.scope_url.clone()),
|
||||||
.script_to_constellation_chan()
|
);
|
||||||
.send(ScriptMsg::ForwardDOMMessage(
|
|
||||||
msg_vec,
|
|
||||||
self.scope_url.clone(),
|
|
||||||
));
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,9 @@ use std::rc::Rc;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use ipc_channel::ipc;
|
use ipc_channel::ipc;
|
||||||
use ipc_channel::router::ROUTER;
|
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::{
|
use crate::dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::{
|
||||||
RegistrationOptions, ServiceWorkerContainerMethods,
|
RegistrationOptions, ServiceWorkerContainerMethods,
|
||||||
|
@ -179,7 +181,7 @@ impl ServiceWorkerContainerMethods<crate::DomTypeHolder> for ServiceWorkerContai
|
||||||
// B: Step 14: schedule job.
|
// B: Step 14: schedule job.
|
||||||
let _ = global
|
let _ = global
|
||||||
.script_to_constellation_chan()
|
.script_to_constellation_chan()
|
||||||
.send(ScriptMsg::ScheduleJob(job));
|
.send(ScriptToConstellationMessage::ScheduleJob(job));
|
||||||
|
|
||||||
// A: Step 7
|
// A: Step 7
|
||||||
promise
|
promise
|
||||||
|
|
|
@ -9,7 +9,7 @@ use js::rust::HandleObject;
|
||||||
use profile_traits::mem::MemoryReportResult;
|
use profile_traits::mem::MemoryReportResult;
|
||||||
use script_bindings::interfaces::ServoInternalsHelpers;
|
use script_bindings::interfaces::ServoInternalsHelpers;
|
||||||
use script_bindings::script_runtime::JSContext;
|
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::codegen::Bindings::ServoInternalsBinding::ServoInternalsMethods;
|
||||||
use crate::dom::bindings::error::Error;
|
use crate::dom::bindings::error::Error;
|
||||||
|
@ -46,7 +46,7 @@ impl ServoInternalsMethods<crate::DomTypeHolder> for ServoInternals {
|
||||||
let sender = route_promise(&promise, self);
|
let sender = route_promise(&promise, self);
|
||||||
let script_to_constellation_chan = global.script_to_constellation_chan();
|
let script_to_constellation_chan = global.script_to_constellation_chan();
|
||||||
if script_to_constellation_chan
|
if script_to_constellation_chan
|
||||||
.send(ScriptMsg::ReportMemory(sender))
|
.send(ScriptToConstellationMessage::ReportMemory(sender))
|
||||||
.is_err()
|
.is_err()
|
||||||
{
|
{
|
||||||
promise.reject_error(Error::Operation, can_gc);
|
promise.reject_error(Error::Operation, can_gc);
|
||||||
|
|
|
@ -7,7 +7,7 @@ use ipc_channel::ipc::IpcSender;
|
||||||
use net_traits::IpcSend;
|
use net_traits::IpcSend;
|
||||||
use net_traits::storage_thread::{StorageThreadMsg, StorageType};
|
use net_traits::storage_thread::{StorageThreadMsg, StorageType};
|
||||||
use profile_traits::ipc;
|
use profile_traits::ipc;
|
||||||
use script_traits::ScriptMsg;
|
use script_traits::ScriptToConstellationMessage;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
|
|
||||||
use crate::dom::bindings::codegen::Bindings::StorageBinding::StorageMethods;
|
use crate::dom::bindings::codegen::Bindings::StorageBinding::StorageMethods;
|
||||||
|
@ -195,7 +195,9 @@ impl Storage {
|
||||||
) {
|
) {
|
||||||
let storage = self.storage_type;
|
let storage = self.storage_type;
|
||||||
let url = self.get_url();
|
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()
|
self.global()
|
||||||
.script_to_constellation_chan()
|
.script_to_constellation_chan()
|
||||||
.send(msg)
|
.send(msg)
|
||||||
|
|
|
@ -6,7 +6,7 @@ use std::rc::Rc;
|
||||||
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use js::jsapi::Heap;
|
use js::jsapi::Heap;
|
||||||
use script_traits::ScriptMsg;
|
use script_traits::ScriptToConstellationMessage;
|
||||||
use webgpu_traits::WebGPUAdapterResponse;
|
use webgpu_traits::WebGPUAdapterResponse;
|
||||||
use wgpu_types::PowerPreference;
|
use wgpu_types::PowerPreference;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ impl GPUMethods<crate::DomTypeHolder> for GPU {
|
||||||
|
|
||||||
let script_to_constellation_chan = global.script_to_constellation_chan();
|
let script_to_constellation_chan = global.script_to_constellation_chan();
|
||||||
if script_to_constellation_chan
|
if script_to_constellation_chan
|
||||||
.send(ScriptMsg::RequestAdapter(
|
.send(ScriptToConstellationMessage::RequestAdapter(
|
||||||
sender,
|
sender,
|
||||||
wgpu_core::instance::RequestAdapterOptions {
|
wgpu_core::instance::RequestAdapterOptions {
|
||||||
power_preference,
|
power_preference,
|
||||||
|
|
|
@ -63,8 +63,8 @@ use script_layout_interface::{
|
||||||
TrustedNodeAddress, combine_id_with_fragment_type,
|
TrustedNodeAddress, combine_id_with_fragment_type,
|
||||||
};
|
};
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
DocumentState, LoadData, LoadOrigin, NavigationHistoryBehavior, ScriptMsg, ScriptThreadMessage,
|
DocumentState, LoadData, LoadOrigin, NavigationHistoryBehavior, ScriptThreadMessage,
|
||||||
ScriptToConstellationChan, StructuredSerializedData,
|
ScriptToConstellationChan, ScriptToConstellationMessage, StructuredSerializedData,
|
||||||
};
|
};
|
||||||
use selectors::attr::CaseSensitivity;
|
use selectors::attr::CaseSensitivity;
|
||||||
use servo_arc::Arc as ServoArc;
|
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.
|
// which calls into https://html.spec.whatwg.org/multipage/#discard-a-document.
|
||||||
window.discard_browsing_context();
|
window.discard_browsing_context();
|
||||||
|
|
||||||
window.send_to_constellation(ScriptMsg::DiscardTopLevelBrowsingContext);
|
window.send_to_constellation(ScriptToConstellationMessage::DiscardTopLevelBrowsingContext);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
self.as_global_scope()
|
self.as_global_scope()
|
||||||
|
@ -2047,7 +2047,7 @@ impl Window {
|
||||||
.iframes_mut()
|
.iframes_mut()
|
||||||
.handle_new_iframe_sizes_after_layout(results.iframe_sizes);
|
.handle_new_iframe_sizes_after_layout(results.iframe_sizes);
|
||||||
if !size_messages.is_empty() {
|
if !size_messages.is_empty() {
|
||||||
self.send_to_constellation(ScriptMsg::IFrameSizes(size_messages));
|
self.send_to_constellation(ScriptToConstellationMessage::IFrameSizes(size_messages));
|
||||||
}
|
}
|
||||||
document
|
document
|
||||||
.image_animation_manager_mut()
|
.image_animation_manager_mut()
|
||||||
|
@ -2145,7 +2145,7 @@ impl Window {
|
||||||
"{:?}: Sending DocumentState::Idle to Constellation",
|
"{:?}: Sending DocumentState::Idle to Constellation",
|
||||||
self.pipeline_id()
|
self.pipeline_id()
|
||||||
);
|
);
|
||||||
let event = ScriptMsg::SetDocumentState(DocumentState::Idle);
|
let event = ScriptToConstellationMessage::SetDocumentState(DocumentState::Idle);
|
||||||
self.send_to_constellation(event);
|
self.send_to_constellation(event);
|
||||||
self.has_sent_idle_message.set(true);
|
self.has_sent_idle_message.set(true);
|
||||||
}
|
}
|
||||||
|
@ -2227,7 +2227,7 @@ impl Window {
|
||||||
self.pipeline_id()
|
self.pipeline_id()
|
||||||
);
|
);
|
||||||
let (sender, receiver) = ipc::channel().expect("Failed to create IPC channel!");
|
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);
|
self.send_to_constellation(event);
|
||||||
let _ = receiver.recv();
|
let _ = receiver.recv();
|
||||||
}
|
}
|
||||||
|
@ -2445,7 +2445,7 @@ impl Window {
|
||||||
// Step 6
|
// Step 6
|
||||||
// TODO: Fragment handling appears to have moved to step 13
|
// TODO: Fragment handling appears to have moved to step 13
|
||||||
if let Some(fragment) = load_data.url.fragment() {
|
if let Some(fragment) = load_data.url.fragment() {
|
||||||
self.send_to_constellation(ScriptMsg::NavigatedToFragment(
|
self.send_to_constellation(ScriptToConstellationMessage::NavigatedToFragment(
|
||||||
load_data.url.clone(),
|
load_data.url.clone(),
|
||||||
history_handling,
|
history_handling,
|
||||||
));
|
));
|
||||||
|
@ -2769,10 +2769,10 @@ impl Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn send_to_embedder(&self, msg: EmbedderMsg) {
|
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()
|
self.as_global_scope()
|
||||||
.script_to_constellation_chan()
|
.script_to_constellation_chan()
|
||||||
.send(msg)
|
.send(msg)
|
||||||
|
|
|
@ -31,7 +31,7 @@ use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||||
use net_traits::request::Referrer;
|
use net_traits::request::Referrer;
|
||||||
use script_traits::{
|
use script_traits::{
|
||||||
AuxiliaryWebViewCreationRequest, LoadData, LoadOrigin, NavigationHistoryBehavior,
|
AuxiliaryWebViewCreationRequest, LoadData, LoadOrigin, NavigationHistoryBehavior,
|
||||||
NewLayoutInfo, ScriptMsg,
|
NewLayoutInfo, ScriptToConstellationMessage,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||||
|
@ -314,7 +314,7 @@ impl WindowProxy {
|
||||||
opener_pipeline_id: self.currently_active.get().unwrap(),
|
opener_pipeline_id: self.currently_active.get().unwrap(),
|
||||||
response_sender,
|
response_sender,
|
||||||
};
|
};
|
||||||
let constellation_msg = ScriptMsg::CreateAuxiliaryWebView(load_info);
|
let constellation_msg = ScriptToConstellationMessage::CreateAuxiliaryWebView(load_info);
|
||||||
window.send_to_constellation(constellation_msg);
|
window.send_to_constellation(constellation_msg);
|
||||||
|
|
||||||
let response = response_receiver.recv().unwrap()?;
|
let response = response_receiver.recv().unwrap()?;
|
||||||
|
@ -863,7 +863,7 @@ unsafe fn GetSubframeWindowProxy(
|
||||||
let (result_sender, result_receiver) = ipc::channel().unwrap();
|
let (result_sender, result_receiver) = ipc::channel().unwrap();
|
||||||
|
|
||||||
let _ = win.as_global_scope().script_to_constellation_chan().send(
|
let _ = win.as_global_scope().script_to_constellation_chan().send(
|
||||||
ScriptMsg::GetChildBrowsingContextId(
|
ScriptToConstellationMessage::GetChildBrowsingContextId(
|
||||||
browsing_context_id,
|
browsing_context_id,
|
||||||
index as usize,
|
index as usize,
|
||||||
result_sender,
|
result_sender,
|
||||||
|
@ -882,7 +882,7 @@ unsafe fn GetSubframeWindowProxy(
|
||||||
let (result_sender, result_receiver) = ipc::channel().unwrap();
|
let (result_sender, result_receiver) = ipc::channel().unwrap();
|
||||||
|
|
||||||
let _ = win.global().script_to_constellation_chan().send(
|
let _ = win.global().script_to_constellation_chan().send(
|
||||||
ScriptMsg::GetChildBrowsingContextId(
|
ScriptToConstellationMessage::GetChildBrowsingContextId(
|
||||||
browsing_context_id,
|
browsing_context_id,
|
||||||
index as usize,
|
index as usize,
|
||||||
result_sender,
|
result_sender,
|
||||||
|
|
|
@ -14,7 +14,7 @@ use js::rust::Runtime;
|
||||||
use net_traits::ResourceThreads;
|
use net_traits::ResourceThreads;
|
||||||
use net_traits::image_cache::ImageCache;
|
use net_traits::image_cache::ImageCache;
|
||||||
use profile_traits::{mem, time};
|
use profile_traits::{mem, time};
|
||||||
use script_traits::{Painter, ScriptMsg, ScriptToConstellationChan};
|
use script_traits::{Painter, ScriptToConstellationChan, ScriptToConstellationMessage};
|
||||||
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
|
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
|
||||||
use stylo_atoms::Atom;
|
use stylo_atoms::Atom;
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ pub(crate) struct WorkletGlobalScopeInit {
|
||||||
/// Channel to devtools
|
/// Channel to devtools
|
||||||
pub(crate) devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
pub(crate) devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||||
/// Messages to send to constellation
|
/// Messages to send to constellation
|
||||||
pub(crate) to_constellation_sender: IpcSender<(PipelineId, ScriptMsg)>,
|
pub(crate) to_constellation_sender: IpcSender<(PipelineId, ScriptToConstellationMessage)>,
|
||||||
/// The image cache
|
/// The image cache
|
||||||
pub(crate) image_cache: Arc<dyn ImageCache>,
|
pub(crate) image_cache: Arc<dyn ImageCache>,
|
||||||
/// Identity manager for WebGPU resources
|
/// Identity manager for WebGPU resources
|
||||||
|
|
|
@ -18,7 +18,7 @@ use net_traits::FetchResponseMsg;
|
||||||
use net_traits::image_cache::PendingImageResponse;
|
use net_traits::image_cache::PendingImageResponse;
|
||||||
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::{Painter, ScriptMsg, ScriptThreadMessage};
|
use script_traits::{Painter, ScriptThreadMessage, ScriptToConstellationMessage};
|
||||||
use stylo_atoms::Atom;
|
use stylo_atoms::Atom;
|
||||||
use timers::TimerScheduler;
|
use timers::TimerScheduler;
|
||||||
#[cfg(feature = "webgpu")]
|
#[cfg(feature = "webgpu")]
|
||||||
|
@ -315,7 +315,8 @@ pub(crate) struct ScriptThreadSenders {
|
||||||
/// A [`Sender`] that sends messages to the `Constellation` associated with
|
/// A [`Sender`] that sends messages to the `Constellation` associated with
|
||||||
/// particular pipelines.
|
/// particular pipelines.
|
||||||
#[no_trace]
|
#[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
|
/// 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
|
/// 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::{
|
use script_traits::{
|
||||||
ConstellationInputEvent, DiscardBrowsingContext, DocumentActivity, InitialScriptState,
|
ConstellationInputEvent, DiscardBrowsingContext, DocumentActivity, InitialScriptState,
|
||||||
JsEvalResult, LoadData, LoadOrigin, NavigationHistoryBehavior, NewLayoutInfo, Painter,
|
JsEvalResult, LoadData, LoadOrigin, NavigationHistoryBehavior, NewLayoutInfo, Painter,
|
||||||
ProgressiveWebMetricType, ScriptMsg, ScriptThreadMessage, ScriptToConstellationChan,
|
ProgressiveWebMetricType, ScriptThreadMessage, ScriptToConstellationChan,
|
||||||
StructuredSerializedData, UpdatePipelineIdReason,
|
ScriptToConstellationMessage, StructuredSerializedData, UpdatePipelineIdReason,
|
||||||
};
|
};
|
||||||
use servo_config::opts;
|
use servo_config::opts;
|
||||||
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
|
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()) {
|
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());
|
ScriptThread::eval_js_url(&trusted_global.root(), &mut load_data, CanGc::note());
|
||||||
sender
|
sender
|
||||||
.send((pipeline_id, ScriptMsg::LoadUrl(load_data, history_handling)))
|
.send((pipeline_id, ScriptToConstellationMessage::LoadUrl(load_data, history_handling)))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -629,7 +629,10 @@ impl ScriptThread {
|
||||||
script_thread
|
script_thread
|
||||||
.senders
|
.senders
|
||||||
.pipeline_to_constellation_sender
|
.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");
|
.expect("Sending a LoadUrl message to the constellation failed");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1098,7 +1101,7 @@ impl ScriptThread {
|
||||||
touch_event.event_type,
|
touch_event.event_type,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
let message = ScriptMsg::TouchEventProcessed(result);
|
let message = ScriptToConstellationMessage::TouchEventProcessed(result);
|
||||||
self.senders
|
self.senders
|
||||||
.pipeline_to_constellation_sender
|
.pipeline_to_constellation_sender
|
||||||
.send((pipeline_id, message))
|
.send((pipeline_id, message))
|
||||||
|
@ -2447,7 +2450,10 @@ impl ScriptThread {
|
||||||
// domain)
|
// domain)
|
||||||
self.senders
|
self.senders
|
||||||
.pipeline_to_constellation_sender
|
.pipeline_to_constellation_sender
|
||||||
.send((id, ScriptMsg::SetThrottledComplete(throttled)))
|
.send((
|
||||||
|
id,
|
||||||
|
ScriptToConstellationMessage::SetThrottledComplete(throttled),
|
||||||
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let window = self.documents.borrow().find_window(id);
|
let window = self.documents.borrow().find_window(id);
|
||||||
|
@ -2694,7 +2700,7 @@ impl ScriptThread {
|
||||||
}
|
}
|
||||||
self.senders
|
self.senders
|
||||||
.pipeline_to_constellation_sender
|
.pipeline_to_constellation_sender
|
||||||
.send((*id, ScriptMsg::AbortLoadUrl))
|
.send((*id, ScriptToConstellationMessage::AbortLoadUrl))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
return None;
|
return None;
|
||||||
};
|
};
|
||||||
|
@ -2752,7 +2758,7 @@ impl ScriptThread {
|
||||||
debug!("{id}: Sending PipelineExited message to constellation");
|
debug!("{id}: Sending PipelineExited message to constellation");
|
||||||
self.senders
|
self.senders
|
||||||
.pipeline_to_constellation_sender
|
.pipeline_to_constellation_sender
|
||||||
.send((id, ScriptMsg::PipelineExited))
|
.send((id, ScriptToConstellationMessage::PipelineExited))
|
||||||
.ok();
|
.ok();
|
||||||
|
|
||||||
// Clear any active animations and unroot all of the associated DOM objects.
|
// Clear any active animations and unroot all of the associated DOM objects.
|
||||||
|
@ -2891,7 +2897,7 @@ impl ScriptThread {
|
||||||
pipeline_id: PipelineId,
|
pipeline_id: PipelineId,
|
||||||
) -> Option<(BrowsingContextId, Option<PipelineId>)> {
|
) -> Option<(BrowsingContextId, Option<PipelineId>)> {
|
||||||
let (result_sender, result_receiver) = ipc::channel().unwrap();
|
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
|
self.senders
|
||||||
.pipeline_to_constellation_sender
|
.pipeline_to_constellation_sender
|
||||||
.send((pipeline_id, msg))
|
.send((pipeline_id, msg))
|
||||||
|
@ -2907,7 +2913,10 @@ impl ScriptThread {
|
||||||
browsing_context_id: BrowsingContextId,
|
browsing_context_id: BrowsingContextId,
|
||||||
) -> Option<WebViewId> {
|
) -> Option<WebViewId> {
|
||||||
let (result_sender, result_receiver) = ipc::channel().unwrap();
|
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
|
self.senders
|
||||||
.pipeline_to_constellation_sender
|
.pipeline_to_constellation_sender
|
||||||
.send((sender_pipeline, msg))
|
.send((sender_pipeline, msg))
|
||||||
|
@ -3029,7 +3038,7 @@ impl ScriptThread {
|
||||||
.pipeline_to_constellation_sender
|
.pipeline_to_constellation_sender
|
||||||
.send((
|
.send((
|
||||||
incomplete.pipeline_id,
|
incomplete.pipeline_id,
|
||||||
ScriptMsg::SetFinalUrl(final_url.clone()),
|
ScriptToConstellationMessage::SetFinalUrl(final_url.clone()),
|
||||||
))
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
@ -3221,7 +3230,10 @@ impl ScriptThread {
|
||||||
|
|
||||||
self.senders
|
self.senders
|
||||||
.pipeline_to_constellation_sender
|
.pipeline_to_constellation_sender
|
||||||
.send((incomplete.pipeline_id, ScriptMsg::ActivateDocument))
|
.send((
|
||||||
|
incomplete.pipeline_id,
|
||||||
|
ScriptToConstellationMessage::ActivateDocument,
|
||||||
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Notify devtools that a new script global exists.
|
// Notify devtools that a new script global exists.
|
||||||
|
|
|
@ -55,10 +55,10 @@ use compositing_traits::{CompositorMsg, CompositorProxy, CompositorReceiver};
|
||||||
))]
|
))]
|
||||||
use constellation::content_process_sandbox_profile;
|
use constellation::content_process_sandbox_profile;
|
||||||
use constellation::{
|
use constellation::{
|
||||||
Constellation, FromCompositorLogger, FromScriptLogger, InitialConstellationState,
|
Constellation, FromEmbedderLogger, FromScriptLogger, InitialConstellationState,
|
||||||
UnprivilegedContent,
|
UnprivilegedContent,
|
||||||
};
|
};
|
||||||
use constellation_traits::ConstellationMsg;
|
use constellation_traits::EmbedderToConstellationMessage;
|
||||||
use crossbeam_channel::{Receiver, Sender, unbounded};
|
use crossbeam_channel::{Receiver, Sender, unbounded};
|
||||||
use embedder_traits::user_content_manager::UserContentManager;
|
use embedder_traits::user_content_manager::UserContentManager;
|
||||||
pub use embedder_traits::*;
|
pub use embedder_traits::*;
|
||||||
|
@ -128,12 +128,12 @@ pub use crate::webview_delegate::{
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "webdriver")]
|
#[cfg(feature = "webdriver")]
|
||||||
fn webdriver(port: u16, constellation: Sender<ConstellationMsg>) {
|
fn webdriver(port: u16, constellation: Sender<EmbedderToConstellationMessage>) {
|
||||||
webdriver_server::start_server(port, constellation);
|
webdriver_server::start_server(port, constellation);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "webdriver"))]
|
#[cfg(not(feature = "webdriver"))]
|
||||||
fn webdriver(_port: u16, _constellation: Sender<ConstellationMsg>) {}
|
fn webdriver(_port: u16, _constellation: Sender<EmbedderToConstellationMessage>) {}
|
||||||
|
|
||||||
#[cfg(feature = "media-gstreamer")]
|
#[cfg(feature = "media-gstreamer")]
|
||||||
mod media_platform {
|
mod media_platform {
|
||||||
|
@ -606,7 +606,7 @@ impl Servo {
|
||||||
let constellation_chan = self.constellation_proxy.sender();
|
let constellation_chan = self.constellation_proxy.sender();
|
||||||
let env = env_logger::Env::default();
|
let env = env_logger::Env::default();
|
||||||
let env_logger = EnvLoggerBuilder::from_env(env).build();
|
let env_logger = EnvLoggerBuilder::from_env(env).build();
|
||||||
let con_logger = FromCompositorLogger::new(constellation_chan);
|
let con_logger = FromEmbedderLogger::new(constellation_chan);
|
||||||
|
|
||||||
let filter = max(env_logger.filter(), con_logger.filter());
|
let filter = max(env_logger.filter(), con_logger.filter());
|
||||||
let logger = BothLogger(env_logger, con_logger);
|
let logger = BothLogger(env_logger, con_logger);
|
||||||
|
@ -622,7 +622,8 @@ impl Servo {
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("Sending Exit message to Constellation");
|
debug!("Sending Exit message to Constellation");
|
||||||
self.constellation_proxy.send(ConstellationMsg::Exit);
|
self.constellation_proxy
|
||||||
|
.send(EmbedderToConstellationMessage::Exit);
|
||||||
self.shutdown_state.set(ShutdownState::ShuttingDown);
|
self.shutdown_state.set(ShutdownState::ShuttingDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,11 +643,12 @@ impl Servo {
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.insert(webview.id(), webview.weak_handle());
|
.insert(webview.id(), webview.weak_handle());
|
||||||
let viewport_details = self.compositor.borrow().default_webview_viewport_details();
|
let viewport_details = self.compositor.borrow().default_webview_viewport_details();
|
||||||
self.constellation_proxy.send(ConstellationMsg::NewWebView(
|
self.constellation_proxy
|
||||||
url.into(),
|
.send(EmbedderToConstellationMessage::NewWebView(
|
||||||
webview.id(),
|
url.into(),
|
||||||
viewport_details,
|
webview.id(),
|
||||||
));
|
viewport_details,
|
||||||
|
));
|
||||||
webview
|
webview
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1048,7 +1050,7 @@ fn create_constellation(
|
||||||
#[cfg(feature = "webgpu")] wgpu_image_map: WGPUImageMap,
|
#[cfg(feature = "webgpu")] wgpu_image_map: WGPUImageMap,
|
||||||
protocols: ProtocolRegistry,
|
protocols: ProtocolRegistry,
|
||||||
user_content_manager: UserContentManager,
|
user_content_manager: UserContentManager,
|
||||||
) -> Sender<ConstellationMsg> {
|
) -> Sender<EmbedderToConstellationMessage> {
|
||||||
// Global configuration options, parsed from the command line.
|
// Global configuration options, parsed from the command line.
|
||||||
let opts = opts::get();
|
let opts = opts::get();
|
||||||
|
|
||||||
|
|
|
@ -5,18 +5,18 @@
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
|
||||||
use constellation_traits::ConstellationMsg;
|
use constellation_traits::EmbedderToConstellationMessage;
|
||||||
use crossbeam_channel::{SendError, Sender};
|
use crossbeam_channel::{SendError, Sender};
|
||||||
use log::warn;
|
use log::warn;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub(crate) struct ConstellationProxy {
|
pub(crate) struct ConstellationProxy {
|
||||||
sender: Sender<ConstellationMsg>,
|
sender: Sender<EmbedderToConstellationMessage>,
|
||||||
disconnected: Arc<AtomicBool>,
|
disconnected: Arc<AtomicBool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConstellationProxy {
|
impl ConstellationProxy {
|
||||||
pub fn new(sender: Sender<ConstellationMsg>) -> Self {
|
pub fn new(sender: Sender<EmbedderToConstellationMessage>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
sender,
|
sender,
|
||||||
disconnected: Arc::default(),
|
disconnected: Arc::default(),
|
||||||
|
@ -27,13 +27,16 @@ impl ConstellationProxy {
|
||||||
self.disconnected.load(Ordering::SeqCst)
|
self.disconnected.load(Ordering::SeqCst)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send(&self, msg: ConstellationMsg) {
|
pub fn send(&self, msg: EmbedderToConstellationMessage) {
|
||||||
if self.try_send(msg).is_err() {
|
if self.try_send(msg).is_err() {
|
||||||
warn!("Lost connection to Constellation. Will report to embedder.")
|
warn!("Lost connection to Constellation. Will report to embedder.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_send(&self, msg: ConstellationMsg) -> Result<(), SendError<ConstellationMsg>> {
|
fn try_send(
|
||||||
|
&self,
|
||||||
|
msg: EmbedderToConstellationMessage,
|
||||||
|
) -> Result<(), SendError<EmbedderToConstellationMessage>> {
|
||||||
if self.disconnected() {
|
if self.disconnected() {
|
||||||
return Err(SendError(msg));
|
return Err(SendError(msg));
|
||||||
}
|
}
|
||||||
|
@ -45,7 +48,7 @@ impl ConstellationProxy {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sender(&self) -> Sender<ConstellationMsg> {
|
pub fn sender(&self) -> Sender<EmbedderToConstellationMessage> {
|
||||||
self.sender.clone()
|
self.sender.clone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ use std::time::Duration;
|
||||||
use base::id::WebViewId;
|
use base::id::WebViewId;
|
||||||
use compositing::IOCompositor;
|
use compositing::IOCompositor;
|
||||||
use compositing::windowing::WebRenderDebugOption;
|
use compositing::windowing::WebRenderDebugOption;
|
||||||
use constellation_traits::{ConstellationMsg, TraversalDirection};
|
use constellation_traits::{EmbedderToConstellationMessage, TraversalDirection};
|
||||||
use dpi::PhysicalSize;
|
use dpi::PhysicalSize;
|
||||||
use embedder_traits::{
|
use embedder_traits::{
|
||||||
Cursor, InputEvent, LoadStatus, MediaSessionActionType, ScreenGeometry, Theme, TouchEventType,
|
Cursor, InputEvent, LoadStatus, MediaSessionActionType, ScreenGeometry, Theme, TouchEventType,
|
||||||
|
@ -87,7 +87,7 @@ pub(crate) struct WebViewInner {
|
||||||
impl Drop for WebViewInner {
|
impl Drop for WebViewInner {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
self.constellation_proxy
|
self.constellation_proxy
|
||||||
.send(ConstellationMsg::CloseWebView(self.id));
|
.send(EmbedderToConstellationMessage::CloseWebView(self.id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,13 +256,13 @@ impl WebView {
|
||||||
pub fn focus(&self) {
|
pub fn focus(&self) {
|
||||||
self.inner()
|
self.inner()
|
||||||
.constellation_proxy
|
.constellation_proxy
|
||||||
.send(ConstellationMsg::FocusWebView(self.id()));
|
.send(EmbedderToConstellationMessage::FocusWebView(self.id()));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn blur(&self) {
|
pub fn blur(&self) {
|
||||||
self.inner()
|
self.inner()
|
||||||
.constellation_proxy
|
.constellation_proxy
|
||||||
.send(ConstellationMsg::BlurWebView);
|
.send(EmbedderToConstellationMessage::BlurWebView);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn rect(&self) -> DeviceRect {
|
pub fn rect(&self) -> DeviceRect {
|
||||||
|
@ -308,25 +308,28 @@ impl WebView {
|
||||||
pub fn notify_theme_change(&self, theme: Theme) {
|
pub fn notify_theme_change(&self, theme: Theme) {
|
||||||
self.inner()
|
self.inner()
|
||||||
.constellation_proxy
|
.constellation_proxy
|
||||||
.send(ConstellationMsg::ThemeChange(theme))
|
.send(EmbedderToConstellationMessage::ThemeChange(theme))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn load(&self, url: Url) {
|
pub fn load(&self, url: Url) {
|
||||||
self.inner()
|
self.inner()
|
||||||
.constellation_proxy
|
.constellation_proxy
|
||||||
.send(ConstellationMsg::LoadUrl(self.id(), url.into()))
|
.send(EmbedderToConstellationMessage::LoadUrl(
|
||||||
|
self.id(),
|
||||||
|
url.into(),
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reload(&self) {
|
pub fn reload(&self) {
|
||||||
self.inner()
|
self.inner()
|
||||||
.constellation_proxy
|
.constellation_proxy
|
||||||
.send(ConstellationMsg::Reload(self.id()))
|
.send(EmbedderToConstellationMessage::Reload(self.id()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn go_back(&self, amount: usize) {
|
pub fn go_back(&self, amount: usize) {
|
||||||
self.inner()
|
self.inner()
|
||||||
.constellation_proxy
|
.constellation_proxy
|
||||||
.send(ConstellationMsg::TraverseHistory(
|
.send(EmbedderToConstellationMessage::TraverseHistory(
|
||||||
self.id(),
|
self.id(),
|
||||||
TraversalDirection::Back(amount),
|
TraversalDirection::Back(amount),
|
||||||
))
|
))
|
||||||
|
@ -335,7 +338,7 @@ impl WebView {
|
||||||
pub fn go_forward(&self, amount: usize) {
|
pub fn go_forward(&self, amount: usize) {
|
||||||
self.inner()
|
self.inner()
|
||||||
.constellation_proxy
|
.constellation_proxy
|
||||||
.send(ConstellationMsg::TraverseHistory(
|
.send(EmbedderToConstellationMessage::TraverseHistory(
|
||||||
self.id(),
|
self.id(),
|
||||||
TraversalDirection::Forward(amount),
|
TraversalDirection::Forward(amount),
|
||||||
))
|
))
|
||||||
|
@ -367,7 +370,7 @@ impl WebView {
|
||||||
|
|
||||||
self.inner()
|
self.inner()
|
||||||
.constellation_proxy
|
.constellation_proxy
|
||||||
.send(ConstellationMsg::ForwardInputEvent(
|
.send(EmbedderToConstellationMessage::ForwardInputEvent(
|
||||||
self.id(),
|
self.id(),
|
||||||
event,
|
event,
|
||||||
None, /* hit_test */
|
None, /* hit_test */
|
||||||
|
@ -377,7 +380,7 @@ impl WebView {
|
||||||
pub fn notify_media_session_action_event(&self, event: MediaSessionActionType) {
|
pub fn notify_media_session_action_event(&self, event: MediaSessionActionType) {
|
||||||
self.inner()
|
self.inner()
|
||||||
.constellation_proxy
|
.constellation_proxy
|
||||||
.send(ConstellationMsg::MediaSessionAction(event));
|
.send(EmbedderToConstellationMessage::MediaSessionAction(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn notify_vsync(&self) {
|
pub fn notify_vsync(&self) {
|
||||||
|
@ -415,13 +418,16 @@ impl WebView {
|
||||||
pub fn exit_fullscreen(&self) {
|
pub fn exit_fullscreen(&self) {
|
||||||
self.inner()
|
self.inner()
|
||||||
.constellation_proxy
|
.constellation_proxy
|
||||||
.send(ConstellationMsg::ExitFullScreen(self.id()));
|
.send(EmbedderToConstellationMessage::ExitFullScreen(self.id()));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_throttled(&self, throttled: bool) {
|
pub fn set_throttled(&self, throttled: bool) {
|
||||||
self.inner()
|
self.inner()
|
||||||
.constellation_proxy
|
.constellation_proxy
|
||||||
.send(ConstellationMsg::SetWebViewThrottled(self.id(), throttled));
|
.send(EmbedderToConstellationMessage::SetWebViewThrottled(
|
||||||
|
self.id(),
|
||||||
|
throttled,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn toggle_webrender_debugging(&self, debugging: WebRenderDebugOption) {
|
pub fn toggle_webrender_debugging(&self, debugging: WebRenderDebugOption) {
|
||||||
|
@ -438,13 +444,19 @@ impl WebView {
|
||||||
pub fn toggle_sampling_profiler(&self, rate: Duration, max_duration: Duration) {
|
pub fn toggle_sampling_profiler(&self, rate: Duration, max_duration: Duration) {
|
||||||
self.inner()
|
self.inner()
|
||||||
.constellation_proxy
|
.constellation_proxy
|
||||||
.send(ConstellationMsg::ToggleProfiler(rate, max_duration));
|
.send(EmbedderToConstellationMessage::ToggleProfiler(
|
||||||
|
rate,
|
||||||
|
max_duration,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_error(&self, message: String) {
|
pub fn send_error(&self, message: String) {
|
||||||
self.inner()
|
self.inner()
|
||||||
.constellation_proxy
|
.constellation_proxy
|
||||||
.send(ConstellationMsg::SendError(Some(self.id()), message));
|
.send(EmbedderToConstellationMessage::SendError(
|
||||||
|
Some(self.id()),
|
||||||
|
message,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Paint the contents of this [`WebView`] into its `RenderingContext`. This will
|
/// Paint the contents of this [`WebView`] into its `RenderingContext`. This will
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use base::id::PipelineId;
|
use base::id::PipelineId;
|
||||||
use constellation_traits::ConstellationMsg;
|
use constellation_traits::EmbedderToConstellationMessage;
|
||||||
use embedder_traits::{
|
use embedder_traits::{
|
||||||
AllowOrDeny, AuthenticationResponse, ContextMenuResult, Cursor, FilterPattern,
|
AllowOrDeny, AuthenticationResponse, ContextMenuResult, Cursor, FilterPattern,
|
||||||
GamepadHapticEffectType, InputMethodType, LoadStatus, MediaSessionEvent, Notification,
|
GamepadHapticEffectType, InputMethodType, LoadStatus, MediaSessionEvent, Notification,
|
||||||
|
@ -33,7 +33,7 @@ pub struct NavigationRequest {
|
||||||
impl NavigationRequest {
|
impl NavigationRequest {
|
||||||
pub fn allow(mut self) {
|
pub fn allow(mut self) {
|
||||||
self.constellation_proxy
|
self.constellation_proxy
|
||||||
.send(ConstellationMsg::AllowNavigationResponse(
|
.send(EmbedderToConstellationMessage::AllowNavigationResponse(
|
||||||
self.pipeline_id,
|
self.pipeline_id,
|
||||||
true,
|
true,
|
||||||
));
|
));
|
||||||
|
@ -42,7 +42,7 @@ impl NavigationRequest {
|
||||||
|
|
||||||
pub fn deny(mut self) {
|
pub fn deny(mut self) {
|
||||||
self.constellation_proxy
|
self.constellation_proxy
|
||||||
.send(ConstellationMsg::AllowNavigationResponse(
|
.send(EmbedderToConstellationMessage::AllowNavigationResponse(
|
||||||
self.pipeline_id,
|
self.pipeline_id,
|
||||||
false,
|
false,
|
||||||
));
|
));
|
||||||
|
@ -54,7 +54,7 @@ impl Drop for NavigationRequest {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if !self.response_sent {
|
if !self.response_sent {
|
||||||
self.constellation_proxy
|
self.constellation_proxy
|
||||||
.send(ConstellationMsg::AllowNavigationResponse(
|
.send(EmbedderToConstellationMessage::AllowNavigationResponse(
|
||||||
self.pipeline_id,
|
self.pipeline_id,
|
||||||
true,
|
true,
|
||||||
));
|
));
|
||||||
|
|
|
@ -30,9 +30,10 @@ use strum_macros::IntoStaticStr;
|
||||||
use webrender_api::ExternalScrollId;
|
use webrender_api::ExternalScrollId;
|
||||||
use webrender_api::units::LayoutPixel;
|
use webrender_api::units::LayoutPixel;
|
||||||
|
|
||||||
/// Messages to the constellation.
|
/// Messages to the Constellation from the embedding layer, whether from `ServoRenderer` or
|
||||||
|
/// from `libservo` itself.
|
||||||
#[derive(IntoStaticStr)]
|
#[derive(IntoStaticStr)]
|
||||||
pub enum ConstellationMsg {
|
pub enum EmbedderToConstellationMessage {
|
||||||
/// Exit the constellation.
|
/// Exit the constellation.
|
||||||
Exit,
|
Exit,
|
||||||
/// Request that the constellation send the current focused top-level browsing context id,
|
/// Request that the constellation send the current focused top-level browsing context id,
|
||||||
|
@ -96,7 +97,7 @@ pub enum PaintMetricEvent {
|
||||||
FirstContentfulPaint(CrossProcessInstant, bool /* first_reflow */),
|
FirstContentfulPaint(CrossProcessInstant, bool /* first_reflow */),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for ConstellationMsg {
|
impl fmt::Debug for EmbedderToConstellationMessage {
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let variant_string: &'static str = self.into();
|
let variant_string: &'static str = self.into();
|
||||||
write!(formatter, "ConstellationMsg::{variant_string}")
|
write!(formatter, "ConstellationMsg::{variant_string}")
|
||||||
|
|
|
@ -62,7 +62,8 @@ use webrender_traits::CrossProcessCompositorApi;
|
||||||
|
|
||||||
pub use crate::script_msg::{
|
pub use crate::script_msg::{
|
||||||
DOMMessage, IFrameSizeMsg, Job, JobError, JobResult, JobResultValue, JobType, SWManagerMsg,
|
DOMMessage, IFrameSizeMsg, Job, JobError, JobResult, JobResultValue, JobType, SWManagerMsg,
|
||||||
SWManagerSenders, ScopeThings, ScriptMsg, ServiceWorkerMsg, TouchEventResult,
|
SWManagerSenders, ScopeThings, ScriptToConstellationMessage, ServiceWorkerMsg,
|
||||||
|
TouchEventResult,
|
||||||
};
|
};
|
||||||
use crate::serializable::{BlobImpl, DomPoint};
|
use crate::serializable::{BlobImpl, DomPoint};
|
||||||
use crate::transferable::MessagePortImpl;
|
use crate::transferable::MessagePortImpl;
|
||||||
|
@ -634,14 +635,14 @@ pub struct DrawAPaintImageResult {
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct ScriptToConstellationChan {
|
pub struct ScriptToConstellationChan {
|
||||||
/// Sender for communicating with constellation thread.
|
/// Sender for communicating with constellation thread.
|
||||||
pub sender: IpcSender<(PipelineId, ScriptMsg)>,
|
pub sender: IpcSender<(PipelineId, ScriptToConstellationMessage)>,
|
||||||
/// Used to identify the origin of the message.
|
/// Used to identify the origin of the message.
|
||||||
pub pipeline_id: PipelineId,
|
pub pipeline_id: PipelineId,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ScriptToConstellationChan {
|
impl ScriptToConstellationChan {
|
||||||
/// Send ScriptMsg and attach the pipeline_id to the message.
|
/// Send ScriptMsg and attach the pipeline_id to the message.
|
||||||
pub fn send(&self, msg: ScriptMsg) -> Result<(), IpcError> {
|
pub fn send(&self, msg: ScriptToConstellationMessage) -> Result<(), IpcError> {
|
||||||
self.sender.send((self.pipeline_id, msg))
|
self.sender.send((self.pipeline_id, msg))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,9 +54,9 @@ pub enum TouchEventResult {
|
||||||
DefaultPrevented(TouchSequenceId, TouchEventType),
|
DefaultPrevented(TouchSequenceId, TouchEventType),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Messages from the script to the constellation.
|
/// Messages sent from the `ScriptThread` to the `Constellation`.
|
||||||
#[derive(Deserialize, IntoStaticStr, Serialize)]
|
#[derive(Deserialize, IntoStaticStr, Serialize)]
|
||||||
pub enum ScriptMsg {
|
pub enum ScriptToConstellationMessage {
|
||||||
/// Request to complete the transfer of a set of ports to a router.
|
/// Request to complete the transfer of a set of ports to a router.
|
||||||
CompleteMessagePortTransfer(MessagePortRouterId, Vec<MessagePortId>),
|
CompleteMessagePortTransfer(MessagePortRouterId, Vec<MessagePortId>),
|
||||||
/// The results of attempting to complete the transfer of a batch of ports.
|
/// The results of attempting to complete the transfer of a batch of ports.
|
||||||
|
@ -219,7 +219,7 @@ pub enum ScriptMsg {
|
||||||
ReportMemory(IpcSender<MemoryReportResult>),
|
ReportMemory(IpcSender<MemoryReportResult>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for ScriptMsg {
|
impl fmt::Debug for ScriptToConstellationMessage {
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let variant_string: &'static str = self.into();
|
let variant_string: &'static str = self.into();
|
||||||
write!(formatter, "ScriptMsg::{variant_string}")
|
write!(formatter, "ScriptMsg::{variant_string}")
|
||||||
|
|
|
@ -6,7 +6,7 @@ use std::collections::HashSet;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use std::{cmp, thread};
|
use std::{cmp, thread};
|
||||||
|
|
||||||
use constellation_traits::ConstellationMsg;
|
use constellation_traits::EmbedderToConstellationMessage;
|
||||||
use embedder_traits::{MouseButtonAction, WebDriverCommandMsg, WebDriverScriptCommand};
|
use embedder_traits::{MouseButtonAction, WebDriverCommandMsg, WebDriverScriptCommand};
|
||||||
use ipc_channel::ipc;
|
use ipc_channel::ipc;
|
||||||
use keyboard_types::webdriver::KeyInputState;
|
use keyboard_types::webdriver::KeyInputState;
|
||||||
|
@ -206,7 +206,7 @@ impl Handler {
|
||||||
let cmd_msg =
|
let cmd_msg =
|
||||||
WebDriverCommandMsg::KeyboardAction(session.browsing_context_id, keyboard_event);
|
WebDriverCommandMsg::KeyboardAction(session.browsing_context_id, keyboard_event);
|
||||||
self.constellation_chan
|
self.constellation_chan
|
||||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ impl Handler {
|
||||||
let cmd_msg =
|
let cmd_msg =
|
||||||
WebDriverCommandMsg::KeyboardAction(session.browsing_context_id, keyboard_event);
|
WebDriverCommandMsg::KeyboardAction(session.browsing_context_id, keyboard_event);
|
||||||
self.constellation_chan
|
self.constellation_chan
|
||||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ impl Handler {
|
||||||
pointer_input_state.y as f32,
|
pointer_input_state.y as f32,
|
||||||
);
|
);
|
||||||
self.constellation_chan
|
self.constellation_chan
|
||||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ impl Handler {
|
||||||
pointer_input_state.y as f32,
|
pointer_input_state.y as f32,
|
||||||
);
|
);
|
||||||
self.constellation_chan
|
self.constellation_chan
|
||||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ impl Handler {
|
||||||
let cmd_msg =
|
let cmd_msg =
|
||||||
WebDriverCommandMsg::GetWindowSize(self.session.as_ref().unwrap().webview_id, sender);
|
WebDriverCommandMsg::GetWindowSize(self.session.as_ref().unwrap().webview_id, sender);
|
||||||
self.constellation_chan
|
self.constellation_chan
|
||||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Steps 7 - 8
|
// Steps 7 - 8
|
||||||
|
@ -468,7 +468,7 @@ impl Handler {
|
||||||
let cmd_msg =
|
let cmd_msg =
|
||||||
WebDriverCommandMsg::MouseMoveAction(session.webview_id, x as f32, y as f32);
|
WebDriverCommandMsg::MouseMoveAction(session.webview_id, x as f32, y as f32);
|
||||||
self.constellation_chan
|
self.constellation_chan
|
||||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
// Step 7.3
|
// Step 7.3
|
||||||
pointer_input_state.x = x;
|
pointer_input_state.x = x;
|
||||||
|
|
|
@ -19,7 +19,7 @@ use std::{env, fmt, mem, process, thread};
|
||||||
use base::id::{BrowsingContextId, WebViewId};
|
use base::id::{BrowsingContextId, WebViewId};
|
||||||
use base64::Engine;
|
use base64::Engine;
|
||||||
use capabilities::ServoCapabilities;
|
use capabilities::ServoCapabilities;
|
||||||
use constellation_traits::{ConstellationMsg, TraversalDirection};
|
use constellation_traits::{EmbedderToConstellationMessage, TraversalDirection};
|
||||||
use cookie::{CookieBuilder, Expiration};
|
use cookie::{CookieBuilder, Expiration};
|
||||||
use crossbeam_channel::{Receiver, Sender, after, select, unbounded};
|
use crossbeam_channel::{Receiver, Sender, after, select, unbounded};
|
||||||
use embedder_traits::{
|
use embedder_traits::{
|
||||||
|
@ -100,7 +100,7 @@ fn cookie_msg_to_cookie(cookie: cookie::Cookie) -> Cookie {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn start_server(port: u16, constellation_chan: Sender<ConstellationMsg>) {
|
pub fn start_server(port: u16, constellation_chan: Sender<EmbedderToConstellationMessage>) {
|
||||||
let handler = Handler::new(constellation_chan);
|
let handler = Handler::new(constellation_chan);
|
||||||
thread::Builder::new()
|
thread::Builder::new()
|
||||||
.name("WebDriverHttpServer".to_owned())
|
.name("WebDriverHttpServer".to_owned())
|
||||||
|
@ -188,7 +188,7 @@ struct Handler {
|
||||||
/// will be forwarded to the load_status_receiver.
|
/// will be forwarded to the load_status_receiver.
|
||||||
load_status_sender: IpcSender<WebDriverLoadStatus>,
|
load_status_sender: IpcSender<WebDriverLoadStatus>,
|
||||||
session: Option<WebDriverSession>,
|
session: Option<WebDriverSession>,
|
||||||
constellation_chan: Sender<ConstellationMsg>,
|
constellation_chan: Sender<EmbedderToConstellationMessage>,
|
||||||
resize_timeout: u32,
|
resize_timeout: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ impl<'de> Visitor<'de> for TupleVecMapVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Handler {
|
impl Handler {
|
||||||
pub fn new(constellation_chan: Sender<ConstellationMsg>) -> Handler {
|
pub fn new(constellation_chan: Sender<EmbedderToConstellationMessage>) -> Handler {
|
||||||
// Create a pair of both an IPC and a threaded channel,
|
// Create a pair of both an IPC and a threaded channel,
|
||||||
// keep the IPC sender to clone and pass to the constellation for each load,
|
// keep the IPC sender to clone and pass to the constellation for each load,
|
||||||
// and keep a threaded receiver to block on an incoming load-status.
|
// and keep a threaded receiver to block on an incoming load-status.
|
||||||
|
@ -425,7 +425,8 @@ impl Handler {
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
|
|
||||||
for _ in 0..iterations {
|
for _ in 0..iterations {
|
||||||
let msg = ConstellationMsg::GetFocusTopLevelBrowsingContext(sender.clone());
|
let msg =
|
||||||
|
EmbedderToConstellationMessage::GetFocusTopLevelBrowsingContext(sender.clone());
|
||||||
self.constellation_chan.send(msg).unwrap();
|
self.constellation_chan.send(msg).unwrap();
|
||||||
// Wait until the document is ready before returning the top-level browsing context id.
|
// Wait until the document is ready before returning the top-level browsing context id.
|
||||||
if let Some(x) = receiver.recv().unwrap() {
|
if let Some(x) = receiver.recv().unwrap() {
|
||||||
|
@ -622,20 +623,18 @@ impl Handler {
|
||||||
cmd_msg: WebDriverScriptCommand,
|
cmd_msg: WebDriverScriptCommand,
|
||||||
) -> WebDriverResult<()> {
|
) -> WebDriverResult<()> {
|
||||||
let browsing_context_id = self.session()?.browsing_context_id;
|
let browsing_context_id = self.session()?.browsing_context_id;
|
||||||
let msg = ConstellationMsg::WebDriverCommand(WebDriverCommandMsg::ScriptCommand(
|
let msg = EmbedderToConstellationMessage::WebDriverCommand(
|
||||||
browsing_context_id,
|
WebDriverCommandMsg::ScriptCommand(browsing_context_id, cmd_msg),
|
||||||
cmd_msg,
|
);
|
||||||
));
|
|
||||||
self.constellation_chan.send(msg).unwrap();
|
self.constellation_chan.send(msg).unwrap();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn top_level_script_command(&self, cmd_msg: WebDriverScriptCommand) -> WebDriverResult<()> {
|
fn top_level_script_command(&self, cmd_msg: WebDriverScriptCommand) -> WebDriverResult<()> {
|
||||||
let browsing_context_id = BrowsingContextId::from(self.session()?.webview_id);
|
let browsing_context_id = BrowsingContextId::from(self.session()?.webview_id);
|
||||||
let msg = ConstellationMsg::WebDriverCommand(WebDriverCommandMsg::ScriptCommand(
|
let msg = EmbedderToConstellationMessage::WebDriverCommand(
|
||||||
browsing_context_id,
|
WebDriverCommandMsg::ScriptCommand(browsing_context_id, cmd_msg),
|
||||||
cmd_msg,
|
);
|
||||||
));
|
|
||||||
self.constellation_chan.send(msg).unwrap();
|
self.constellation_chan.send(msg).unwrap();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -656,7 +655,7 @@ impl Handler {
|
||||||
let cmd_msg =
|
let cmd_msg =
|
||||||
WebDriverCommandMsg::LoadUrl(webview_id, url, self.load_status_sender.clone());
|
WebDriverCommandMsg::LoadUrl(webview_id, url, self.load_status_sender.clone());
|
||||||
self.constellation_chan
|
self.constellation_chan
|
||||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
self.wait_for_load()
|
self.wait_for_load()
|
||||||
|
@ -692,7 +691,7 @@ impl Handler {
|
||||||
let cmd_msg = WebDriverCommandMsg::GetWindowSize(webview_id, sender);
|
let cmd_msg = WebDriverCommandMsg::GetWindowSize(webview_id, sender);
|
||||||
|
|
||||||
self.constellation_chan
|
self.constellation_chan
|
||||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let window_size = receiver.recv().unwrap();
|
let window_size = receiver.recv().unwrap();
|
||||||
|
@ -724,7 +723,7 @@ impl Handler {
|
||||||
let cmd_msg = WebDriverCommandMsg::SetWindowSize(webview_id, size.to_i32(), sender.clone());
|
let cmd_msg = WebDriverCommandMsg::SetWindowSize(webview_id, size.to_i32(), sender.clone());
|
||||||
|
|
||||||
self.constellation_chan
|
self.constellation_chan
|
||||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let timeout = self.resize_timeout;
|
let timeout = self.resize_timeout;
|
||||||
|
@ -735,7 +734,7 @@ impl Handler {
|
||||||
thread::sleep(Duration::from_millis(timeout as u64));
|
thread::sleep(Duration::from_millis(timeout as u64));
|
||||||
let cmd_msg = WebDriverCommandMsg::GetWindowSize(webview_id, sender);
|
let cmd_msg = WebDriverCommandMsg::GetWindowSize(webview_id, sender);
|
||||||
constellation_chan
|
constellation_chan
|
||||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -784,7 +783,7 @@ impl Handler {
|
||||||
fn handle_go_back(&self) -> WebDriverResult<WebDriverResponse> {
|
fn handle_go_back(&self) -> WebDriverResult<WebDriverResponse> {
|
||||||
let webview_id = self.session()?.webview_id;
|
let webview_id = self.session()?.webview_id;
|
||||||
let direction = TraversalDirection::Back(1);
|
let direction = TraversalDirection::Back(1);
|
||||||
let msg = ConstellationMsg::TraverseHistory(webview_id, direction);
|
let msg = EmbedderToConstellationMessage::TraverseHistory(webview_id, direction);
|
||||||
self.constellation_chan.send(msg).unwrap();
|
self.constellation_chan.send(msg).unwrap();
|
||||||
Ok(WebDriverResponse::Void)
|
Ok(WebDriverResponse::Void)
|
||||||
}
|
}
|
||||||
|
@ -792,7 +791,7 @@ impl Handler {
|
||||||
fn handle_go_forward(&self) -> WebDriverResult<WebDriverResponse> {
|
fn handle_go_forward(&self) -> WebDriverResult<WebDriverResponse> {
|
||||||
let webview_id = self.session()?.webview_id;
|
let webview_id = self.session()?.webview_id;
|
||||||
let direction = TraversalDirection::Forward(1);
|
let direction = TraversalDirection::Forward(1);
|
||||||
let msg = ConstellationMsg::TraverseHistory(webview_id, direction);
|
let msg = EmbedderToConstellationMessage::TraverseHistory(webview_id, direction);
|
||||||
self.constellation_chan.send(msg).unwrap();
|
self.constellation_chan.send(msg).unwrap();
|
||||||
Ok(WebDriverResponse::Void)
|
Ok(WebDriverResponse::Void)
|
||||||
}
|
}
|
||||||
|
@ -802,7 +801,7 @@ impl Handler {
|
||||||
|
|
||||||
let cmd_msg = WebDriverCommandMsg::Refresh(webview_id, self.load_status_sender.clone());
|
let cmd_msg = WebDriverCommandMsg::Refresh(webview_id, self.load_status_sender.clone());
|
||||||
self.constellation_chan
|
self.constellation_chan
|
||||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
self.wait_for_load()
|
self.wait_for_load()
|
||||||
|
@ -892,7 +891,7 @@ impl Handler {
|
||||||
session.window_handles.remove(&session.webview_id);
|
session.window_handles.remove(&session.webview_id);
|
||||||
let cmd_msg = WebDriverCommandMsg::CloseWebView(session.webview_id);
|
let cmd_msg = WebDriverCommandMsg::CloseWebView(session.webview_id);
|
||||||
self.constellation_chan
|
self.constellation_chan
|
||||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -919,7 +918,7 @@ impl Handler {
|
||||||
self.load_status_sender.clone(),
|
self.load_status_sender.clone(),
|
||||||
);
|
);
|
||||||
self.constellation_chan
|
self.constellation_chan
|
||||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut handle = self.session.as_ref().unwrap().id.to_string();
|
let mut handle = self.session.as_ref().unwrap().id.to_string();
|
||||||
|
@ -980,7 +979,7 @@ impl Handler {
|
||||||
session.webview_id = webview_id;
|
session.webview_id = webview_id;
|
||||||
session.browsing_context_id = BrowsingContextId::from(webview_id);
|
session.browsing_context_id = BrowsingContextId::from(webview_id);
|
||||||
|
|
||||||
let msg = ConstellationMsg::FocusWebView(webview_id);
|
let msg = EmbedderToConstellationMessage::FocusWebView(webview_id);
|
||||||
self.constellation_chan.send(msg).unwrap();
|
self.constellation_chan.send(msg).unwrap();
|
||||||
Ok(WebDriverResponse::Void)
|
Ok(WebDriverResponse::Void)
|
||||||
} else {
|
} else {
|
||||||
|
@ -1558,7 +1557,7 @@ impl Handler {
|
||||||
let cmd = WebDriverScriptCommand::FocusElement(element.to_string(), sender);
|
let cmd = WebDriverScriptCommand::FocusElement(element.to_string(), sender);
|
||||||
let cmd_msg = WebDriverCommandMsg::ScriptCommand(browsing_context_id, cmd);
|
let cmd_msg = WebDriverCommandMsg::ScriptCommand(browsing_context_id, cmd);
|
||||||
self.constellation_chan
|
self.constellation_chan
|
||||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// TODO: distinguish the not found and not focusable cases
|
// TODO: distinguish the not found and not focusable cases
|
||||||
|
@ -1574,7 +1573,7 @@ impl Handler {
|
||||||
// so the constellation may have changed state between them.
|
// so the constellation may have changed state between them.
|
||||||
let cmd_msg = WebDriverCommandMsg::SendKeys(browsing_context_id, input_events);
|
let cmd_msg = WebDriverCommandMsg::SendKeys(browsing_context_id, input_events);
|
||||||
self.constellation_chan
|
self.constellation_chan
|
||||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
Ok(WebDriverResponse::Void)
|
Ok(WebDriverResponse::Void)
|
||||||
|
@ -1658,7 +1657,7 @@ impl Handler {
|
||||||
let cmd_msg =
|
let cmd_msg =
|
||||||
WebDriverCommandMsg::TakeScreenshot(self.session()?.webview_id, rect, sender);
|
WebDriverCommandMsg::TakeScreenshot(self.session()?.webview_id, rect, sender);
|
||||||
self.constellation_chan
|
self.constellation_chan
|
||||||
.send(ConstellationMsg::WebDriverCommand(cmd_msg))
|
.send(EmbedderToConstellationMessage::WebDriverCommand(cmd_msg))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
if let Some(x) = receiver.recv().unwrap() {
|
if let Some(x) = receiver.recv().unwrap() {
|
||||||
|
|
|
@ -88,7 +88,7 @@ pub fn init_tracing(filter_directives: Option<&str>) {
|
||||||
let subscriber = subscriber.with(filter);
|
let subscriber = subscriber.with(filter);
|
||||||
|
|
||||||
// Same as SubscriberInitExt::init, but avoids initialising the tracing-log compat layer,
|
// Same as SubscriberInitExt::init, but avoids initialising the tracing-log compat layer,
|
||||||
// since it would break Servo’s FromScriptLogger and FromCompositorLogger.
|
// since it would break Servo’s FromScriptLogger and FromEmbederLogger.
|
||||||
// <https://docs.rs/tracing-subscriber/0.3.18/tracing_subscriber/util/trait.SubscriberInitExt.html#method.init>
|
// <https://docs.rs/tracing-subscriber/0.3.18/tracing_subscriber/util/trait.SubscriberInitExt.html#method.init>
|
||||||
// <https://docs.rs/tracing/0.1.40/tracing/#consuming-log-records>
|
// <https://docs.rs/tracing/0.1.40/tracing/#consuming-log-records>
|
||||||
tracing::subscriber::set_global_default(subscriber)
|
tracing::subscriber::set_global_default(subscriber)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue