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