mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
make use of ScriptToConstellationChan
This commit is contained in:
parent
817de15735
commit
d241389129
24 changed files with 285 additions and 280 deletions
|
@ -105,7 +105,7 @@ use script_traits::{ConstellationControlMsg, ConstellationMsg as FromCompositorM
|
||||||
use script_traits::{DocumentActivity, DocumentState, LayoutControlMsg, LoadData};
|
use script_traits::{DocumentActivity, DocumentState, LayoutControlMsg, LoadData};
|
||||||
use script_traits::{IFrameLoadInfo, IFrameLoadInfoWithData, IFrameSandboxState, TimerSchedulerMsg};
|
use script_traits::{IFrameLoadInfo, IFrameLoadInfoWithData, IFrameSandboxState, TimerSchedulerMsg};
|
||||||
use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptThreadFactory};
|
use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptThreadFactory};
|
||||||
use script_traits::{LogEntry, ServiceWorkerMsg, webdriver_msg};
|
use script_traits::{LogEntry, ScriptToConstellationChan, ServiceWorkerMsg, webdriver_msg};
|
||||||
use script_traits::{MozBrowserErrorType, MozBrowserEvent, WebDriverCommandMsg, WindowSizeData};
|
use script_traits::{MozBrowserErrorType, MozBrowserEvent, WebDriverCommandMsg, WindowSizeData};
|
||||||
use script_traits::{SWManagerMsg, ScopeThings, UpdatePipelineIdReason, WindowSizeType};
|
use script_traits::{SWManagerMsg, ScopeThings, UpdatePipelineIdReason, WindowSizeType};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -147,11 +147,11 @@ use webvr_traits::{WebVREvent, WebVRMsg};
|
||||||
pub struct Constellation<Message, LTF, STF> {
|
pub struct Constellation<Message, LTF, STF> {
|
||||||
/// An IPC channel for script threads to send messages to the constellation.
|
/// An IPC channel for script threads to send messages to the constellation.
|
||||||
/// This is the script threads' view of `script_receiver`.
|
/// This is the script threads' view of `script_receiver`.
|
||||||
script_sender: IpcSender<FromScriptMsg>,
|
script_sender: IpcSender<(PipelineId, FromScriptMsg)>,
|
||||||
|
|
||||||
/// A channel for the constellation to receive messages from script threads.
|
/// A channel for the constellation to receive messages from script threads.
|
||||||
/// This is the constellation's view of `script_sender`.
|
/// This is the constellation's view of `script_sender`.
|
||||||
script_receiver: Receiver<Result<FromScriptMsg, IpcError>>,
|
script_receiver: Receiver<Result<(PipelineId, FromScriptMsg), IpcError>>,
|
||||||
|
|
||||||
/// An IPC channel for layout threads to send messages to the constellation.
|
/// An IPC channel for layout threads to send messages to the constellation.
|
||||||
/// This is the layout threads' view of `layout_receiver`.
|
/// This is the layout threads' view of `layout_receiver`.
|
||||||
|
@ -385,14 +385,14 @@ enum ExitPipelineMode {
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct FromScriptLogger {
|
pub struct FromScriptLogger {
|
||||||
/// A channel to the constellation
|
/// A channel to the constellation
|
||||||
pub constellation_chan: Arc<ReentrantMutex<IpcSender<FromScriptMsg>>>,
|
pub script_to_constellation_chan: Arc<ReentrantMutex<ScriptToConstellationChan>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromScriptLogger {
|
impl FromScriptLogger {
|
||||||
/// Create a new constellation logger.
|
/// Create a new constellation logger.
|
||||||
pub fn new(constellation_chan: IpcSender<FromScriptMsg>) -> FromScriptLogger {
|
pub fn new(script_to_constellation_chan: ScriptToConstellationChan) -> FromScriptLogger {
|
||||||
FromScriptLogger {
|
FromScriptLogger {
|
||||||
constellation_chan: Arc::new(ReentrantMutex::new(constellation_chan))
|
script_to_constellation_chan: Arc::new(ReentrantMutex::new(script_to_constellation_chan))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,10 +410,9 @@ impl Log for FromScriptLogger {
|
||||||
fn log(&self, record: &LogRecord) {
|
fn log(&self, record: &LogRecord) {
|
||||||
if let Some(entry) = log_entry(record) {
|
if let Some(entry) = log_entry(record) {
|
||||||
debug!("Sending log entry {:?}.", entry);
|
debug!("Sending log entry {:?}.", entry);
|
||||||
let top_level_id = TopLevelBrowsingContextId::installed();
|
|
||||||
let thread_name = thread::current().name().map(ToOwned::to_owned);
|
let thread_name = thread::current().name().map(ToOwned::to_owned);
|
||||||
let msg = FromScriptMsg::LogEntry(top_level_id, thread_name, entry);
|
let msg = FromScriptMsg::LogEntry(thread_name, entry);
|
||||||
let chan = self.constellation_chan.lock().unwrap_or_else(|err| err.into_inner());
|
let chan = self.script_to_constellation_chan.lock().unwrap_or_else(|err| err.into_inner());
|
||||||
let _ = chan.send(msg);
|
let _ = chan.send(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -674,7 +673,10 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
browsing_context_id,
|
browsing_context_id,
|
||||||
top_level_browsing_context_id,
|
top_level_browsing_context_id,
|
||||||
parent_info,
|
parent_info,
|
||||||
constellation_chan: self.script_sender.clone(),
|
script_to_constellation_chan: ScriptToConstellationChan {
|
||||||
|
sender: self.script_sender.clone(),
|
||||||
|
pipeline_id: pipeline_id,
|
||||||
|
},
|
||||||
layout_to_constellation_chan: self.layout_sender.clone(),
|
layout_to_constellation_chan: self.layout_sender.clone(),
|
||||||
scheduler_chan: self.scheduler_chan.clone(),
|
scheduler_chan: self.scheduler_chan.clone(),
|
||||||
compositor_proxy: self.compositor_proxy.clone_compositor_proxy(),
|
compositor_proxy: self.compositor_proxy.clone_compositor_proxy(),
|
||||||
|
@ -816,7 +818,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn handle_request(&mut self) {
|
fn handle_request(&mut self) {
|
||||||
enum Request {
|
enum Request {
|
||||||
Script(FromScriptMsg),
|
Script((PipelineId, FromScriptMsg)),
|
||||||
Compositor(FromCompositorMsg),
|
Compositor(FromCompositorMsg),
|
||||||
Layout(FromLayoutMsg),
|
Layout(FromLayoutMsg),
|
||||||
NetworkListener((PipelineId, FetchResponseMsg)),
|
NetworkListener((PipelineId, FetchResponseMsg)),
|
||||||
|
@ -995,14 +997,26 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_request_from_script(&mut self, message: FromScriptMsg) {
|
fn handle_request_from_script(&mut self, message: (PipelineId, FromScriptMsg)) {
|
||||||
match message {
|
let (source_pipeline_id, content) = message;
|
||||||
FromScriptMsg::PipelineExited(pipeline_id) => {
|
let source_top_ctx_id = match self.pipelines.get(&source_pipeline_id)
|
||||||
self.handle_pipeline_exited(pipeline_id);
|
.map(|pipeline| pipeline.top_level_browsing_context_id) {
|
||||||
|
None => return warn!("ScriptMsg from closed pipeline {:?}.", source_pipeline_id),
|
||||||
|
Some(ctx) => ctx,
|
||||||
|
};
|
||||||
|
|
||||||
|
let source_is_top_level_pipeline = self.browsing_contexts
|
||||||
|
.get(&BrowsingContextId::from(source_top_ctx_id))
|
||||||
|
.map(|ctx| ctx.pipeline_id == source_pipeline_id)
|
||||||
|
.unwrap_or(false);
|
||||||
|
|
||||||
|
match content {
|
||||||
|
FromScriptMsg::PipelineExited => {
|
||||||
|
self.handle_pipeline_exited(source_pipeline_id);
|
||||||
}
|
}
|
||||||
FromScriptMsg::InitiateNavigateRequest(req_init, pipeline_id) => {
|
FromScriptMsg::InitiateNavigateRequest(req_init) => {
|
||||||
debug!("constellation got initiate navigate request message");
|
debug!("constellation got initiate navigate request message");
|
||||||
self.handle_navigate_request(req_init, pipeline_id);
|
self.handle_navigate_request(source_pipeline_id, req_init);
|
||||||
}
|
}
|
||||||
FromScriptMsg::ScriptLoadedURLInIFrame(load_info) => {
|
FromScriptMsg::ScriptLoadedURLInIFrame(load_info) => {
|
||||||
debug!("constellation got iframe URL load message {:?} {:?} {:?}",
|
debug!("constellation got iframe URL load message {:?} {:?} {:?}",
|
||||||
|
@ -1017,40 +1031,40 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
load_info.new_pipeline_id);
|
load_info.new_pipeline_id);
|
||||||
self.handle_script_new_iframe(load_info, layout_sender);
|
self.handle_script_new_iframe(load_info, layout_sender);
|
||||||
}
|
}
|
||||||
FromScriptMsg::ChangeRunningAnimationsState(pipeline_id, animation_state) => {
|
FromScriptMsg::ChangeRunningAnimationsState(animation_state) => {
|
||||||
self.handle_change_running_animations_state(pipeline_id, animation_state)
|
self.handle_change_running_animations_state(source_pipeline_id, animation_state)
|
||||||
}
|
}
|
||||||
// Load a new page from a mouse click
|
// Load a new page from a mouse click
|
||||||
// If there is already a pending page (self.pending_changes), it will not be overridden;
|
// If there is already a pending page (self.pending_changes), it will not be overridden;
|
||||||
// However, if the id is not encompassed by another change, it will be.
|
// However, if the id is not encompassed by another change, it will be.
|
||||||
FromScriptMsg::LoadUrl(source_id, load_data, replace) => {
|
FromScriptMsg::LoadUrl(load_data, replace) => {
|
||||||
debug!("constellation got URL load message from script");
|
debug!("constellation got URL load message from script");
|
||||||
self.handle_load_url_msg(source_id, load_data, replace);
|
self.handle_load_url_msg(source_top_ctx_id, source_pipeline_id, load_data, replace);
|
||||||
}
|
}
|
||||||
// A page loaded has completed all parsing, script, and reflow messages have been sent.
|
// A page loaded has completed all parsing, script, and reflow messages have been sent.
|
||||||
FromScriptMsg::LoadComplete(pipeline_id) => {
|
FromScriptMsg::LoadComplete => {
|
||||||
debug!("constellation got load complete message");
|
debug!("constellation got load complete message");
|
||||||
self.handle_load_complete_msg(pipeline_id)
|
self.handle_load_complete_msg(source_top_ctx_id, source_pipeline_id)
|
||||||
}
|
}
|
||||||
// Handle a forward or back request
|
// Handle a forward or back request
|
||||||
FromScriptMsg::TraverseHistory(top_level_browsing_context_id, direction) => {
|
FromScriptMsg::TraverseHistory(direction) => {
|
||||||
debug!("constellation got traverse history message from script");
|
debug!("constellation got traverse history message from script");
|
||||||
self.handle_traverse_history_msg(top_level_browsing_context_id, direction);
|
self.handle_traverse_history_msg(source_top_ctx_id, direction);
|
||||||
}
|
}
|
||||||
// Handle a joint session history length request.
|
// Handle a joint session history length request.
|
||||||
FromScriptMsg::JointSessionHistoryLength(top_level_browsing_context_id, sender) => {
|
FromScriptMsg::JointSessionHistoryLength(sender) => {
|
||||||
debug!("constellation got joint session history length message from script");
|
debug!("constellation got joint session history length message from script");
|
||||||
self.handle_joint_session_history_length(top_level_browsing_context_id, sender);
|
self.handle_joint_session_history_length(source_top_ctx_id, sender);
|
||||||
}
|
}
|
||||||
// Notification that the new document is ready to become active
|
// Notification that the new document is ready to become active
|
||||||
FromScriptMsg::ActivateDocument(pipeline_id) => {
|
FromScriptMsg::ActivateDocument => {
|
||||||
debug!("constellation got activate document message");
|
debug!("constellation got activate document message");
|
||||||
self.handle_activate_document_msg(pipeline_id);
|
self.handle_activate_document_msg(source_pipeline_id);
|
||||||
}
|
}
|
||||||
// Update pipeline url after redirections
|
// Update pipeline url after redirections
|
||||||
FromScriptMsg::SetFinalUrl(pipeline_id, final_url) => {
|
FromScriptMsg::SetFinalUrl(final_url) => {
|
||||||
// The script may have finished loading after we already started shutting down.
|
// The script may have finished loading after we already started shutting down.
|
||||||
if let Some(ref mut pipeline) = self.pipelines.get_mut(&pipeline_id) {
|
if let Some(ref mut pipeline) = self.pipelines.get_mut(&source_pipeline_id) {
|
||||||
debug!("constellation got set final url message");
|
debug!("constellation got set final url message");
|
||||||
pipeline.url = final_url;
|
pipeline.url = final_url;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1061,22 +1075,22 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
debug!("constellation got postMessage message");
|
debug!("constellation got postMessage message");
|
||||||
self.handle_post_message_msg(browsing_context_id, origin, data);
|
self.handle_post_message_msg(browsing_context_id, origin, data);
|
||||||
}
|
}
|
||||||
FromScriptMsg::MozBrowserEvent(pipeline_id, top_level_browsing_context_id, event) => {
|
FromScriptMsg::MozBrowserEvent(pipeline_id, event) => {
|
||||||
debug!("constellation got mozbrowser event message");
|
debug!("constellation got mozbrowser event message");
|
||||||
self.handle_mozbrowser_event_msg(pipeline_id, top_level_browsing_context_id, event);
|
self.handle_mozbrowser_event_msg(pipeline_id, source_top_ctx_id, event);
|
||||||
}
|
}
|
||||||
FromScriptMsg::Focus(pipeline_id) => {
|
FromScriptMsg::Focus => {
|
||||||
debug!("constellation got focus message");
|
debug!("constellation got focus message");
|
||||||
self.handle_focus_msg(pipeline_id);
|
self.handle_focus_msg(source_pipeline_id);
|
||||||
}
|
}
|
||||||
FromScriptMsg::ForwardEvent(pipeline_id, event) => {
|
FromScriptMsg::ForwardEvent(dest_id, event) => {
|
||||||
let msg = ConstellationControlMsg::SendEvent(pipeline_id, event);
|
let msg = ConstellationControlMsg::SendEvent(dest_id, event);
|
||||||
let result = match self.pipelines.get(&pipeline_id) {
|
let result = match self.pipelines.get(&dest_id) {
|
||||||
None => { debug!("Pipeline {:?} got event after closure.", pipeline_id); return; }
|
None => { debug!("Pipeline {:?} got event after closure.", dest_id); return; }
|
||||||
Some(pipeline) => pipeline.event_loop.send(msg),
|
Some(pipeline) => pipeline.event_loop.send(msg),
|
||||||
};
|
};
|
||||||
if let Err(e) = result {
|
if let Err(e) = result {
|
||||||
self.handle_send_error(pipeline_id, e);
|
self.handle_send_error(dest_id, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FromScriptMsg::GetClipboardContents(sender) => {
|
FromScriptMsg::GetClipboardContents(sender) => {
|
||||||
|
@ -1101,13 +1115,13 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FromScriptMsg::SetVisible(pipeline_id, visible) => {
|
FromScriptMsg::SetVisible(visible) => {
|
||||||
debug!("constellation got set visible messsage");
|
debug!("constellation got set visible messsage");
|
||||||
self.handle_set_visible_msg(pipeline_id, visible);
|
self.handle_set_visible_msg(source_pipeline_id, visible);
|
||||||
}
|
}
|
||||||
FromScriptMsg::VisibilityChangeComplete(pipeline_id, visible) => {
|
FromScriptMsg::VisibilityChangeComplete(visible) => {
|
||||||
debug!("constellation got set visibility change complete message");
|
debug!("constellation got set visibility change complete message");
|
||||||
self.handle_visibility_change_complete(pipeline_id, visible);
|
self.handle_visibility_change_complete(source_pipeline_id, visible);
|
||||||
}
|
}
|
||||||
FromScriptMsg::RemoveIFrame(browsing_context_id, sender) => {
|
FromScriptMsg::RemoveIFrame(browsing_context_id, sender) => {
|
||||||
debug!("constellation got remove iframe message");
|
debug!("constellation got remove iframe message");
|
||||||
|
@ -1118,11 +1132,15 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
}
|
}
|
||||||
FromScriptMsg::NewFavicon(url) => {
|
FromScriptMsg::NewFavicon(url) => {
|
||||||
debug!("constellation got new favicon message");
|
debug!("constellation got new favicon message");
|
||||||
self.compositor_proxy.send(ToCompositorMsg::NewFavicon(url));
|
if source_is_top_level_pipeline {
|
||||||
|
self.compositor_proxy.send(ToCompositorMsg::NewFavicon(source_top_ctx_id, url));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FromScriptMsg::HeadParsed => {
|
FromScriptMsg::HeadParsed => {
|
||||||
debug!("constellation got head parsed message");
|
debug!("constellation got head parsed message");
|
||||||
self.compositor_proxy.send(ToCompositorMsg::HeadParsed);
|
if source_is_top_level_pipeline {
|
||||||
|
self.compositor_proxy.send(ToCompositorMsg::HeadParsed(source_top_ctx_id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FromScriptMsg::CreateCanvasPaintThread(size, sender) => {
|
FromScriptMsg::CreateCanvasPaintThread(size, sender) => {
|
||||||
debug!("constellation got create-canvas-paint-thread message");
|
debug!("constellation got create-canvas-paint-thread message");
|
||||||
|
@ -1134,15 +1152,15 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
}
|
}
|
||||||
FromScriptMsg::NodeStatus(message) => {
|
FromScriptMsg::NodeStatus(message) => {
|
||||||
debug!("constellation got NodeStatus message");
|
debug!("constellation got NodeStatus message");
|
||||||
self.compositor_proxy.send(ToCompositorMsg::Status(message));
|
self.compositor_proxy.send(ToCompositorMsg::Status(source_top_ctx_id, message));
|
||||||
}
|
}
|
||||||
FromScriptMsg::SetDocumentState(pipeline_id, state) => {
|
FromScriptMsg::SetDocumentState(state) => {
|
||||||
debug!("constellation got SetDocumentState message");
|
debug!("constellation got SetDocumentState message");
|
||||||
self.document_states.insert(pipeline_id, state);
|
self.document_states.insert(source_pipeline_id, state);
|
||||||
}
|
}
|
||||||
FromScriptMsg::Alert(pipeline_id, message, sender) => {
|
FromScriptMsg::Alert(message, sender) => {
|
||||||
debug!("constellation got Alert message");
|
debug!("constellation got Alert message");
|
||||||
self.handle_alert(pipeline_id, message, sender);
|
self.handle_alert(source_top_ctx_id, message, sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
FromScriptMsg::ScrollFragmentPoint(scroll_root_id, point, smooth) => {
|
FromScriptMsg::ScrollFragmentPoint(scroll_root_id, point, smooth) => {
|
||||||
|
@ -1152,30 +1170,33 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
}
|
}
|
||||||
|
|
||||||
FromScriptMsg::GetClientWindow(send) => {
|
FromScriptMsg::GetClientWindow(send) => {
|
||||||
self.compositor_proxy.send(ToCompositorMsg::GetClientWindow(send));
|
self.compositor_proxy.send(ToCompositorMsg::GetClientWindow(source_top_ctx_id, send));
|
||||||
}
|
}
|
||||||
|
|
||||||
FromScriptMsg::MoveTo(point) => {
|
FromScriptMsg::MoveTo(point) => {
|
||||||
self.compositor_proxy.send(ToCompositorMsg::MoveTo(point));
|
self.compositor_proxy.send(ToCompositorMsg::MoveTo(source_top_ctx_id, point));
|
||||||
}
|
}
|
||||||
|
|
||||||
FromScriptMsg::ResizeTo(size) => {
|
FromScriptMsg::ResizeTo(size) => {
|
||||||
self.compositor_proxy.send(ToCompositorMsg::ResizeTo(size));
|
self.compositor_proxy.send(ToCompositorMsg::ResizeTo(source_top_ctx_id, size));
|
||||||
}
|
}
|
||||||
|
|
||||||
FromScriptMsg::Exit => {
|
FromScriptMsg::Exit => {
|
||||||
self.compositor_proxy.send(ToCompositorMsg::Exit);
|
self.compositor_proxy.send(ToCompositorMsg::Exit);
|
||||||
}
|
}
|
||||||
FromScriptMsg::LogEntry(top_level_browsing_context_id, thread_name, entry) => {
|
FromScriptMsg::LogEntry(thread_name, entry) => {
|
||||||
self.handle_log_entry(top_level_browsing_context_id, thread_name, entry);
|
self.handle_log_entry(Some(source_top_ctx_id), thread_name, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
FromScriptMsg::SetTitle(pipeline_id, title) => {
|
FromScriptMsg::SetTitle(title) => {
|
||||||
self.compositor_proxy.send(ToCompositorMsg::ChangePageTitle(pipeline_id, title))
|
if source_is_top_level_pipeline {
|
||||||
|
self.compositor_proxy.send(ToCompositorMsg::ChangePageTitle(source_top_ctx_id, title))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FromScriptMsg::SendKeyEvent(ch, key, key_state, key_modifiers) => {
|
FromScriptMsg::SendKeyEvent(ch, key, key_state, key_modifiers) => {
|
||||||
self.compositor_proxy.send(ToCompositorMsg::KeyEvent(ch, key, key_state, key_modifiers))
|
let event = ToCompositorMsg::KeyEvent(Some(source_top_ctx_id), ch, key, key_state, key_modifiers);
|
||||||
|
self.compositor_proxy.send(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
FromScriptMsg::TouchEventProcessed(result) => {
|
FromScriptMsg::TouchEventProcessed(result) => {
|
||||||
|
@ -1204,11 +1225,11 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
warn!("Unable to forward DOMMessage for postMessage call");
|
warn!("Unable to forward DOMMessage for postMessage call");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FromScriptMsg::BroadcastStorageEvent(pipeline_id, storage, url, key, old_value, new_value) => {
|
FromScriptMsg::BroadcastStorageEvent(storage, url, key, old_value, new_value) => {
|
||||||
self.handle_broadcast_storage_event(pipeline_id, storage, url, key, old_value, new_value);
|
self.handle_broadcast_storage_event(source_pipeline_id, storage, url, key, old_value, new_value);
|
||||||
}
|
}
|
||||||
FromScriptMsg::SetFullscreenState(state) => {
|
FromScriptMsg::SetFullscreenState(state) => {
|
||||||
self.compositor_proxy.send(ToCompositorMsg::SetFullscreenState(state));
|
self.compositor_proxy.send(ToCompositorMsg::SetFullscreenState(source_top_ctx_id, state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1539,8 +1560,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_navigate_request(&self,
|
fn handle_navigate_request(&self,
|
||||||
req_init: RequestInit,
|
id: PipelineId,
|
||||||
id: PipelineId) {
|
req_init: RequestInit) {
|
||||||
let listener = NetworkListener::new(
|
let listener = NetworkListener::new(
|
||||||
req_init,
|
req_init,
|
||||||
id,
|
id,
|
||||||
|
@ -1698,14 +1719,10 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_alert(&mut self,
|
fn handle_alert(&mut self,
|
||||||
pipeline_id: PipelineId,
|
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||||
message: String,
|
message: String,
|
||||||
sender: IpcSender<bool>) {
|
sender: IpcSender<bool>) {
|
||||||
let top_level_browsing_context_id = self.pipelines.get(&pipeline_id)
|
let browser_pipeline_id = self.browsing_contexts.get(&BrowsingContextId::from(top_level_browsing_context_id))
|
||||||
.map(|pipeline| pipeline.top_level_browsing_context_id);
|
|
||||||
let browser_pipeline_id = top_level_browsing_context_id
|
|
||||||
.map(BrowsingContextId::from)
|
|
||||||
.and_then(|browsing_context_id| self.browsing_contexts.get(&browsing_context_id))
|
|
||||||
.and_then(|browsing_context| self.pipelines.get(&browsing_context.pipeline_id))
|
.and_then(|browsing_context| self.pipelines.get(&browsing_context.pipeline_id))
|
||||||
.and_then(|pipeline| pipeline.parent_info)
|
.and_then(|pipeline| pipeline.parent_info)
|
||||||
.map(|(browser_pipeline_id, _)| browser_pipeline_id);
|
.map(|(browser_pipeline_id, _)| browser_pipeline_id);
|
||||||
|
@ -1719,12 +1736,17 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
let event = MozBrowserEvent::ShowModalPrompt(prompt_type, title, message, return_value);
|
let event = MozBrowserEvent::ShowModalPrompt(prompt_type, title, message, return_value);
|
||||||
match browser_pipeline_id.and_then(|id| self.pipelines.get(&id)) {
|
match browser_pipeline_id.and_then(|id| self.pipelines.get(&id)) {
|
||||||
None => warn!("Alert sent after browser pipeline closure."),
|
None => warn!("Alert sent after browser pipeline closure."),
|
||||||
Some(pipeline) => pipeline.trigger_mozbrowser_event(top_level_browsing_context_id, event),
|
Some(pipeline) => pipeline.trigger_mozbrowser_event(Some(top_level_browsing_context_id), event),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let result = sender.send(!mozbrowser_modal_prompt);
|
let result = sender.send(!mozbrowser_modal_prompt);
|
||||||
if let Err(e) = result {
|
if let Err(e) = result {
|
||||||
|
let ctx_id = BrowsingContextId::from(top_level_browsing_context_id);
|
||||||
|
let pipeline_id = match self.browsing_contexts.get(&ctx_id) {
|
||||||
|
Some(ctx) => ctx.pipeline_id,
|
||||||
|
None => return warn!("Alert sent for unknown browsing context."),
|
||||||
|
};
|
||||||
self.handle_send_error(pipeline_id, e);
|
self.handle_send_error(pipeline_id, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,10 @@ use net_traits::{IpcSend, ResourceThreads};
|
||||||
use net_traits::image_cache::ImageCache;
|
use net_traits::image_cache::ImageCache;
|
||||||
use profile_traits::mem as profile_mem;
|
use profile_traits::mem as profile_mem;
|
||||||
use profile_traits::time;
|
use profile_traits::time;
|
||||||
use script_traits::{ConstellationControlMsg, DiscardBrowsingContext};
|
use script_traits::{ConstellationControlMsg, DiscardBrowsingContext, ScriptToConstellationChan};
|
||||||
use script_traits::{DocumentActivity, InitialScriptState};
|
use script_traits::{DocumentActivity, InitialScriptState};
|
||||||
use script_traits::{LayoutControlMsg, LayoutMsg, LoadData, MozBrowserEvent};
|
use script_traits::{LayoutControlMsg, LayoutMsg, LoadData, MozBrowserEvent};
|
||||||
use script_traits::{NewLayoutInfo, SWManagerMsg, SWManagerSenders, ScriptMsg};
|
use script_traits::{NewLayoutInfo, SWManagerMsg, SWManagerSenders};
|
||||||
use script_traits::{ScriptThreadFactory, TimerSchedulerMsg, WindowSizeData};
|
use script_traits::{ScriptThreadFactory, TimerSchedulerMsg, WindowSizeData};
|
||||||
use servo_config::opts::{self, Opts};
|
use servo_config::opts::{self, Opts};
|
||||||
use servo_config::prefs::{PREFS, Pref};
|
use servo_config::prefs::{PREFS, Pref};
|
||||||
|
@ -112,7 +112,7 @@ pub struct InitialPipelineState {
|
||||||
pub parent_info: Option<(PipelineId, FrameType)>,
|
pub parent_info: Option<(PipelineId, FrameType)>,
|
||||||
|
|
||||||
/// A channel to the associated constellation.
|
/// A channel to the associated constellation.
|
||||||
pub constellation_chan: IpcSender<ScriptMsg>,
|
pub script_to_constellation_chan: ScriptToConstellationChan,
|
||||||
|
|
||||||
/// A channel for the layout thread to send messages to the constellation.
|
/// A channel for the layout thread to send messages to the constellation.
|
||||||
pub layout_to_constellation_chan: IpcSender<LayoutMsg>,
|
pub layout_to_constellation_chan: IpcSender<LayoutMsg>,
|
||||||
|
@ -246,7 +246,7 @@ impl Pipeline {
|
||||||
browsing_context_id: state.browsing_context_id,
|
browsing_context_id: state.browsing_context_id,
|
||||||
top_level_browsing_context_id: state.top_level_browsing_context_id,
|
top_level_browsing_context_id: state.top_level_browsing_context_id,
|
||||||
parent_info: state.parent_info,
|
parent_info: state.parent_info,
|
||||||
constellation_chan: state.constellation_chan,
|
script_to_constellation_chan: state.script_to_constellation_chan.clone(),
|
||||||
scheduler_chan: state.scheduler_chan,
|
scheduler_chan: state.scheduler_chan,
|
||||||
devtools_chan: script_to_devtools_chan,
|
devtools_chan: script_to_devtools_chan,
|
||||||
bluetooth_thread: state.bluetooth_thread,
|
bluetooth_thread: state.bluetooth_thread,
|
||||||
|
@ -446,7 +446,7 @@ pub struct UnprivilegedPipelineContent {
|
||||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||||
browsing_context_id: BrowsingContextId,
|
browsing_context_id: BrowsingContextId,
|
||||||
parent_info: Option<(PipelineId, FrameType)>,
|
parent_info: Option<(PipelineId, FrameType)>,
|
||||||
constellation_chan: IpcSender<ScriptMsg>,
|
script_to_constellation_chan: ScriptToConstellationChan,
|
||||||
layout_to_constellation_chan: IpcSender<LayoutMsg>,
|
layout_to_constellation_chan: IpcSender<LayoutMsg>,
|
||||||
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||||
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||||
|
@ -487,7 +487,7 @@ impl UnprivilegedPipelineContent {
|
||||||
parent_info: self.parent_info,
|
parent_info: self.parent_info,
|
||||||
control_chan: self.script_chan.clone(),
|
control_chan: self.script_chan.clone(),
|
||||||
control_port: self.script_port,
|
control_port: self.script_port,
|
||||||
constellation_chan: self.constellation_chan,
|
script_to_constellation_chan: self.script_to_constellation_chan.clone(),
|
||||||
layout_to_constellation_chan: self.layout_to_constellation_chan.clone(),
|
layout_to_constellation_chan: self.layout_to_constellation_chan.clone(),
|
||||||
scheduler_chan: self.scheduler_chan,
|
scheduler_chan: self.scheduler_chan,
|
||||||
bluetooth_thread: self.bluetooth_thread,
|
bluetooth_thread: self.bluetooth_thread,
|
||||||
|
@ -595,8 +595,8 @@ impl UnprivilegedPipelineContent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn constellation_chan(&self) -> IpcSender<ScriptMsg> {
|
pub fn script_to_constellation_chan(&self) -> &ScriptToConstellationChan {
|
||||||
self.constellation_chan.clone()
|
&self.script_to_constellation_chan
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn opts(&self) -> Opts {
|
pub fn opts(&self) -> Opts {
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use ipc_channel::ipc::{self, IpcSender};
|
use ipc_channel::ipc::channel;
|
||||||
use script_traits::ScriptMsg as ConstellationMsg;
|
use script_traits::{ScriptToConstellationChan, ScriptMsg};
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
|
|
||||||
pub trait ClipboardProvider {
|
pub trait ClipboardProvider {
|
||||||
|
@ -13,14 +13,14 @@ pub trait ClipboardProvider {
|
||||||
fn set_clipboard_contents(&mut self, String);
|
fn set_clipboard_contents(&mut self, String);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ClipboardProvider for IpcSender<ConstellationMsg> {
|
impl ClipboardProvider for ScriptToConstellationChan {
|
||||||
fn clipboard_contents(&mut self) -> String {
|
fn clipboard_contents(&mut self) -> String {
|
||||||
let (tx, rx) = ipc::channel().unwrap();
|
let (tx, rx) = channel().unwrap();
|
||||||
self.send(ConstellationMsg::GetClipboardContents(tx)).unwrap();
|
self.send(ScriptMsg::GetClipboardContents(tx)).unwrap();
|
||||||
rx.recv().unwrap()
|
rx.recv().unwrap()
|
||||||
}
|
}
|
||||||
fn set_clipboard_contents(&mut self, s: String) {
|
fn set_clipboard_contents(&mut self, s: String) {
|
||||||
self.send(ConstellationMsg::SetClipboardContents(s)).unwrap();
|
self.send(ScriptMsg::SetClipboardContents(s)).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ use profile_traits::time::ProfilerChan as TimeProfilerChan;
|
||||||
use script_layout_interface::OpaqueStyleAndLayoutData;
|
use script_layout_interface::OpaqueStyleAndLayoutData;
|
||||||
use script_layout_interface::reporter::CSSErrorReporter;
|
use script_layout_interface::reporter::CSSErrorReporter;
|
||||||
use script_layout_interface::rpc::LayoutRPC;
|
use script_layout_interface::rpc::LayoutRPC;
|
||||||
use script_traits::{DocumentActivity, TimerEventId, TimerSource, TouchpadPressurePhase};
|
use script_traits::{DocumentActivity, ScriptToConstellationChan, TimerEventId, TimerSource, TouchpadPressurePhase};
|
||||||
use script_traits::{UntrustedNodeAddress, WindowSizeData, WindowSizeType};
|
use script_traits::{UntrustedNodeAddress, WindowSizeData, WindowSizeType};
|
||||||
use script_traits::DrawAPaintImageResult;
|
use script_traits::DrawAPaintImageResult;
|
||||||
use selectors::matching::ElementSelectorFlags;
|
use selectors::matching::ElementSelectorFlags;
|
||||||
|
@ -400,6 +400,7 @@ unsafe_no_jsmanaged_fields!(WebGLTextureId);
|
||||||
unsafe_no_jsmanaged_fields!(WebGLVertexArrayId);
|
unsafe_no_jsmanaged_fields!(WebGLVertexArrayId);
|
||||||
unsafe_no_jsmanaged_fields!(MediaList);
|
unsafe_no_jsmanaged_fields!(MediaList);
|
||||||
unsafe_no_jsmanaged_fields!(WebVRGamepadHand);
|
unsafe_no_jsmanaged_fields!(WebVRGamepadHand);
|
||||||
|
unsafe_no_jsmanaged_fields!(ScriptToConstellationChan);
|
||||||
|
|
||||||
unsafe impl<'a> JSTraceable for &'a str {
|
unsafe impl<'a> JSTraceable for &'a str {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -42,7 +42,7 @@ use net_traits::image_cache::ImageResponse;
|
||||||
use net_traits::image_cache::ImageState;
|
use net_traits::image_cache::ImageState;
|
||||||
use net_traits::image_cache::UsePlaceholder;
|
use net_traits::image_cache::UsePlaceholder;
|
||||||
use num_traits::ToPrimitive;
|
use num_traits::ToPrimitive;
|
||||||
use script_traits::ScriptMsg as ConstellationMsg;
|
use script_traits::ScriptMsg;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use std::{cmp, fmt, mem};
|
use std::{cmp, fmt, mem};
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
@ -130,9 +130,9 @@ impl CanvasRenderingContext2D {
|
||||||
-> CanvasRenderingContext2D {
|
-> CanvasRenderingContext2D {
|
||||||
debug!("Creating new canvas rendering context.");
|
debug!("Creating new canvas rendering context.");
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
let constellation_chan = global.constellation_chan();
|
let script_to_constellation_chan = global.script_to_constellation_chan();
|
||||||
debug!("Asking constellation to create new canvas thread.");
|
debug!("Asking constellation to create new canvas thread.");
|
||||||
constellation_chan.send(ConstellationMsg::CreateCanvasPaintThread(size, sender)).unwrap();
|
script_to_constellation_chan.send(ScriptMsg::CreateCanvasPaintThread(size, sender)).unwrap();
|
||||||
let ipc_renderer = receiver.recv().unwrap();
|
let ipc_renderer = receiver.recv().unwrap();
|
||||||
debug!("Done.");
|
debug!("Done.");
|
||||||
CanvasRenderingContext2D {
|
CanvasRenderingContext2D {
|
||||||
|
|
|
@ -17,7 +17,7 @@ use ipc_channel::ipc;
|
||||||
use js::jsapi::{JSContext, HandleValue};
|
use js::jsapi::{JSContext, HandleValue};
|
||||||
use js::jsval::{JSVal, UndefinedValue};
|
use js::jsval::{JSVal, UndefinedValue};
|
||||||
use msg::constellation_msg::PipelineId;
|
use msg::constellation_msg::PipelineId;
|
||||||
use script_traits::ScriptMsg as ConstellationMsg;
|
use script_traits::ScriptMsg;
|
||||||
use servo_url::ImmutableOrigin;
|
use servo_url::ImmutableOrigin;
|
||||||
use servo_url::MutableOrigin;
|
use servo_url::MutableOrigin;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
|
@ -54,7 +54,7 @@ impl DissimilarOriginWindow {
|
||||||
global_to_clone_from.devtools_chan().cloned(),
|
global_to_clone_from.devtools_chan().cloned(),
|
||||||
global_to_clone_from.mem_profiler_chan().clone(),
|
global_to_clone_from.mem_profiler_chan().clone(),
|
||||||
global_to_clone_from.time_profiler_chan().clone(),
|
global_to_clone_from.time_profiler_chan().clone(),
|
||||||
global_to_clone_from.constellation_chan().clone(),
|
global_to_clone_from.script_to_constellation_chan().clone(),
|
||||||
global_to_clone_from.scheduler_chan().clone(),
|
global_to_clone_from.scheduler_chan().clone(),
|
||||||
global_to_clone_from.resource_threads().clone(),
|
global_to_clone_from.resource_threads().clone(),
|
||||||
timer_event_chan,
|
timer_event_chan,
|
||||||
|
@ -184,9 +184,9 @@ impl DissimilarOriginWindowMethods for DissimilarOriginWindow {
|
||||||
|
|
||||||
impl DissimilarOriginWindow {
|
impl DissimilarOriginWindow {
|
||||||
pub fn post_message(&self, origin: Option<ImmutableOrigin>, data: StructuredCloneData) {
|
pub fn post_message(&self, origin: Option<ImmutableOrigin>, data: StructuredCloneData) {
|
||||||
let msg = ConstellationMsg::PostMessage(self.window_proxy.browsing_context_id(),
|
let msg = ScriptMsg::PostMessage(self.window_proxy.browsing_context_id(),
|
||||||
origin,
|
origin,
|
||||||
data.move_to_arraybuffer());
|
data.move_to_arraybuffer());
|
||||||
let _ = self.upcast::<GlobalScope>().constellation_chan().send(msg);
|
let _ = self.upcast::<GlobalScope>().script_to_constellation_chan().send(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ use script_runtime::{CommonScriptMsg, ScriptThreadEventCategory};
|
||||||
use script_thread::{MainThreadScriptMsg, Runnable, ScriptThread};
|
use script_thread::{MainThreadScriptMsg, Runnable, ScriptThread};
|
||||||
use script_traits::{AnimationState, CompositorEvent, DocumentActivity};
|
use script_traits::{AnimationState, CompositorEvent, DocumentActivity};
|
||||||
use script_traits::{MouseButton, MouseEventType, MozBrowserEvent};
|
use script_traits::{MouseButton, MouseEventType, MozBrowserEvent};
|
||||||
use script_traits::{MsDuration, ScriptMsg as ConstellationMsg, TouchpadPressurePhase};
|
use script_traits::{MsDuration, ScriptMsg, TouchpadPressurePhase};
|
||||||
use script_traits::{TouchEventType, TouchId};
|
use script_traits::{TouchEventType, TouchId};
|
||||||
use script_traits::UntrustedNodeAddress;
|
use script_traits::UntrustedNodeAddress;
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
|
@ -795,9 +795,7 @@ impl Document {
|
||||||
// Update the focus state for all elements in the focus chain.
|
// Update the focus state for all elements in the focus chain.
|
||||||
// https://html.spec.whatwg.org/multipage/#focus-chain
|
// https://html.spec.whatwg.org/multipage/#focus-chain
|
||||||
if focus_type == FocusType::Element {
|
if focus_type == FocusType::Element {
|
||||||
let global_scope = self.window.upcast::<GlobalScope>();
|
self.send_to_constellation(ScriptMsg::Focus);
|
||||||
let event = ConstellationMsg::Focus(global_scope.pipeline_id());
|
|
||||||
global_scope.constellation_chan().send(event).unwrap();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -808,19 +806,14 @@ impl Document {
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsertitlechange
|
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsertitlechange
|
||||||
self.trigger_mozbrowser_event(MozBrowserEvent::TitleChange(String::from(self.Title())));
|
self.trigger_mozbrowser_event(MozBrowserEvent::TitleChange(String::from(self.Title())));
|
||||||
|
|
||||||
self.send_title_to_compositor();
|
self.send_title_to_constellation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sends this document's title to the compositor.
|
/// Sends this document's title to the constellation.
|
||||||
pub fn send_title_to_compositor(&self) {
|
pub fn send_title_to_constellation(&self) {
|
||||||
let window = self.window();
|
let title = Some(String::from(self.Title()));
|
||||||
let global_scope = window.upcast::<GlobalScope>();
|
self.send_to_constellation(ScriptMsg::SetTitle(title));
|
||||||
global_scope
|
|
||||||
.constellation_chan()
|
|
||||||
.send(ConstellationMsg::SetTitle(global_scope.pipeline_id(),
|
|
||||||
Some(String::from(self.Title()))))
|
|
||||||
.unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dirty_all_nodes(&self) {
|
pub fn dirty_all_nodes(&self) {
|
||||||
|
@ -872,8 +865,8 @@ impl Document {
|
||||||
let child_point = client_point - child_origin;
|
let child_point = client_point - child_origin;
|
||||||
|
|
||||||
let event = CompositorEvent::MouseButtonEvent(mouse_event_type, button, child_point);
|
let event = CompositorEvent::MouseButtonEvent(mouse_event_type, button, child_point);
|
||||||
let event = ConstellationMsg::ForwardEvent(pipeline_id, event);
|
let event = ScriptMsg::ForwardEvent(pipeline_id, event);
|
||||||
self.window.upcast::<GlobalScope>().constellation_chan().send(event).unwrap();
|
self.send_to_constellation(event);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1029,8 +1022,8 @@ impl Document {
|
||||||
let event = CompositorEvent::TouchpadPressureEvent(child_point,
|
let event = CompositorEvent::TouchpadPressureEvent(child_point,
|
||||||
pressure,
|
pressure,
|
||||||
phase_now);
|
phase_now);
|
||||||
let event = ConstellationMsg::ForwardEvent(pipeline_id, event);
|
let event = ScriptMsg::ForwardEvent(pipeline_id, event);
|
||||||
self.window.upcast::<GlobalScope>().constellation_chan().send(event).unwrap();
|
self.send_to_constellation(event);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1131,8 +1124,8 @@ impl Document {
|
||||||
let child_point = client_point - child_origin;
|
let child_point = client_point - child_origin;
|
||||||
|
|
||||||
let event = CompositorEvent::MouseMoveEvent(Some(child_point));
|
let event = CompositorEvent::MouseMoveEvent(Some(child_point));
|
||||||
let event = ConstellationMsg::ForwardEvent(pipeline_id, event);
|
let event = ScriptMsg::ForwardEvent(pipeline_id, event);
|
||||||
self.window.upcast::<GlobalScope>().constellation_chan().send(event).unwrap();
|
self.send_to_constellation(event);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1238,8 +1231,8 @@ impl Document {
|
||||||
let child_point = point - child_origin;
|
let child_point = point - child_origin;
|
||||||
|
|
||||||
let event = CompositorEvent::TouchEvent(event_type, touch_id, child_point);
|
let event = CompositorEvent::TouchEvent(event_type, touch_id, child_point);
|
||||||
let event = ConstellationMsg::ForwardEvent(pipeline_id, event);
|
let event = ScriptMsg::ForwardEvent(pipeline_id, event);
|
||||||
self.window.upcast::<GlobalScope>().constellation_chan().send(event).unwrap();
|
self.send_to_constellation(event);
|
||||||
}
|
}
|
||||||
return TouchEventResult::Forwarded;
|
return TouchEventResult::Forwarded;
|
||||||
}
|
}
|
||||||
|
@ -1330,8 +1323,7 @@ impl Document {
|
||||||
ch: Option<char>,
|
ch: Option<char>,
|
||||||
key: Key,
|
key: Key,
|
||||||
state: KeyState,
|
state: KeyState,
|
||||||
modifiers: KeyModifiers,
|
modifiers: KeyModifiers) {
|
||||||
constellation: &IpcSender<ConstellationMsg>) {
|
|
||||||
let focused = self.get_focused_element();
|
let focused = self.get_focused_element();
|
||||||
let body = self.GetBody();
|
let body = self.GetBody();
|
||||||
|
|
||||||
|
@ -1407,7 +1399,8 @@ impl Document {
|
||||||
}
|
}
|
||||||
|
|
||||||
if cancel_state == EventDefault::Allowed {
|
if cancel_state == EventDefault::Allowed {
|
||||||
constellation.send(ConstellationMsg::SendKeyEvent(ch, key, state, modifiers)).unwrap();
|
let msg = ScriptMsg::SendKeyEvent(ch, key, state, modifiers);
|
||||||
|
self.send_to_constellation(msg);
|
||||||
|
|
||||||
// This behavior is unspecced
|
// This behavior is unspecced
|
||||||
// We are supposed to dispatch synthetic click activation for Space and/or Return,
|
// We are supposed to dispatch synthetic click activation for Space and/or Return,
|
||||||
|
@ -1525,11 +1518,8 @@ impl Document {
|
||||||
pub fn trigger_mozbrowser_event(&self, event: MozBrowserEvent) {
|
pub fn trigger_mozbrowser_event(&self, event: MozBrowserEvent) {
|
||||||
if PREFS.is_mozbrowser_enabled() {
|
if PREFS.is_mozbrowser_enabled() {
|
||||||
if let Some((parent_pipeline_id, _)) = self.window.parent_info() {
|
if let Some((parent_pipeline_id, _)) = self.window.parent_info() {
|
||||||
let top_level_browsing_context_id = self.window.window_proxy().top_level_browsing_context_id();
|
let event = ScriptMsg::MozBrowserEvent(parent_pipeline_id, event);
|
||||||
let event = ConstellationMsg::MozBrowserEvent(parent_pipeline_id,
|
self.send_to_constellation(event);
|
||||||
top_level_browsing_context_id,
|
|
||||||
event);
|
|
||||||
self.window.upcast::<GlobalScope>().constellation_chan().send(event).unwrap();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1559,11 +1549,8 @@ impl Document {
|
||||||
// This reduces CPU usage by avoiding needless thread wakeups in the common case of
|
// This reduces CPU usage by avoiding needless thread wakeups in the common case of
|
||||||
// repeated rAF.
|
// repeated rAF.
|
||||||
|
|
||||||
let global_scope = self.window.upcast::<GlobalScope>();
|
let event = ScriptMsg::ChangeRunningAnimationsState(AnimationState::AnimationCallbacksPresent);
|
||||||
let event = ConstellationMsg::ChangeRunningAnimationsState(
|
self.send_to_constellation(event);
|
||||||
global_scope.pipeline_id(),
|
|
||||||
AnimationState::AnimationCallbacksPresent);
|
|
||||||
global_scope.constellation_chan().send(event).unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ident
|
ident
|
||||||
|
@ -1629,11 +1616,8 @@ impl Document {
|
||||||
(!was_faking_animation_frames && self.is_faking_animation_frames()) {
|
(!was_faking_animation_frames && self.is_faking_animation_frames()) {
|
||||||
mem::swap(&mut *self.animation_frame_list.borrow_mut(),
|
mem::swap(&mut *self.animation_frame_list.borrow_mut(),
|
||||||
&mut *animation_frame_list);
|
&mut *animation_frame_list);
|
||||||
let global_scope = self.window.upcast::<GlobalScope>();
|
let event = ScriptMsg::ChangeRunningAnimationsState(AnimationState::NoAnimationCallbacksPresent);
|
||||||
let event = ConstellationMsg::ChangeRunningAnimationsState(
|
self.send_to_constellation(event);
|
||||||
global_scope.pipeline_id(),
|
|
||||||
AnimationState::NoAnimationCallbacksPresent);
|
|
||||||
global_scope.constellation_chan().send(event).unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the counter of spurious animation frames.
|
// Update the counter of spurious animation frames.
|
||||||
|
@ -1896,10 +1880,7 @@ impl Document {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn notify_constellation_load(&self) {
|
pub fn notify_constellation_load(&self) {
|
||||||
let global_scope = self.window.upcast::<GlobalScope>();
|
self.send_to_constellation(ScriptMsg::LoadComplete);
|
||||||
let pipeline_id = global_scope.pipeline_id();
|
|
||||||
let load_event = ConstellationMsg::LoadComplete(pipeline_id);
|
|
||||||
global_scope.constellation_chan().send(load_event).unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_current_parser(&self, script: Option<&ServoParser>) {
|
pub fn set_current_parser(&self, script: Option<&ServoParser>) {
|
||||||
|
@ -2018,6 +1999,11 @@ impl Document {
|
||||||
|
|
||||||
registry.lookup_definition(local_name, is)
|
registry.lookup_definition(local_name, is)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn send_to_constellation(&self, msg: ScriptMsg) {
|
||||||
|
let global_scope = self.window.upcast::<GlobalScope>();
|
||||||
|
global_scope.script_to_constellation_chan().send(msg).unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, HeapSizeOf)]
|
#[derive(PartialEq, HeapSizeOf)]
|
||||||
|
@ -2519,8 +2505,8 @@ impl Document {
|
||||||
let window = self.window();
|
let window = self.window();
|
||||||
// Step 6
|
// Step 6
|
||||||
if !error {
|
if !error {
|
||||||
let event = ConstellationMsg::SetFullscreenState(true);
|
let event = ScriptMsg::SetFullscreenState(true);
|
||||||
window.upcast::<GlobalScope>().constellation_chan().send(event).unwrap();
|
self.send_to_constellation(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 7
|
// Step 7
|
||||||
|
@ -2552,8 +2538,8 @@ impl Document {
|
||||||
|
|
||||||
let window = self.window();
|
let window = self.window();
|
||||||
// Step 8
|
// Step 8
|
||||||
let event = ConstellationMsg::SetFullscreenState(false);
|
let event = ScriptMsg::SetFullscreenState(false);
|
||||||
window.upcast::<GlobalScope>().constellation_chan().send(event).unwrap();
|
self.send_to_constellation(event);
|
||||||
|
|
||||||
// Step 9
|
// Step 9
|
||||||
let trusted_element = Trusted::new(element.r());
|
let trusted_element = Trusted::new(element.r());
|
||||||
|
|
|
@ -37,7 +37,7 @@ use net_traits::{CoreResourceThread, ResourceThreads, IpcSend};
|
||||||
use profile_traits::{mem, time};
|
use profile_traits::{mem, time};
|
||||||
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort};
|
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort};
|
||||||
use script_thread::{MainThreadScriptChan, RunnableWrapper, ScriptThread};
|
use script_thread::{MainThreadScriptChan, RunnableWrapper, ScriptThread};
|
||||||
use script_traits::{MsDuration, ScriptMsg as ConstellationMsg, TimerEvent};
|
use script_traits::{MsDuration, ScriptToConstellationChan, TimerEvent};
|
||||||
use script_traits::{TimerEventId, TimerSchedulerMsg, TimerSource};
|
use script_traits::{TimerEventId, TimerSchedulerMsg, TimerSource};
|
||||||
use servo_url::{MutableOrigin, ServoUrl};
|
use servo_url::{MutableOrigin, ServoUrl};
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
@ -80,7 +80,7 @@ pub struct GlobalScope {
|
||||||
|
|
||||||
/// A handle for communicating messages to the constellation thread.
|
/// A handle for communicating messages to the constellation thread.
|
||||||
#[ignore_heap_size_of = "channels are hard"]
|
#[ignore_heap_size_of = "channels are hard"]
|
||||||
constellation_chan: IpcSender<ConstellationMsg>,
|
script_to_constellation_chan: ScriptToConstellationChan,
|
||||||
|
|
||||||
#[ignore_heap_size_of = "channels are hard"]
|
#[ignore_heap_size_of = "channels are hard"]
|
||||||
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||||
|
@ -104,7 +104,7 @@ impl GlobalScope {
|
||||||
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||||
mem_profiler_chan: mem::ProfilerChan,
|
mem_profiler_chan: mem::ProfilerChan,
|
||||||
time_profiler_chan: time::ProfilerChan,
|
time_profiler_chan: time::ProfilerChan,
|
||||||
constellation_chan: IpcSender<ConstellationMsg>,
|
script_to_constellation_chan: ScriptToConstellationChan,
|
||||||
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||||
resource_threads: ResourceThreads,
|
resource_threads: ResourceThreads,
|
||||||
timer_event_chan: IpcSender<TimerEvent>,
|
timer_event_chan: IpcSender<TimerEvent>,
|
||||||
|
@ -120,7 +120,7 @@ impl GlobalScope {
|
||||||
devtools_chan: devtools_chan,
|
devtools_chan: devtools_chan,
|
||||||
mem_profiler_chan: mem_profiler_chan,
|
mem_profiler_chan: mem_profiler_chan,
|
||||||
time_profiler_chan: time_profiler_chan,
|
time_profiler_chan: time_profiler_chan,
|
||||||
constellation_chan: constellation_chan,
|
script_to_constellation_chan: script_to_constellation_chan,
|
||||||
scheduler_chan: scheduler_chan.clone(),
|
scheduler_chan: scheduler_chan.clone(),
|
||||||
in_error_reporting_mode: Default::default(),
|
in_error_reporting_mode: Default::default(),
|
||||||
resource_threads: resource_threads,
|
resource_threads: resource_threads,
|
||||||
|
@ -231,8 +231,8 @@ impl GlobalScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a sender to the constellation thread.
|
/// Get a sender to the constellation thread.
|
||||||
pub fn constellation_chan(&self) -> &IpcSender<ConstellationMsg> {
|
pub fn script_to_constellation_chan(&self) -> &ScriptToConstellationChan {
|
||||||
&self.constellation_chan
|
&self.script_to_constellation_chan
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn scheduler_chan(&self) -> &IpcSender<TimerSchedulerMsg> {
|
pub fn scheduler_chan(&self) -> &IpcSender<TimerSchedulerMsg> {
|
||||||
|
|
|
@ -15,7 +15,7 @@ use dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use ipc_channel::ipc;
|
use ipc_channel::ipc;
|
||||||
use msg::constellation_msg::TraversalDirection;
|
use msg::constellation_msg::TraversalDirection;
|
||||||
use script_traits::ScriptMsg as ConstellationMsg;
|
use script_traits::ScriptMsg;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#the-history-interface
|
// https://html.spec.whatwg.org/multipage/#the-history-interface
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -44,9 +44,8 @@ impl History {
|
||||||
if !self.window.Document().is_fully_active() {
|
if !self.window.Document().is_fully_active() {
|
||||||
return Err(Error::Security);
|
return Err(Error::Security);
|
||||||
}
|
}
|
||||||
let top_level_browsing_context_id = self.window.window_proxy().top_level_browsing_context_id();
|
let msg = ScriptMsg::TraverseHistory(direction);
|
||||||
let msg = ConstellationMsg::TraverseHistory(top_level_browsing_context_id, direction);
|
let _ = self.window.upcast::<GlobalScope>().script_to_constellation_chan().send(msg);
|
||||||
let _ = self.window.upcast::<GlobalScope>().constellation_chan().send(msg);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,10 +56,9 @@ impl HistoryMethods for History {
|
||||||
if !self.window.Document().is_fully_active() {
|
if !self.window.Document().is_fully_active() {
|
||||||
return Err(Error::Security);
|
return Err(Error::Security);
|
||||||
}
|
}
|
||||||
let top_level_browsing_context_id = self.window.window_proxy().top_level_browsing_context_id();
|
|
||||||
let (sender, recv) = ipc::channel().expect("Failed to create channel to send jsh length.");
|
let (sender, recv) = ipc::channel().expect("Failed to create channel to send jsh length.");
|
||||||
let msg = ConstellationMsg::JointSessionHistoryLength(top_level_browsing_context_id, sender);
|
let msg = ScriptMsg::JointSessionHistoryLength(sender);
|
||||||
let _ = self.window.upcast::<GlobalScope>().constellation_chan().send(msg);
|
let _ = self.window.upcast::<GlobalScope>().script_to_constellation_chan().send(msg);
|
||||||
Ok(recv.recv().unwrap())
|
Ok(recv.recv().unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ use dom::node::{Node, document_from_node, window_from_node};
|
||||||
use dom::virtualmethods::VirtualMethods;
|
use dom::virtualmethods::VirtualMethods;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
use script_traits::ScriptMsg as ConstellationMsg;
|
use script_traits::ScriptMsg;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use style::attr::AttrValue;
|
use style::attr::AttrValue;
|
||||||
use time;
|
use time;
|
||||||
|
@ -138,8 +138,8 @@ impl VirtualMethods for HTMLBodyElement {
|
||||||
let window = window_from_node(self);
|
let window = window_from_node(self);
|
||||||
let document = window.Document();
|
let document = window.Document();
|
||||||
document.set_reflow_timeout(time::precise_time_ns() + INITIAL_REFLOW_DELAY);
|
document.set_reflow_timeout(time::precise_time_ns() + INITIAL_REFLOW_DELAY);
|
||||||
let event = ConstellationMsg::HeadParsed;
|
let event = ScriptMsg::HeadParsed;
|
||||||
window.upcast::<GlobalScope>().constellation_chan().send(event).unwrap();
|
window.upcast::<GlobalScope>().script_to_constellation_chan().send(event).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue {
|
fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue {
|
||||||
|
|
|
@ -45,7 +45,7 @@ use net_traits::response::HttpsState;
|
||||||
use script_layout_interface::message::ReflowQueryType;
|
use script_layout_interface::message::ReflowQueryType;
|
||||||
use script_thread::{ScriptThread, Runnable};
|
use script_thread::{ScriptThread, Runnable};
|
||||||
use script_traits::{IFrameLoadInfo, IFrameLoadInfoWithData, LoadData, UpdatePipelineIdReason};
|
use script_traits::{IFrameLoadInfo, IFrameLoadInfoWithData, LoadData, UpdatePipelineIdReason};
|
||||||
use script_traits::{MozBrowserEvent, NewLayoutInfo, ScriptMsg as ConstellationMsg};
|
use script_traits::{MozBrowserEvent, NewLayoutInfo, ScriptMsg};
|
||||||
use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
|
use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
use servo_config::prefs::PREFS;
|
use servo_config::prefs::PREFS;
|
||||||
|
@ -170,8 +170,8 @@ impl HTMLIFrameElement {
|
||||||
let (pipeline_sender, pipeline_receiver) = ipc::channel().unwrap();
|
let (pipeline_sender, pipeline_receiver) = ipc::channel().unwrap();
|
||||||
|
|
||||||
global_scope
|
global_scope
|
||||||
.constellation_chan()
|
.script_to_constellation_chan()
|
||||||
.send(ConstellationMsg::ScriptNewIFrame(load_info, pipeline_sender))
|
.send(ScriptMsg::ScriptNewIFrame(load_info, pipeline_sender))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let new_layout_info = NewLayoutInfo {
|
let new_layout_info = NewLayoutInfo {
|
||||||
|
@ -197,8 +197,8 @@ impl HTMLIFrameElement {
|
||||||
sandbox: sandboxed,
|
sandbox: sandboxed,
|
||||||
};
|
};
|
||||||
global_scope
|
global_scope
|
||||||
.constellation_chan()
|
.script_to_constellation_chan()
|
||||||
.send(ConstellationMsg::ScriptLoadedURLInIFrame(load_info))
|
.send(ScriptMsg::ScriptLoadedURLInIFrame(load_info))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,11 +349,9 @@ impl HTMLIFrameElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_visible(&self, visible: bool) {
|
pub fn set_visible(&self, visible: bool) {
|
||||||
if let Some(pipeline_id) = self.pipeline_id.get() {
|
let msg = ScriptMsg::SetVisible(visible);
|
||||||
let window = window_from_node(self);
|
let window = window_from_node(self);
|
||||||
let msg = ConstellationMsg::SetVisible(pipeline_id, visible);
|
window.upcast::<GlobalScope>().script_to_constellation_chan().send(msg).unwrap();
|
||||||
window.upcast::<GlobalScope>().constellation_chan().send(msg).unwrap();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#iframe-load-event-steps steps 1-4
|
/// https://html.spec.whatwg.org/multipage/#iframe-load-event-steps steps 1-4
|
||||||
|
@ -540,10 +538,10 @@ unsafe fn build_mozbrowser_event_detail(event: MozBrowserEvent,
|
||||||
|
|
||||||
pub fn Navigate(iframe: &HTMLIFrameElement, direction: TraversalDirection) -> ErrorResult {
|
pub fn Navigate(iframe: &HTMLIFrameElement, direction: TraversalDirection) -> ErrorResult {
|
||||||
if iframe.Mozbrowser() {
|
if iframe.Mozbrowser() {
|
||||||
if let Some(top_level_browsing_context_id) = iframe.top_level_browsing_context_id() {
|
if let Some(_) = iframe.top_level_browsing_context_id() {
|
||||||
let window = window_from_node(iframe);
|
let window = window_from_node(iframe);
|
||||||
let msg = ConstellationMsg::TraverseHistory(top_level_browsing_context_id, direction);
|
let msg = ScriptMsg::TraverseHistory(direction);
|
||||||
window.upcast::<GlobalScope>().constellation_chan().send(msg).unwrap();
|
window.upcast::<GlobalScope>().script_to_constellation_chan().send(msg).unwrap();
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -795,8 +793,8 @@ impl VirtualMethods for HTMLIFrameElement {
|
||||||
};
|
};
|
||||||
debug!("Unbinding frame {}.", browsing_context_id);
|
debug!("Unbinding frame {}.", browsing_context_id);
|
||||||
|
|
||||||
let msg = ConstellationMsg::RemoveIFrame(browsing_context_id, sender);
|
let msg = ScriptMsg::RemoveIFrame(browsing_context_id, sender);
|
||||||
window.upcast::<GlobalScope>().constellation_chan().send(msg).unwrap();
|
window.upcast::<GlobalScope>().script_to_constellation_chan().send(msg).unwrap();
|
||||||
let exited_pipeline_ids = receiver.recv().unwrap();
|
let exited_pipeline_ids = receiver.recv().unwrap();
|
||||||
|
|
||||||
// The spec for discarding is synchronous,
|
// The spec for discarding is synchronous,
|
||||||
|
|
|
@ -38,13 +38,13 @@ use dom::validitystate::ValidationFlags;
|
||||||
use dom::virtualmethods::VirtualMethods;
|
use dom::virtualmethods::VirtualMethods;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
use ipc_channel::ipc::{self, IpcSender};
|
use ipc_channel::ipc::channel;
|
||||||
use mime_guess;
|
use mime_guess;
|
||||||
use net_traits::{CoreResourceMsg, IpcSend};
|
use net_traits::{CoreResourceMsg, IpcSend};
|
||||||
use net_traits::blob_url_store::get_blob_origin;
|
use net_traits::blob_url_store::get_blob_origin;
|
||||||
use net_traits::filemanager_thread::{FileManagerThreadMsg, FilterPattern};
|
use net_traits::filemanager_thread::{FileManagerThreadMsg, FilterPattern};
|
||||||
use script_layout_interface::rpc::TextIndexResponse;
|
use script_layout_interface::rpc::TextIndexResponse;
|
||||||
use script_traits::ScriptMsg as ConstellationMsg;
|
use script_traits::ScriptToConstellationChan;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
@ -94,7 +94,7 @@ pub struct HTMLInputElement {
|
||||||
maxlength: Cell<i32>,
|
maxlength: Cell<i32>,
|
||||||
minlength: Cell<i32>,
|
minlength: Cell<i32>,
|
||||||
#[ignore_heap_size_of = "#7193"]
|
#[ignore_heap_size_of = "#7193"]
|
||||||
textinput: DOMRefCell<TextInput<IpcSender<ConstellationMsg>>>,
|
textinput: DOMRefCell<TextInput<ScriptToConstellationChan>>,
|
||||||
activation_state: DOMRefCell<InputActivationState>,
|
activation_state: DOMRefCell<InputActivationState>,
|
||||||
// https://html.spec.whatwg.org/multipage/#concept-input-value-dirty-flag
|
// https://html.spec.whatwg.org/multipage/#concept-input-value-dirty-flag
|
||||||
value_dirty: Cell<bool>,
|
value_dirty: Cell<bool>,
|
||||||
|
@ -136,7 +136,7 @@ static DEFAULT_MIN_LENGTH: i32 = -1;
|
||||||
|
|
||||||
impl HTMLInputElement {
|
impl HTMLInputElement {
|
||||||
fn new_inherited(local_name: LocalName, prefix: Option<Prefix>, document: &Document) -> HTMLInputElement {
|
fn new_inherited(local_name: LocalName, prefix: Option<Prefix>, document: &Document) -> HTMLInputElement {
|
||||||
let chan = document.window().upcast::<GlobalScope>().constellation_chan().clone();
|
let chan = document.window().upcast::<GlobalScope>().script_to_constellation_chan().clone();
|
||||||
HTMLInputElement {
|
HTMLInputElement {
|
||||||
htmlelement:
|
htmlelement:
|
||||||
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE | IN_READ_WRITE_STATE,
|
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE | IN_READ_WRITE_STATE,
|
||||||
|
@ -814,7 +814,7 @@ impl HTMLInputElement {
|
||||||
if self.Multiple() {
|
if self.Multiple() {
|
||||||
let opt_test_paths = opt_test_paths.map(|paths| paths.iter().map(|p| p.to_string()).collect());
|
let opt_test_paths = opt_test_paths.map(|paths| paths.iter().map(|p| p.to_string()).collect());
|
||||||
|
|
||||||
let (chan, recv) = ipc::channel().expect("Error initializing channel");
|
let (chan, recv) = channel().expect("Error initializing channel");
|
||||||
let msg = FileManagerThreadMsg::SelectFiles(filter, chan, origin, opt_test_paths);
|
let msg = FileManagerThreadMsg::SelectFiles(filter, chan, origin, opt_test_paths);
|
||||||
let _ = resource_threads.send(CoreResourceMsg::ToFileManager(msg)).unwrap();
|
let _ = resource_threads.send(CoreResourceMsg::ToFileManager(msg)).unwrap();
|
||||||
|
|
||||||
|
@ -838,7 +838,7 @@ impl HTMLInputElement {
|
||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let (chan, recv) = ipc::channel().expect("Error initializing channel");
|
let (chan, recv) = channel().expect("Error initializing channel");
|
||||||
let msg = FileManagerThreadMsg::SelectFile(filter, chan, origin, opt_test_path);
|
let msg = FileManagerThreadMsg::SelectFile(filter, chan, origin, opt_test_path);
|
||||||
let _ = resource_threads.send(CoreResourceMsg::ToFileManager(msg)).unwrap();
|
let _ = resource_threads.send(CoreResourceMsg::ToFileManager(msg)).unwrap();
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
use net_traits::ReferrerPolicy;
|
use net_traits::ReferrerPolicy;
|
||||||
use script_layout_interface::message::Msg;
|
use script_layout_interface::message::Msg;
|
||||||
use script_traits::{MozBrowserEvent, ScriptMsg as ConstellationMsg};
|
use script_traits::{MozBrowserEvent, ScriptMsg};
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
|
@ -309,8 +309,8 @@ impl HTMLLinkElement {
|
||||||
let document = document_from_node(self);
|
let document = document_from_node(self);
|
||||||
match document.base_url().join(href) {
|
match document.base_url().join(href) {
|
||||||
Ok(url) => {
|
Ok(url) => {
|
||||||
let event = ConstellationMsg::NewFavicon(url.clone());
|
let event = ScriptMsg::NewFavicon(url.clone());
|
||||||
document.window().upcast::<GlobalScope>().constellation_chan().send(event).unwrap();
|
document.window().upcast::<GlobalScope>().script_to_constellation_chan().send(event).unwrap();
|
||||||
|
|
||||||
let mozbrowser_event = match *sizes {
|
let mozbrowser_event = match *sizes {
|
||||||
Some(ref sizes) => MozBrowserEvent::IconChange(rel.to_owned(), url.to_string(), sizes.to_owned()),
|
Some(ref sizes) => MozBrowserEvent::IconChange(rel.to_owned(), url.to_string(), sizes.to_owned()),
|
||||||
|
|
|
@ -27,8 +27,7 @@ use dom::validation::Validatable;
|
||||||
use dom::virtualmethods::VirtualMethods;
|
use dom::virtualmethods::VirtualMethods;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
use ipc_channel::ipc::IpcSender;
|
use script_traits::ScriptToConstellationChan;
|
||||||
use script_traits::ScriptMsg as ConstellationMsg;
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
|
@ -40,7 +39,7 @@ use textinput::{KeyReaction, Lines, SelectionDirection, TextInput};
|
||||||
pub struct HTMLTextAreaElement {
|
pub struct HTMLTextAreaElement {
|
||||||
htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
#[ignore_heap_size_of = "#7193"]
|
#[ignore_heap_size_of = "#7193"]
|
||||||
textinput: DOMRefCell<TextInput<IpcSender<ConstellationMsg>>>,
|
textinput: DOMRefCell<TextInput<ScriptToConstellationChan>>,
|
||||||
placeholder: DOMRefCell<DOMString>,
|
placeholder: DOMRefCell<DOMString>,
|
||||||
// https://html.spec.whatwg.org/multipage/#concept-textarea-dirty
|
// https://html.spec.whatwg.org/multipage/#concept-textarea-dirty
|
||||||
value_changed: Cell<bool>,
|
value_changed: Cell<bool>,
|
||||||
|
@ -109,7 +108,7 @@ impl HTMLTextAreaElement {
|
||||||
fn new_inherited(local_name: LocalName,
|
fn new_inherited(local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document) -> HTMLTextAreaElement {
|
document: &Document) -> HTMLTextAreaElement {
|
||||||
let chan = document.window().upcast::<GlobalScope>().constellation_chan().clone();
|
let chan = document.window().upcast::<GlobalScope>().script_to_constellation_chan().clone();
|
||||||
HTMLTextAreaElement {
|
HTMLTextAreaElement {
|
||||||
htmlelement:
|
htmlelement:
|
||||||
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE | IN_READ_WRITE_STATE,
|
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE | IN_READ_WRITE_STATE,
|
||||||
|
|
|
@ -93,7 +93,7 @@ impl ServiceWorkerMethods for ServiceWorker {
|
||||||
let msg_vec = DOMMessage(data.move_to_arraybuffer());
|
let msg_vec = DOMMessage(data.move_to_arraybuffer());
|
||||||
let _ =
|
let _ =
|
||||||
self.global()
|
self.global()
|
||||||
.constellation_chan()
|
.script_to_constellation_chan()
|
||||||
.send(ScriptMsg::ForwardDOMMessage(msg_vec, self.scope_url.clone()));
|
.send(ScriptMsg::ForwardDOMMessage(msg_vec, self.scope_url.clone()));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,11 +151,10 @@ impl Storage {
|
||||||
/// https://html.spec.whatwg.org/multipage/#send-a-storage-notification
|
/// https://html.spec.whatwg.org/multipage/#send-a-storage-notification
|
||||||
fn broadcast_change_notification(&self, key: Option<String>, old_value: Option<String>,
|
fn broadcast_change_notification(&self, key: Option<String>, old_value: Option<String>,
|
||||||
new_value: Option<String>) {
|
new_value: Option<String>) {
|
||||||
let pipeline_id = self.global().pipeline_id();
|
|
||||||
let storage = self.storage_type;
|
let storage = self.storage_type;
|
||||||
let url = self.get_url();
|
let url = self.get_url();
|
||||||
let msg = ScriptMsg::BroadcastStorageEvent(pipeline_id, storage, url, key, old_value, new_value);
|
let msg = ScriptMsg::BroadcastStorageEvent(storage, url, key, old_value, new_value);
|
||||||
self.global().constellation_chan().send(msg).unwrap();
|
self.global().script_to_constellation_chan().send(msg).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#send-a-storage-notification
|
/// https://html.spec.whatwg.org/multipage/#send-a-storage-notification
|
||||||
|
|
|
@ -50,7 +50,7 @@ use js::typedarray::{TypedArray, TypedArrayElement, Float32, Int32};
|
||||||
use net_traits::image::base::PixelFormat;
|
use net_traits::image::base::PixelFormat;
|
||||||
use net_traits::image_cache::ImageResponse;
|
use net_traits::image_cache::ImageResponse;
|
||||||
use offscreen_gl_context::{GLContextAttributes, GLLimits};
|
use offscreen_gl_context::{GLContextAttributes, GLLimits};
|
||||||
use script_traits::ScriptMsg as ConstellationMsg;
|
use script_traits::ScriptMsg;
|
||||||
use servo_config::prefs::PREFS;
|
use servo_config::prefs::PREFS;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
@ -172,8 +172,8 @@ impl WebGLRenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
let constellation_chan = window.upcast::<GlobalScope>().constellation_chan();
|
let script_to_constellation_chan = window.upcast::<GlobalScope>().script_to_constellation_chan();
|
||||||
constellation_chan.send(ConstellationMsg::CreateWebGLPaintThread(size, attrs, sender))
|
script_to_constellation_chan.send(ScriptMsg::CreateWebGLPaintThread(size, attrs, sender))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let result = receiver.recv().unwrap();
|
let result = receiver.recv().unwrap();
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptThreadEventC
|
||||||
use script_thread::{ImageCacheMsg, MainThreadScriptChan, MainThreadScriptMsg, Runnable};
|
use script_thread::{ImageCacheMsg, MainThreadScriptChan, MainThreadScriptMsg, Runnable};
|
||||||
use script_thread::{RunnableWrapper, ScriptThread, SendableMainThreadScriptChan};
|
use script_thread::{RunnableWrapper, ScriptThread, SendableMainThreadScriptChan};
|
||||||
use script_traits::{ConstellationControlMsg, DocumentState, LoadData, MozBrowserEvent};
|
use script_traits::{ConstellationControlMsg, DocumentState, LoadData, MozBrowserEvent};
|
||||||
use script_traits::{ScriptMsg as ConstellationMsg, ScrollState, TimerEvent, TimerEventId};
|
use script_traits::{ScriptToConstellationChan, ScriptMsg, ScrollState, TimerEvent, TimerEventId};
|
||||||
use script_traits::{TimerSchedulerMsg, UntrustedNodeAddress, WindowSizeData, WindowSizeType};
|
use script_traits::{TimerSchedulerMsg, UntrustedNodeAddress, WindowSizeData, WindowSizeType};
|
||||||
use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
|
use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
|
||||||
use selectors::attr::CaseSensitivity;
|
use selectors::attr::CaseSensitivity;
|
||||||
|
@ -515,11 +515,7 @@ impl WindowMethods for Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
let global_scope = self.upcast::<GlobalScope>();
|
self.send_to_constellation(ScriptMsg::Alert(s.to_string(), sender));
|
||||||
global_scope
|
|
||||||
.constellation_chan()
|
|
||||||
.send(ConstellationMsg::Alert(global_scope.pipeline_id(), s.to_string(), sender))
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let should_display_alert_dialog = receiver.recv().unwrap();
|
let should_display_alert_dialog = receiver.recv().unwrap();
|
||||||
if should_display_alert_dialog {
|
if should_display_alert_dialog {
|
||||||
|
@ -918,10 +914,7 @@ impl WindowMethods for Window {
|
||||||
// Step 1
|
// Step 1
|
||||||
//TODO determine if this operation is allowed
|
//TODO determine if this operation is allowed
|
||||||
let size = Size2D::new(x.to_u32().unwrap_or(1), y.to_u32().unwrap_or(1));
|
let size = Size2D::new(x.to_u32().unwrap_or(1), y.to_u32().unwrap_or(1));
|
||||||
self.upcast::<GlobalScope>()
|
self.send_to_constellation(ScriptMsg::ResizeTo(size));
|
||||||
.constellation_chan()
|
|
||||||
.send(ConstellationMsg::ResizeTo(size))
|
|
||||||
.unwrap()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.csswg.org/cssom-view/#dom-window-resizeby
|
// https://drafts.csswg.org/cssom-view/#dom-window-resizeby
|
||||||
|
@ -936,10 +929,7 @@ impl WindowMethods for Window {
|
||||||
// Step 1
|
// Step 1
|
||||||
//TODO determine if this operation is allowed
|
//TODO determine if this operation is allowed
|
||||||
let point = Point2D::new(x, y);
|
let point = Point2D::new(x, y);
|
||||||
self.upcast::<GlobalScope>()
|
self.send_to_constellation(ScriptMsg::MoveTo(point));
|
||||||
.constellation_chan()
|
|
||||||
.send(ConstellationMsg::MoveTo(point))
|
|
||||||
.unwrap()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.csswg.org/cssom-view/#dom-window-moveby
|
// https://drafts.csswg.org/cssom-view/#dom-window-moveby
|
||||||
|
@ -1159,9 +1149,8 @@ impl Window {
|
||||||
scroll_offset: Vector2D::new(-x, -y),
|
scroll_offset: Vector2D::new(-x, -y),
|
||||||
})).unwrap();
|
})).unwrap();
|
||||||
|
|
||||||
let global_scope = self.upcast::<GlobalScope>();
|
let message = ScriptMsg::ScrollFragmentPoint(scroll_root_id, point, smooth);
|
||||||
let message = ConstellationMsg::ScrollFragmentPoint(scroll_root_id, point, smooth);
|
self.send_to_constellation(message);
|
||||||
global_scope.constellation_chan().send(message).unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_viewport_for_scroll(&self, x: f32, y: f32) {
|
pub fn update_viewport_for_scroll(&self, x: f32, y: f32) {
|
||||||
|
@ -1172,10 +1161,7 @@ impl Window {
|
||||||
|
|
||||||
pub fn client_window(&self) -> (Size2D<u32>, Point2D<i32>) {
|
pub fn client_window(&self) -> (Size2D<u32>, Point2D<i32>) {
|
||||||
let (send, recv) = ipc::channel::<(Size2D<u32>, Point2D<i32>)>().unwrap();
|
let (send, recv) = ipc::channel::<(Size2D<u32>, Point2D<i32>)>().unwrap();
|
||||||
self.upcast::<GlobalScope>()
|
self.send_to_constellation(ScriptMsg::GetClientWindow(send));
|
||||||
.constellation_chan()
|
|
||||||
.send(ConstellationMsg::GetClientWindow(send))
|
|
||||||
.unwrap();
|
|
||||||
recv.recv().unwrap_or((Size2D::zero(), Point2D::zero()))
|
recv.recv().unwrap_or((Size2D::zero(), Point2D::zero()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1371,9 +1357,8 @@ impl Window {
|
||||||
|
|
||||||
let pending_images = self.pending_layout_images.borrow().is_empty();
|
let pending_images = self.pending_layout_images.borrow().is_empty();
|
||||||
if ready_state == DocumentReadyState::Complete && !reftest_wait && pending_images {
|
if ready_state == DocumentReadyState::Complete && !reftest_wait && pending_images {
|
||||||
let global_scope = self.upcast::<GlobalScope>();
|
let event = ScriptMsg::SetDocumentState(DocumentState::Idle);
|
||||||
let event = ConstellationMsg::SetDocumentState(global_scope.pipeline_id(), DocumentState::Idle);
|
self.send_to_constellation(event);
|
||||||
global_scope.constellation_chan().send(event).unwrap();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1779,6 +1764,13 @@ impl Window {
|
||||||
self.navigation_start.set(now);
|
self.navigation_start.set(now);
|
||||||
self.navigation_start_precise.set(time::precise_time_ns() as f64);
|
self.navigation_start_precise.set(time::precise_time_ns() as f64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn send_to_constellation(&self, msg: ScriptMsg) {
|
||||||
|
self.upcast::<GlobalScope>()
|
||||||
|
.script_to_constellation_chan()
|
||||||
|
.send(msg)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Window {
|
impl Window {
|
||||||
|
@ -1797,7 +1789,7 @@ impl Window {
|
||||||
mem_profiler_chan: MemProfilerChan,
|
mem_profiler_chan: MemProfilerChan,
|
||||||
time_profiler_chan: TimeProfilerChan,
|
time_profiler_chan: TimeProfilerChan,
|
||||||
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||||
constellation_chan: IpcSender<ConstellationMsg>,
|
constellation_chan: ScriptToConstellationChan,
|
||||||
control_chan: IpcSender<ConstellationControlMsg>,
|
control_chan: IpcSender<ConstellationControlMsg>,
|
||||||
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||||
timer_event_chan: IpcSender<TimerEvent>,
|
timer_event_chan: IpcSender<TimerEvent>,
|
||||||
|
|
|
@ -55,7 +55,7 @@ pub fn prepare_workerscope_init(global: &GlobalScope,
|
||||||
to_devtools_sender: global.devtools_chan().cloned(),
|
to_devtools_sender: global.devtools_chan().cloned(),
|
||||||
time_profiler_chan: global.time_profiler_chan().clone(),
|
time_profiler_chan: global.time_profiler_chan().clone(),
|
||||||
from_devtools_sender: devtools_sender,
|
from_devtools_sender: devtools_sender,
|
||||||
constellation_chan: global.constellation_chan().clone(),
|
script_to_constellation_chan: global.script_to_constellation_chan().clone(),
|
||||||
scheduler_chan: global.scheduler_chan().clone(),
|
scheduler_chan: global.scheduler_chan().clone(),
|
||||||
worker_id: global.get_next_worker_id(),
|
worker_id: global.get_next_worker_id(),
|
||||||
pipeline_id: global.pipeline_id(),
|
pipeline_id: global.pipeline_id(),
|
||||||
|
@ -107,7 +107,7 @@ impl WorkerGlobalScope {
|
||||||
init.to_devtools_sender,
|
init.to_devtools_sender,
|
||||||
init.mem_profiler_chan,
|
init.mem_profiler_chan,
|
||||||
init.time_profiler_chan,
|
init.time_profiler_chan,
|
||||||
init.constellation_chan,
|
init.script_to_constellation_chan,
|
||||||
init.scheduler_chan,
|
init.scheduler_chan,
|
||||||
init.resource_threads,
|
init.resource_threads,
|
||||||
timer_event_chan,
|
timer_event_chan,
|
||||||
|
|
|
@ -609,7 +609,7 @@ impl WorkletThread {
|
||||||
if old_counter == 1 {
|
if old_counter == 1 {
|
||||||
debug!("Resolving promise.");
|
debug!("Resolving promise.");
|
||||||
let msg = MainThreadScriptMsg::WorkletLoaded(pipeline_id);
|
let msg = MainThreadScriptMsg::WorkletLoaded(pipeline_id);
|
||||||
self.global_init.script_sender.send(msg).expect("Worklet thread outlived script thread.");
|
self.global_init.to_script_thread_sender.send(msg).expect("Worklet thread outlived script thread.");
|
||||||
self.run_in_script_thread(promise.resolve_runnable(()));
|
self.run_in_script_thread(promise.resolve_runnable(()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -651,7 +651,7 @@ impl WorkletThread {
|
||||||
{
|
{
|
||||||
let msg = CommonScriptMsg::RunnableMsg(ScriptThreadEventCategory::WorkletEvent, box runnable);
|
let msg = CommonScriptMsg::RunnableMsg(ScriptThreadEventCategory::WorkletEvent, box runnable);
|
||||||
let msg = MainThreadScriptMsg::Common(msg);
|
let msg = MainThreadScriptMsg::Common(msg);
|
||||||
self.global_init.script_sender.send(msg).expect("Worklet thread outlived script thread.");
|
self.global_init.to_script_thread_sender.send(msg).expect("Worklet thread outlived script thread.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ use script_thread::MainThreadScriptMsg;
|
||||||
use script_thread::Runnable;
|
use script_thread::Runnable;
|
||||||
use script_thread::ScriptThread;
|
use script_thread::ScriptThread;
|
||||||
use script_traits::ScriptMsg;
|
use script_traits::ScriptMsg;
|
||||||
|
use script_traits::ScriptToConstellationChan;
|
||||||
use script_traits::TimerSchedulerMsg;
|
use script_traits::TimerSchedulerMsg;
|
||||||
use servo_url::ImmutableOrigin;
|
use servo_url::ImmutableOrigin;
|
||||||
use servo_url::MutableOrigin;
|
use servo_url::MutableOrigin;
|
||||||
|
@ -49,7 +50,7 @@ pub struct WorkletGlobalScope {
|
||||||
microtask_queue: MicrotaskQueue,
|
microtask_queue: MicrotaskQueue,
|
||||||
/// Sender back to the script thread
|
/// Sender back to the script thread
|
||||||
#[ignore_heap_size_of = "channels are hard"]
|
#[ignore_heap_size_of = "channels are hard"]
|
||||||
script_sender: Sender<MainThreadScriptMsg>,
|
to_script_thread_sender: Sender<MainThreadScriptMsg>,
|
||||||
/// Worklet task executor
|
/// Worklet task executor
|
||||||
executor: WorkletExecutor,
|
executor: WorkletExecutor,
|
||||||
}
|
}
|
||||||
|
@ -63,19 +64,23 @@ impl WorkletGlobalScope {
|
||||||
-> WorkletGlobalScope {
|
-> WorkletGlobalScope {
|
||||||
// Any timer events fired on this global are ignored.
|
// Any timer events fired on this global are ignored.
|
||||||
let (timer_event_chan, _) = ipc::channel().unwrap();
|
let (timer_event_chan, _) = ipc::channel().unwrap();
|
||||||
|
let script_to_constellation_chan = ScriptToConstellationChan {
|
||||||
|
sender: init.to_constellation_sender.clone(),
|
||||||
|
pipeline_id: pipeline_id,
|
||||||
|
};
|
||||||
WorkletGlobalScope {
|
WorkletGlobalScope {
|
||||||
globalscope: GlobalScope::new_inherited(pipeline_id,
|
globalscope: GlobalScope::new_inherited(pipeline_id,
|
||||||
init.devtools_chan.clone(),
|
init.devtools_chan.clone(),
|
||||||
init.mem_profiler_chan.clone(),
|
init.mem_profiler_chan.clone(),
|
||||||
init.time_profiler_chan.clone(),
|
init.time_profiler_chan.clone(),
|
||||||
init.constellation_chan.clone(),
|
script_to_constellation_chan,
|
||||||
init.scheduler_chan.clone(),
|
init.scheduler_chan.clone(),
|
||||||
init.resource_threads.clone(),
|
init.resource_threads.clone(),
|
||||||
timer_event_chan,
|
timer_event_chan,
|
||||||
MutableOrigin::new(ImmutableOrigin::new_opaque())),
|
MutableOrigin::new(ImmutableOrigin::new_opaque())),
|
||||||
base_url: base_url,
|
base_url: base_url,
|
||||||
microtask_queue: MicrotaskQueue::default(),
|
microtask_queue: MicrotaskQueue::default(),
|
||||||
script_sender: init.script_sender.clone(),
|
to_script_thread_sender: init.to_script_thread_sender.clone(),
|
||||||
executor: executor,
|
executor: executor,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +103,7 @@ impl WorkletGlobalScope {
|
||||||
{
|
{
|
||||||
let msg = CommonScriptMsg::RunnableMsg(ScriptThreadEventCategory::WorkletEvent, box runnable);
|
let msg = CommonScriptMsg::RunnableMsg(ScriptThreadEventCategory::WorkletEvent, box runnable);
|
||||||
let msg = MainThreadScriptMsg::Common(msg);
|
let msg = MainThreadScriptMsg::Common(msg);
|
||||||
self.script_sender.send(msg).expect("Worklet thread outlived script thread.");
|
self.to_script_thread_sender.send(msg).expect("Worklet thread outlived script thread.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send a message to layout.
|
/// Send a message to layout.
|
||||||
|
@ -156,7 +161,7 @@ impl WorkletGlobalScope {
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct WorkletGlobalScopeInit {
|
pub struct WorkletGlobalScopeInit {
|
||||||
/// Channel to the main script thread
|
/// Channel to the main script thread
|
||||||
pub script_sender: Sender<MainThreadScriptMsg>,
|
pub to_script_thread_sender: Sender<MainThreadScriptMsg>,
|
||||||
/// Channel to a resource thread
|
/// Channel to a resource thread
|
||||||
pub resource_threads: ResourceThreads,
|
pub resource_threads: ResourceThreads,
|
||||||
/// Channel to the memory profiler
|
/// Channel to the memory profiler
|
||||||
|
@ -166,7 +171,7 @@ pub struct WorkletGlobalScopeInit {
|
||||||
/// Channel to devtools
|
/// Channel to devtools
|
||||||
pub devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
pub devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||||
/// Messages to send to constellation
|
/// Messages to send to constellation
|
||||||
pub constellation_chan: IpcSender<ScriptMsg>,
|
pub to_constellation_sender: IpcSender<(PipelineId, ScriptMsg)>,
|
||||||
/// Message to send to the scheduler
|
/// Message to send to the scheduler
|
||||||
pub scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
pub scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||||
/// The image cache
|
/// The image cache
|
||||||
|
|
|
@ -87,7 +87,7 @@ use script_runtime::{ScriptPort, StackRootTLS, get_reports, new_rt_and_cx};
|
||||||
use script_traits::{CompositorEvent, ConstellationControlMsg};
|
use script_traits::{CompositorEvent, ConstellationControlMsg};
|
||||||
use script_traits::{DocumentActivity, DiscardBrowsingContext, EventResult};
|
use script_traits::{DocumentActivity, DiscardBrowsingContext, EventResult};
|
||||||
use script_traits::{InitialScriptState, LayoutMsg, LoadData, MouseButton, MouseEventType, MozBrowserEvent};
|
use script_traits::{InitialScriptState, LayoutMsg, LoadData, MouseButton, MouseEventType, MozBrowserEvent};
|
||||||
use script_traits::{NewLayoutInfo, ScriptMsg as ConstellationMsg, UpdatePipelineIdReason};
|
use script_traits::{NewLayoutInfo, ScriptToConstellationChan, ScriptMsg, UpdatePipelineIdReason};
|
||||||
use script_traits::{ScriptThreadFactory, TimerEvent, TimerSchedulerMsg, TimerSource};
|
use script_traits::{ScriptThreadFactory, TimerEvent, TimerSchedulerMsg, TimerSource};
|
||||||
use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress, WindowSizeData, WindowSizeType};
|
use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress, WindowSizeData, WindowSizeType};
|
||||||
use script_traits::CompositorEvent::{KeyEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent};
|
use script_traits::CompositorEvent::{KeyEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent};
|
||||||
|
@ -462,7 +462,7 @@ pub struct ScriptThread {
|
||||||
control_port: Receiver<ConstellationControlMsg>,
|
control_port: Receiver<ConstellationControlMsg>,
|
||||||
|
|
||||||
/// For communicating load url messages to the constellation
|
/// For communicating load url messages to the constellation
|
||||||
constellation_chan: IpcSender<ConstellationMsg>,
|
script_sender: IpcSender<(PipelineId, ScriptMsg)>,
|
||||||
|
|
||||||
/// A sender for new layout threads to communicate to the constellation.
|
/// A sender for new layout threads to communicate to the constellation.
|
||||||
layout_to_constellation_chan: IpcSender<LayoutMsg>,
|
layout_to_constellation_chan: IpcSender<LayoutMsg>,
|
||||||
|
@ -733,12 +733,12 @@ impl ScriptThread {
|
||||||
let script_thread = unsafe { &*root.get().unwrap() };
|
let script_thread = unsafe { &*root.get().unwrap() };
|
||||||
script_thread.worklet_thread_pool.borrow_mut().get_or_insert_with(|| {
|
script_thread.worklet_thread_pool.borrow_mut().get_or_insert_with(|| {
|
||||||
let init = WorkletGlobalScopeInit {
|
let init = WorkletGlobalScopeInit {
|
||||||
script_sender: script_thread.chan.0.clone(),
|
to_script_thread_sender: script_thread.chan.0.clone(),
|
||||||
resource_threads: script_thread.resource_threads.clone(),
|
resource_threads: script_thread.resource_threads.clone(),
|
||||||
mem_profiler_chan: script_thread.mem_profiler_chan.clone(),
|
mem_profiler_chan: script_thread.mem_profiler_chan.clone(),
|
||||||
time_profiler_chan: script_thread.time_profiler_chan.clone(),
|
time_profiler_chan: script_thread.time_profiler_chan.clone(),
|
||||||
devtools_chan: script_thread.devtools_chan.clone(),
|
devtools_chan: script_thread.devtools_chan.clone(),
|
||||||
constellation_chan: script_thread.constellation_chan.clone(),
|
to_constellation_sender: script_thread.script_sender.clone(),
|
||||||
scheduler_chan: script_thread.scheduler_chan.clone(),
|
scheduler_chan: script_thread.scheduler_chan.clone(),
|
||||||
image_cache: script_thread.image_cache.clone(),
|
image_cache: script_thread.image_cache.clone(),
|
||||||
};
|
};
|
||||||
|
@ -844,7 +844,7 @@ impl ScriptThread {
|
||||||
|
|
||||||
control_chan: state.control_chan,
|
control_chan: state.control_chan,
|
||||||
control_port: control_port,
|
control_port: control_port,
|
||||||
constellation_chan: state.constellation_chan,
|
script_sender: state.script_to_constellation_chan.sender.clone(),
|
||||||
time_profiler_chan: state.time_profiler_chan,
|
time_profiler_chan: state.time_profiler_chan,
|
||||||
mem_profiler_chan: state.mem_profiler_chan,
|
mem_profiler_chan: state.mem_profiler_chan,
|
||||||
|
|
||||||
|
@ -1532,7 +1532,7 @@ impl ScriptThread {
|
||||||
fn handle_visibility_change_msg(&self, id: PipelineId, visible: bool) {
|
fn handle_visibility_change_msg(&self, id: PipelineId, visible: bool) {
|
||||||
// Separate message sent since parent script thread could be different (Iframe of different
|
// Separate message sent since parent script thread could be different (Iframe of different
|
||||||
// domain)
|
// domain)
|
||||||
self.constellation_chan.send(ConstellationMsg::VisibilityChangeComplete(id, visible)).unwrap();
|
self.script_sender.send((id, ScriptMsg::VisibilityChangeComplete(visible))).unwrap();
|
||||||
|
|
||||||
let window = self.documents.borrow().find_window(id);
|
let window = self.documents.borrow().find_window(id);
|
||||||
match window {
|
match window {
|
||||||
|
@ -1632,13 +1632,13 @@ impl ScriptThread {
|
||||||
/// constellation to shut down the pipeline, which will clean everything up
|
/// constellation to shut down the pipeline, which will clean everything up
|
||||||
/// normally. If we do exit, we will tear down the DOM nodes, possibly at a point
|
/// normally. If we do exit, we will tear down the DOM nodes, possibly at a point
|
||||||
/// where layout is still accessing them.
|
/// where layout is still accessing them.
|
||||||
fn handle_exit_window_msg(&self, _: PipelineId) {
|
fn handle_exit_window_msg(&self, id: PipelineId) {
|
||||||
debug!("script thread handling exit window msg");
|
debug!("script thread handling exit window msg");
|
||||||
|
|
||||||
// TODO(tkuehn): currently there is only one window,
|
// TODO(tkuehn): currently there is only one window,
|
||||||
// so this can afford to be naive and just shut down the
|
// so this can afford to be naive and just shut down the
|
||||||
// constellation. In the future it'll need to be smarter.
|
// constellation. In the future it'll need to be smarter.
|
||||||
self.constellation_chan.send(ConstellationMsg::Exit).unwrap();
|
self.script_sender.send((id, ScriptMsg::Exit)).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// We have received notification that the response associated with a load has completed.
|
/// We have received notification that the response associated with a load has completed.
|
||||||
|
@ -1690,7 +1690,7 @@ impl ScriptThread {
|
||||||
|
|
||||||
let script_url = maybe_registration.get_installed().get_script_url();
|
let script_url = maybe_registration.get_installed().get_script_url();
|
||||||
let scope_things = ServiceWorkerRegistration::create_scope_things(window.upcast(), script_url);
|
let scope_things = ServiceWorkerRegistration::create_scope_things(window.upcast(), script_url);
|
||||||
let _ = self.constellation_chan.send(ConstellationMsg::RegisterServiceWorker(scope_things, scope.clone()));
|
let _ = self.script_sender.send((pipeline_id, ScriptMsg::RegisterServiceWorker(scope_things, scope.clone())));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dispatch_job_queue(&self, job_handler: Box<AsyncJobHandler>) {
|
pub fn dispatch_job_queue(&self, job_handler: Box<AsyncJobHandler>) {
|
||||||
|
@ -1707,7 +1707,7 @@ impl ScriptThread {
|
||||||
Some(document) => document,
|
Some(document) => document,
|
||||||
None => return warn!("Message sent to closed pipeline {}.", pipeline_id),
|
None => return warn!("Message sent to closed pipeline {}.", pipeline_id),
|
||||||
};
|
};
|
||||||
document.send_title_to_compositor();
|
document.send_title_to_constellation();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handles a request to exit a pipeline and shut down layout.
|
/// Handles a request to exit a pipeline and shut down layout.
|
||||||
|
@ -1747,7 +1747,7 @@ impl ScriptThread {
|
||||||
debug!("shutting down layout for page {}", id);
|
debug!("shutting down layout for page {}", id);
|
||||||
let _ = response_port.recv();
|
let _ = response_port.recv();
|
||||||
chan.send(message::Msg::ExitNow).ok();
|
chan.send(message::Msg::ExitNow).ok();
|
||||||
self.constellation_chan.send(ConstellationMsg::PipelineExited(id)).ok();
|
self.script_sender.send((id, ScriptMsg::PipelineExited)).ok();
|
||||||
|
|
||||||
debug!("Exited pipeline {}.", id);
|
debug!("Exited pipeline {}.", id);
|
||||||
}
|
}
|
||||||
|
@ -1872,15 +1872,15 @@ impl ScriptThread {
|
||||||
|
|
||||||
fn ask_constellation_for_browsing_context_id(&self, pipeline_id: PipelineId) -> Option<BrowsingContextId> {
|
fn ask_constellation_for_browsing_context_id(&self, pipeline_id: PipelineId) -> Option<BrowsingContextId> {
|
||||||
let (result_sender, result_receiver) = ipc::channel().unwrap();
|
let (result_sender, result_receiver) = ipc::channel().unwrap();
|
||||||
let msg = ConstellationMsg::GetBrowsingContextId(pipeline_id, result_sender);
|
let msg = ScriptMsg::GetBrowsingContextId(pipeline_id, result_sender);
|
||||||
self.constellation_chan.send(msg).expect("Failed to send to constellation.");
|
self.script_sender.send((pipeline_id, msg)).expect("Failed to send to constellation.");
|
||||||
result_receiver.recv().expect("Failed to get frame id from constellation.")
|
result_receiver.recv().expect("Failed to get frame id from constellation.")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ask_constellation_for_parent_info(&self, pipeline_id: PipelineId) -> Option<(PipelineId, FrameType)> {
|
fn ask_constellation_for_parent_info(&self, pipeline_id: PipelineId) -> Option<(PipelineId, FrameType)> {
|
||||||
let (result_sender, result_receiver) = ipc::channel().unwrap();
|
let (result_sender, result_receiver) = ipc::channel().unwrap();
|
||||||
let msg = ConstellationMsg::GetParentInfo(pipeline_id, result_sender);
|
let msg = ScriptMsg::GetParentInfo(pipeline_id, result_sender);
|
||||||
self.constellation_chan.send(msg).expect("Failed to send to constellation.");
|
self.script_sender.send((pipeline_id, msg)).expect("Failed to send to constellation.");
|
||||||
result_receiver.recv().expect("Failed to get frame id from constellation.")
|
result_receiver.recv().expect("Failed to get frame id from constellation.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1965,8 +1965,8 @@ impl ScriptThread {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// update the pipeline url
|
// update the pipeline url
|
||||||
self.constellation_chan
|
self.script_sender
|
||||||
.send(ConstellationMsg::SetFinalUrl(incomplete.pipeline_id, final_url.clone()))
|
.send((incomplete.pipeline_id, ScriptMsg::SetFinalUrl(final_url.clone())))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
debug!("ScriptThread: loading {} on pipeline {:?}", incomplete.url, incomplete.pipeline_id);
|
debug!("ScriptThread: loading {} on pipeline {:?}", incomplete.url, incomplete.pipeline_id);
|
||||||
|
@ -1986,6 +1986,11 @@ impl ScriptThread {
|
||||||
MutableOrigin::new(final_url.origin())
|
MutableOrigin::new(final_url.origin())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let script_to_constellation_chan = ScriptToConstellationChan {
|
||||||
|
sender: self.script_sender.clone(),
|
||||||
|
pipeline_id: incomplete.pipeline_id,
|
||||||
|
};
|
||||||
|
|
||||||
// Create the window and document objects.
|
// Create the window and document objects.
|
||||||
let window = Window::new(self.js_runtime.clone(),
|
let window = Window::new(self.js_runtime.clone(),
|
||||||
MainThreadScriptChan(sender.clone()),
|
MainThreadScriptChan(sender.clone()),
|
||||||
|
@ -2001,7 +2006,7 @@ impl ScriptThread {
|
||||||
self.mem_profiler_chan.clone(),
|
self.mem_profiler_chan.clone(),
|
||||||
self.time_profiler_chan.clone(),
|
self.time_profiler_chan.clone(),
|
||||||
self.devtools_chan.clone(),
|
self.devtools_chan.clone(),
|
||||||
self.constellation_chan.clone(),
|
script_to_constellation_chan,
|
||||||
self.control_chan.clone(),
|
self.control_chan.clone(),
|
||||||
self.scheduler_chan.clone(),
|
self.scheduler_chan.clone(),
|
||||||
ipc_timer_event_chan,
|
ipc_timer_event_chan,
|
||||||
|
@ -2071,8 +2076,8 @@ impl ScriptThread {
|
||||||
|
|
||||||
window.init_document(&document);
|
window.init_document(&document);
|
||||||
|
|
||||||
self.constellation_chan
|
self.script_sender
|
||||||
.send(ConstellationMsg::ActivateDocument(incomplete.pipeline_id))
|
.send((incomplete.pipeline_id, ScriptMsg::ActivateDocument))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Notify devtools that a new script global exists.
|
// Notify devtools that a new script global exists.
|
||||||
|
@ -2199,8 +2204,8 @@ impl ScriptThread {
|
||||||
url.join(&value).map(|url| url.to_string()).ok()
|
url.join(&value).map(|url| url.to_string()).ok()
|
||||||
});
|
});
|
||||||
|
|
||||||
let event = ConstellationMsg::NodeStatus(status);
|
let event = ScriptMsg::NodeStatus(status);
|
||||||
self.constellation_chan.send(event).unwrap();
|
self.script_sender.send((pipeline_id, event)).unwrap();
|
||||||
|
|
||||||
state_already_changed = true;
|
state_already_changed = true;
|
||||||
}
|
}
|
||||||
|
@ -2213,8 +2218,8 @@ impl ScriptThread {
|
||||||
.inclusive_ancestors()
|
.inclusive_ancestors()
|
||||||
.filter_map(Root::downcast::<HTMLAnchorElement>)
|
.filter_map(Root::downcast::<HTMLAnchorElement>)
|
||||||
.next() {
|
.next() {
|
||||||
let event = ConstellationMsg::NodeStatus(None);
|
let event = ScriptMsg::NodeStatus(None);
|
||||||
self.constellation_chan.send(event).unwrap();
|
self.script_sender.send((pipeline_id, event)).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2229,8 +2234,8 @@ impl ScriptThread {
|
||||||
} else {
|
} else {
|
||||||
EventResult::DefaultPrevented
|
EventResult::DefaultPrevented
|
||||||
};
|
};
|
||||||
let message = ConstellationMsg::TouchEventProcessed(result);
|
let message = ScriptMsg::TouchEventProcessed(result);
|
||||||
self.constellation_chan.send(message).unwrap();
|
self.script_sender.send((pipeline_id, message)).unwrap();
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
// TODO: Calling preventDefault on a touchup event should prevent clicks.
|
// TODO: Calling preventDefault on a touchup event should prevent clicks.
|
||||||
|
@ -2251,7 +2256,7 @@ impl ScriptThread {
|
||||||
Some(document) => document,
|
Some(document) => document,
|
||||||
None => return warn!("Message sent to closed pipeline {}.", pipeline_id),
|
None => return warn!("Message sent to closed pipeline {}.", pipeline_id),
|
||||||
};
|
};
|
||||||
document.dispatch_key_event(ch, key, state, modifiers, &self.constellation_chan);
|
document.dispatch_key_event(ch, key, state, modifiers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2299,8 +2304,8 @@ impl ScriptThread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
self.constellation_chan
|
self.script_sender
|
||||||
.send(ConstellationMsg::LoadUrl(parent_pipeline_id, load_data, replace))
|
.send((parent_pipeline_id, ScriptMsg::LoadUrl(load_data, replace)))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2360,7 +2365,7 @@ impl ScriptThread {
|
||||||
let context = ParserContext::new(id, load_data.url);
|
let context = ParserContext::new(id, load_data.url);
|
||||||
self.incomplete_parser_contexts.borrow_mut().push((id, context));
|
self.incomplete_parser_contexts.borrow_mut().push((id, context));
|
||||||
|
|
||||||
self.constellation_chan.send(ConstellationMsg::InitiateNavigateRequest(req_init, id)).unwrap();
|
self.script_sender.send((id, ScriptMsg::InitiateNavigateRequest(req_init))).unwrap();
|
||||||
self.incomplete_loads.borrow_mut().push(incomplete);
|
self.incomplete_loads.borrow_mut().push(incomplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ use canvas_traits::CanvasMsg;
|
||||||
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
|
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
|
||||||
use euclid::{Point2D, Size2D, TypedSize2D};
|
use euclid::{Point2D, Size2D, TypedSize2D};
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use msg::constellation_msg::{BrowsingContextId, TopLevelBrowsingContextId, FrameType, PipelineId, TraversalDirection};
|
use msg::constellation_msg::{BrowsingContextId, FrameType, PipelineId, TraversalDirection};
|
||||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
|
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
|
||||||
use net_traits::CoreResourceMsg;
|
use net_traits::CoreResourceMsg;
|
||||||
use net_traits::request::RequestInit;
|
use net_traits::request::RequestInit;
|
||||||
|
@ -69,12 +69,12 @@ pub enum LogEntry {
|
||||||
pub enum ScriptMsg {
|
pub enum ScriptMsg {
|
||||||
/// Requests are sent to constellation and fetches are checked manually
|
/// Requests are sent to constellation and fetches are checked manually
|
||||||
/// for cross-origin loads
|
/// for cross-origin loads
|
||||||
InitiateNavigateRequest(RequestInit, PipelineId),
|
InitiateNavigateRequest(RequestInit),
|
||||||
/// Broadcast a storage event to every same-origin pipeline.
|
/// Broadcast a storage event to every same-origin pipeline.
|
||||||
/// The strings are key, old value and new value.
|
/// The strings are key, old value and new value.
|
||||||
BroadcastStorageEvent(PipelineId, StorageType, ServoUrl, Option<String>, Option<String>, Option<String>),
|
BroadcastStorageEvent(StorageType, ServoUrl, Option<String>, Option<String>, Option<String>),
|
||||||
/// Indicates whether this pipeline is currently running animations.
|
/// Indicates whether this pipeline is currently running animations.
|
||||||
ChangeRunningAnimationsState(PipelineId, AnimationState),
|
ChangeRunningAnimationsState(AnimationState),
|
||||||
/// Requests that a new 2D canvas thread be created. (This is done in the constellation because
|
/// Requests that a new 2D canvas thread be created. (This is done in the constellation because
|
||||||
/// 2D canvases may use the GPU and we don't want to give untrusted content access to the GPU.)
|
/// 2D canvases may use the GPU and we don't want to give untrusted content access to the GPU.)
|
||||||
CreateCanvasPaintThread(Size2D<i32>, IpcSender<IpcSender<CanvasMsg>>),
|
CreateCanvasPaintThread(Size2D<i32>, IpcSender<IpcSender<CanvasMsg>>),
|
||||||
|
@ -84,7 +84,7 @@ pub enum ScriptMsg {
|
||||||
GLContextAttributes,
|
GLContextAttributes,
|
||||||
IpcSender<Result<(IpcSender<CanvasMsg>, GLLimits), String>>),
|
IpcSender<Result<(IpcSender<CanvasMsg>, GLLimits), String>>),
|
||||||
/// Notifies the constellation that this frame has received focus.
|
/// Notifies the constellation that this frame has received focus.
|
||||||
Focus(PipelineId),
|
Focus,
|
||||||
/// Forward an event that was sent to the parent window.
|
/// Forward an event that was sent to the parent window.
|
||||||
ForwardEvent(PipelineId, CompositorEvent),
|
ForwardEvent(PipelineId, CompositorEvent),
|
||||||
/// Requests that the constellation retrieve the current contents of the clipboard
|
/// Requests that the constellation retrieve the current contents of the clipboard
|
||||||
|
@ -97,18 +97,18 @@ pub enum ScriptMsg {
|
||||||
HeadParsed,
|
HeadParsed,
|
||||||
/// All pending loads are complete, and the `load` event for this pipeline
|
/// All pending loads are complete, and the `load` event for this pipeline
|
||||||
/// has been dispatched.
|
/// has been dispatched.
|
||||||
LoadComplete(PipelineId),
|
LoadComplete,
|
||||||
/// A new load has been requested, with an option to replace the current entry once loaded
|
/// A new load has been requested, with an option to replace the current entry once loaded
|
||||||
/// instead of adding a new entry.
|
/// instead of adding a new entry.
|
||||||
LoadUrl(PipelineId, LoadData, bool),
|
LoadUrl(LoadData, bool),
|
||||||
/// Post a message to the currently active window of a given browsing context.
|
/// Post a message to the currently active window of a given browsing context.
|
||||||
PostMessage(BrowsingContextId, Option<ImmutableOrigin>, Vec<u8>),
|
PostMessage(BrowsingContextId, Option<ImmutableOrigin>, Vec<u8>),
|
||||||
/// Dispatch a mozbrowser event to the parent of a mozbrowser iframe.
|
/// Dispatch a mozbrowser event to the parent of a mozbrowser iframe.
|
||||||
MozBrowserEvent(PipelineId, TopLevelBrowsingContextId, MozBrowserEvent),
|
MozBrowserEvent(PipelineId, MozBrowserEvent),
|
||||||
/// HTMLIFrameElement Forward or Back traversal.
|
/// HTMLIFrameElement Forward or Back traversal.
|
||||||
TraverseHistory(TopLevelBrowsingContextId, TraversalDirection),
|
TraverseHistory(TraversalDirection),
|
||||||
/// Gets the length of the joint session history from the constellation.
|
/// Gets the length of the joint session history from the constellation.
|
||||||
JointSessionHistoryLength(TopLevelBrowsingContextId, IpcSender<u32>),
|
JointSessionHistoryLength(IpcSender<u32>),
|
||||||
/// Favicon detected
|
/// Favicon detected
|
||||||
NewFavicon(ServoUrl),
|
NewFavicon(ServoUrl),
|
||||||
/// Status message to be displayed in the chrome, eg. a link URL on mouseover.
|
/// Status message to be displayed in the chrome, eg. a link URL on mouseover.
|
||||||
|
@ -117,9 +117,9 @@ pub enum ScriptMsg {
|
||||||
/// Returns a list of pipelines which were closed.
|
/// Returns a list of pipelines which were closed.
|
||||||
RemoveIFrame(BrowsingContextId, IpcSender<Vec<PipelineId>>),
|
RemoveIFrame(BrowsingContextId, IpcSender<Vec<PipelineId>>),
|
||||||
/// Change pipeline visibility
|
/// Change pipeline visibility
|
||||||
SetVisible(PipelineId, bool),
|
SetVisible(bool),
|
||||||
/// Notifies constellation that an iframe's visibility has been changed.
|
/// Notifies constellation that an iframe's visibility has been changed.
|
||||||
VisibilityChangeComplete(PipelineId, bool),
|
VisibilityChangeComplete(bool),
|
||||||
/// A load has been requested in an IFrame.
|
/// A load has been requested in an IFrame.
|
||||||
ScriptLoadedURLInIFrame(IFrameLoadInfoWithData),
|
ScriptLoadedURLInIFrame(IFrameLoadInfoWithData),
|
||||||
/// A load of the initial `about:blank` has been completed in an IFrame.
|
/// A load of the initial `about:blank` has been completed in an IFrame.
|
||||||
|
@ -127,18 +127,18 @@ pub enum ScriptMsg {
|
||||||
/// Requests that the constellation set the contents of the clipboard
|
/// Requests that the constellation set the contents of the clipboard
|
||||||
SetClipboardContents(String),
|
SetClipboardContents(String),
|
||||||
/// Mark a new document as active
|
/// Mark a new document as active
|
||||||
ActivateDocument(PipelineId),
|
ActivateDocument,
|
||||||
/// Set the document state for a pipeline (used by screenshot / reftests)
|
/// Set the document state for a pipeline (used by screenshot / reftests)
|
||||||
SetDocumentState(PipelineId, DocumentState),
|
SetDocumentState(DocumentState),
|
||||||
/// Update the pipeline Url, which can change after redirections.
|
/// Update the pipeline Url, which can change after redirections.
|
||||||
SetFinalUrl(PipelineId, ServoUrl),
|
SetFinalUrl(ServoUrl),
|
||||||
/// Check if an alert dialog box should be presented
|
/// Check if an alert dialog box should be presented
|
||||||
Alert(PipelineId, String, IpcSender<bool>),
|
Alert(String, IpcSender<bool>),
|
||||||
/// Scroll a page in a window
|
/// Scroll a page in a window
|
||||||
ScrollFragmentPoint(ClipId, Point2D<f32>, bool),
|
ScrollFragmentPoint(ClipId, Point2D<f32>, bool),
|
||||||
/// Set title of current page
|
/// Set title of current page
|
||||||
/// https://html.spec.whatwg.org/multipage/#document.title
|
/// https://html.spec.whatwg.org/multipage/#document.title
|
||||||
SetTitle(PipelineId, Option<String>),
|
SetTitle(Option<String>),
|
||||||
/// Send a key event
|
/// Send a key event
|
||||||
SendKeyEvent(Option<char>, Key, KeyState, KeyModifiers),
|
SendKeyEvent(Option<char>, Key, KeyState, KeyModifiers),
|
||||||
/// Get Window Informations size and position
|
/// Get Window Informations size and position
|
||||||
|
@ -150,9 +150,9 @@ pub enum ScriptMsg {
|
||||||
/// Script has handled a touch event, and either prevented or allowed default actions.
|
/// Script has handled a touch event, and either prevented or allowed default actions.
|
||||||
TouchEventProcessed(EventResult),
|
TouchEventProcessed(EventResult),
|
||||||
/// A log entry, with the top-level browsing context id and thread name
|
/// A log entry, with the top-level browsing context id and thread name
|
||||||
LogEntry(Option<TopLevelBrowsingContextId>, Option<String>, LogEntry),
|
LogEntry(Option<String>, LogEntry),
|
||||||
/// Notifies the constellation that this pipeline has exited.
|
/// Notifies the constellation that this pipeline has exited.
|
||||||
PipelineExited(PipelineId),
|
PipelineExited,
|
||||||
/// Send messages from postMessage calls from serviceworker
|
/// Send messages from postMessage calls from serviceworker
|
||||||
/// to constellation for storing in service worker manager
|
/// to constellation for storing in service worker manager
|
||||||
ForwardDOMMessage(DOMMessage, ServoUrl),
|
ForwardDOMMessage(DOMMessage, ServoUrl),
|
||||||
|
|
|
@ -88,7 +88,7 @@ use profile::mem as profile_mem;
|
||||||
use profile::time as profile_time;
|
use profile::time as profile_time;
|
||||||
use profile_traits::mem;
|
use profile_traits::mem;
|
||||||
use profile_traits::time;
|
use profile_traits::time;
|
||||||
use script_traits::{ConstellationMsg, SWManagerSenders, ScriptMsg};
|
use script_traits::{ConstellationMsg, SWManagerSenders, ScriptToConstellationChan};
|
||||||
use servo_config::opts;
|
use servo_config::opts;
|
||||||
use servo_config::prefs::PREFS;
|
use servo_config::prefs::PREFS;
|
||||||
use servo_config::resource_files::resources_dir_path;
|
use servo_config::resource_files::resources_dir_path;
|
||||||
|
@ -354,10 +354,10 @@ impl<Log1, Log2> Log for BothLogger<Log1, Log2> where Log1: Log, Log2: Log {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_logger(constellation_chan: IpcSender<ScriptMsg>) {
|
pub fn set_logger(script_to_constellation_chan: ScriptToConstellationChan) {
|
||||||
log::set_logger(|max_log_level| {
|
log::set_logger(|max_log_level| {
|
||||||
let env_logger = EnvLogger::new();
|
let env_logger = EnvLogger::new();
|
||||||
let con_logger = FromScriptLogger::new(constellation_chan);
|
let con_logger = FromScriptLogger::new(script_to_constellation_chan);
|
||||||
let filter = max(env_logger.filter(), con_logger.filter());
|
let filter = max(env_logger.filter(), con_logger.filter());
|
||||||
let logger = BothLogger(env_logger, con_logger);
|
let logger = BothLogger(env_logger, con_logger);
|
||||||
max_log_level.set(filter);
|
max_log_level.set(filter);
|
||||||
|
@ -376,7 +376,7 @@ pub fn run_content_process(token: String) {
|
||||||
let unprivileged_content = unprivileged_content_receiver.recv().unwrap();
|
let unprivileged_content = unprivileged_content_receiver.recv().unwrap();
|
||||||
opts::set_defaults(unprivileged_content.opts());
|
opts::set_defaults(unprivileged_content.opts());
|
||||||
PREFS.extend(unprivileged_content.prefs());
|
PREFS.extend(unprivileged_content.prefs());
|
||||||
set_logger(unprivileged_content.constellation_chan());
|
set_logger(unprivileged_content.script_to_constellation_chan().clone());
|
||||||
|
|
||||||
// Enter the sandbox if necessary.
|
// Enter the sandbox if necessary.
|
||||||
if opts::get().sandbox {
|
if opts::get().sandbox {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue