mirror of
https://github.com/servo/servo.git
synced 2025-07-29 02:00:23 +01:00
Split ConstellationMsg into ScriptMsg and CompositorMsg
This commit is contained in:
parent
afe03870ce
commit
19294db6e5
29 changed files with 259 additions and 210 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
use ipc_channel::ipc;
|
||||
use msg::constellation_msg::ConstellationChan;
|
||||
use msg::constellation_msg::Msg as ConstellationMsg;
|
||||
use msg::constellation_msg::ScriptMsg as ConstellationMsg;
|
||||
use std::borrow::ToOwned;
|
||||
use std::sync::mpsc::channel;
|
||||
|
||||
|
@ -15,7 +15,7 @@ pub trait ClipboardProvider {
|
|||
fn set_clipboard_contents(&mut self, String);
|
||||
}
|
||||
|
||||
impl ClipboardProvider for ConstellationChan {
|
||||
impl ClipboardProvider for ConstellationChan<ConstellationMsg> {
|
||||
fn clipboard_contents(&mut self) -> String {
|
||||
let (tx, rx) = ipc::channel().unwrap();
|
||||
self.0.send(ConstellationMsg::GetClipboardContents(tx)).unwrap();
|
||||
|
|
|
@ -18,6 +18,7 @@ use ipc_channel::ipc::IpcSender;
|
|||
use js::jsapi::{GetGlobalForObjectCrossCompartment};
|
||||
use js::jsapi::{JSContext, JSObject, JS_GetClass, MutableHandleValue};
|
||||
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
|
||||
use msg::constellation_msg::ScriptMsg as ConstellationMsg;
|
||||
use msg::constellation_msg::{ConstellationChan, PipelineId, WorkerId};
|
||||
use net_traits::ResourceTask;
|
||||
use profile_traits::mem;
|
||||
|
@ -91,7 +92,7 @@ impl<'a> GlobalRef<'a> {
|
|||
}
|
||||
|
||||
/// Get a `ConstellationChan` to send messages to the constellation channel when available.
|
||||
pub fn constellation_chan(&self) -> ConstellationChan {
|
||||
pub fn constellation_chan(&self) -> ConstellationChan<ConstellationMsg> {
|
||||
match *self {
|
||||
GlobalRef::Window(window) => window.constellation_chan(),
|
||||
GlobalRef::Worker(worker) => worker.constellation_chan(),
|
||||
|
|
|
@ -54,6 +54,7 @@ use js::rust::Runtime;
|
|||
use layout_interface::{LayoutChan, LayoutRPC};
|
||||
use libc;
|
||||
use msg::constellation_msg::ConstellationChan;
|
||||
use msg::constellation_msg::ScriptMsg as ConstellationMsg;
|
||||
use msg::constellation_msg::{PipelineId, SubpageId, WindowSizeData, WorkerId};
|
||||
use net_traits::Metadata;
|
||||
use net_traits::image::base::Image;
|
||||
|
@ -271,7 +272,7 @@ no_jsmanaged_fields!(WorkerId);
|
|||
no_jsmanaged_fields!(QuirksMode);
|
||||
no_jsmanaged_fields!(Runtime);
|
||||
no_jsmanaged_fields!(Headers, Method);
|
||||
no_jsmanaged_fields!(ConstellationChan);
|
||||
no_jsmanaged_fields!(ConstellationChan<ConstellationMsg>);
|
||||
no_jsmanaged_fields!(LayoutChan);
|
||||
no_jsmanaged_fields!(WindowProxyHandler);
|
||||
no_jsmanaged_fields!(UntrustedNodeAddress);
|
||||
|
|
|
@ -33,7 +33,7 @@ use euclid::point::Point2D;
|
|||
use euclid::rect::Rect;
|
||||
use euclid::size::Size2D;
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use msg::constellation_msg::Msg as ConstellationMsg;
|
||||
use msg::constellation_msg::ScriptMsg as ConstellationMsg;
|
||||
use net_traits::image::base::PixelFormat;
|
||||
use net_traits::image_cache_task::ImageResponse;
|
||||
use num::{Float, ToPrimitive};
|
||||
|
|
|
@ -80,7 +80,7 @@ use layout_interface::{LayoutChan, Msg};
|
|||
use layout_interface::{ReflowGoal, ReflowQueryType};
|
||||
use msg::compositor_msg::ScriptToCompositorMsg;
|
||||
use msg::constellation_msg::AnimationState;
|
||||
use msg::constellation_msg::Msg as ConstellationMsg;
|
||||
use msg::constellation_msg::ScriptMsg as ConstellationMsg;
|
||||
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
|
||||
use msg::constellation_msg::{ConstellationChan, FocusType, Key, KeyModifiers, KeyState, MozBrowserEvent, SubpageId};
|
||||
use net_traits::ControlMsg::{GetCookiesForUrl, SetCookiesForUrl};
|
||||
|
|
|
@ -18,7 +18,7 @@ use dom::htmlelement::HTMLElement;
|
|||
use dom::node::{Node, document_from_node, window_from_node};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use msg::constellation_msg::ConstellationChan;
|
||||
use msg::constellation_msg::Msg as ConstellationMsg;
|
||||
use msg::constellation_msg::ScriptMsg as ConstellationMsg;
|
||||
use std::rc::Rc;
|
||||
use string_cache::Atom;
|
||||
use time;
|
||||
|
|
|
@ -25,7 +25,7 @@ use dom::window::Window;
|
|||
use js::jsapi::{JSAutoCompartment, JSAutoRequest, RootedValue, JSContext, MutableHandleValue};
|
||||
use js::jsval::{UndefinedValue, NullValue};
|
||||
use msg::constellation_msg::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
|
||||
use msg::constellation_msg::Msg as ConstellationMsg;
|
||||
use msg::constellation_msg::ScriptMsg as ConstellationMsg;
|
||||
use msg::constellation_msg::{ConstellationChan, IframeLoadInfo, MozBrowserEvent};
|
||||
use msg::constellation_msg::{NavigationDirection, PipelineId, SubpageId};
|
||||
use page::IterablePage;
|
||||
|
|
|
@ -28,6 +28,7 @@ use dom::node::{document_from_node, window_from_node};
|
|||
use dom::nodelist::NodeList;
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use msg::constellation_msg::ConstellationChan;
|
||||
use msg::constellation_msg::ScriptMsg as ConstellationMsg;
|
||||
use selectors::states::*;
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::Cell;
|
||||
|
@ -64,7 +65,7 @@ pub struct HTMLInputElement {
|
|||
value_changed: Cell<bool>,
|
||||
size: Cell<u32>,
|
||||
#[ignore_heap_size_of = "#7193"]
|
||||
textinput: DOMRefCell<TextInput<ConstellationChan>>,
|
||||
textinput: DOMRefCell<TextInput<ConstellationChan<ConstellationMsg>>>,
|
||||
activation_state: DOMRefCell<InputActivationState>,
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ use encoding::all::UTF_8;
|
|||
use ipc_channel::ipc;
|
||||
use ipc_channel::router::ROUTER;
|
||||
use layout_interface::{LayoutChan, Msg};
|
||||
use msg::constellation_msg::Msg as ConstellationMsg;
|
||||
use msg::constellation_msg::ScriptMsg as ConstellationMsg;
|
||||
use msg::constellation_msg::{ConstellationChan, MozBrowserEvent};
|
||||
use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata};
|
||||
use network_listener::{NetworkListener, PreInvoke};
|
||||
|
|
|
@ -25,6 +25,7 @@ use dom::node::{document_from_node, window_from_node};
|
|||
use dom::nodelist::NodeList;
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use msg::constellation_msg::ConstellationChan;
|
||||
use msg::constellation_msg::ScriptMsg as ConstellationMsg;
|
||||
use script_task::ScriptTaskEventCategory::InputEvent;
|
||||
use script_task::{CommonScriptMsg, Runnable};
|
||||
use selectors::states::*;
|
||||
|
@ -37,7 +38,7 @@ use util::str::DOMString;
|
|||
pub struct HTMLTextAreaElement {
|
||||
htmlelement: HTMLElement,
|
||||
#[ignore_heap_size_of = "#7193"]
|
||||
textinput: DOMRefCell<TextInput<ConstellationChan>>,
|
||||
textinput: DOMRefCell<TextInput<ConstellationChan<ConstellationMsg>>>,
|
||||
cols: Cell<u32>,
|
||||
rows: Cell<u32>,
|
||||
// https://html.spec.whatwg.org/multipage/#concept-textarea-dirty
|
||||
|
|
|
@ -31,7 +31,7 @@ use ipc_channel::ipc::{self, IpcSender};
|
|||
use js::jsapi::{JSContext, JSObject, RootedValue};
|
||||
use js::jsapi::{JS_GetFloat32ArrayData, JS_GetObjectAsArrayBufferView};
|
||||
use js::jsval::{BooleanValue, Int32Value, JSVal, NullValue, UndefinedValue};
|
||||
use msg::constellation_msg::Msg as ConstellationMsg;
|
||||
use msg::constellation_msg::ScriptMsg as ConstellationMsg;
|
||||
use net_traits::image::base::PixelFormat;
|
||||
use net_traits::image_cache_task::ImageResponse;
|
||||
use offscreen_gl_context::GLContextAttributes;
|
||||
|
|
|
@ -43,6 +43,7 @@ use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ResolvedStyleRe
|
|||
use layout_interface::{LayoutChan, LayoutRPC, Msg, Reflow, ReflowGoal, ReflowQueryType};
|
||||
use libc;
|
||||
use msg::compositor_msg::{LayerId, ScriptToCompositorMsg};
|
||||
use msg::constellation_msg::ScriptMsg as ConstellationMsg;
|
||||
use msg::constellation_msg::{ConstellationChan, LoadData, PipelineId, SubpageId, WindowSizeData, WorkerId};
|
||||
use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
|
||||
use net_traits::ResourceTask;
|
||||
|
@ -191,7 +192,7 @@ pub struct Window {
|
|||
|
||||
/// A handle for communicating messages to the constellation task.
|
||||
#[ignore_heap_size_of = "channels are hard"]
|
||||
constellation_chan: ConstellationChan,
|
||||
constellation_chan: ConstellationChan<ConstellationMsg>,
|
||||
|
||||
/// Pending scroll to fragment event, if any
|
||||
fragment_name: DOMRefCell<Option<String>>,
|
||||
|
@ -1071,7 +1072,7 @@ impl Window {
|
|||
self.layout_chan.clone()
|
||||
}
|
||||
|
||||
pub fn constellation_chan(&self) -> ConstellationChan {
|
||||
pub fn constellation_chan(&self) -> ConstellationChan<ConstellationMsg> {
|
||||
self.constellation_chan.clone()
|
||||
}
|
||||
|
||||
|
@ -1224,7 +1225,7 @@ impl Window {
|
|||
storage_task: StorageTask,
|
||||
mem_profiler_chan: mem::ProfilerChan,
|
||||
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||
constellation_chan: ConstellationChan,
|
||||
constellation_chan: ConstellationChan<ConstellationMsg>,
|
||||
scheduler_chan: IpcSender<TimerEventRequest>,
|
||||
timer_event_chan: IpcSender<TimerEvent>,
|
||||
layout_chan: LayoutChan,
|
||||
|
|
|
@ -20,6 +20,7 @@ use dom::workernavigator::WorkerNavigator;
|
|||
use ipc_channel::ipc::IpcSender;
|
||||
use js::jsapi::{HandleValue, JSAutoRequest, JSContext};
|
||||
use js::rust::Runtime;
|
||||
use msg::constellation_msg::ScriptMsg as ConstellationMsg;
|
||||
use msg::constellation_msg::{ConstellationChan, PipelineId, WorkerId};
|
||||
use net_traits::{ResourceTask, load_whole_resource};
|
||||
use profile_traits::mem;
|
||||
|
@ -43,7 +44,7 @@ pub struct WorkerGlobalScopeInit {
|
|||
pub mem_profiler_chan: mem::ProfilerChan,
|
||||
pub to_devtools_sender: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||
pub from_devtools_sender: Option<IpcSender<DevtoolScriptControlMsg>>,
|
||||
pub constellation_chan: ConstellationChan,
|
||||
pub constellation_chan: ConstellationChan<ConstellationMsg>,
|
||||
pub scheduler_chan: IpcSender<TimerEventRequest>,
|
||||
pub worker_id: WorkerId,
|
||||
}
|
||||
|
@ -84,7 +85,7 @@ pub struct WorkerGlobalScope {
|
|||
devtools_wants_updates: Cell<bool>,
|
||||
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
constellation_chan: ConstellationChan,
|
||||
constellation_chan: ConstellationChan<ConstellationMsg>,
|
||||
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
scheduler_chan: IpcSender<TimerEventRequest>,
|
||||
|
@ -135,7 +136,7 @@ impl WorkerGlobalScope {
|
|||
&self.from_devtools_receiver
|
||||
}
|
||||
|
||||
pub fn constellation_chan(&self) -> ConstellationChan {
|
||||
pub fn constellation_chan(&self) -> ConstellationChan<ConstellationMsg> {
|
||||
self.constellation_chan.clone()
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
|||
use libc::uintptr_t;
|
||||
use msg::compositor_msg::Epoch;
|
||||
use msg::compositor_msg::LayerId;
|
||||
use msg::constellation_msg::ScriptMsg as ConstellationMsg;
|
||||
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
|
||||
use msg::constellation_msg::{WindowSizeData};
|
||||
use net_traits::image_cache_task::ImageCacheTask;
|
||||
|
@ -251,7 +252,7 @@ pub struct NewLayoutTaskInfo {
|
|||
pub is_parent: bool,
|
||||
pub layout_pair: OpaqueScriptLayoutChannel,
|
||||
pub pipeline_port: IpcReceiver<LayoutControlMsg>,
|
||||
pub constellation_chan: ConstellationChan,
|
||||
pub constellation_chan: ConstellationChan<ConstellationMsg>,
|
||||
pub failure: Failure,
|
||||
pub script_chan: Sender<ConstellationControlMsg>,
|
||||
pub image_cache_task: ImageCacheTask,
|
||||
|
|
|
@ -62,7 +62,7 @@ use layout_interface::{self, LayoutChan, NewLayoutTaskInfo, ReflowGoal, ScriptLa
|
|||
use libc;
|
||||
use mem::heap_size_of_self_and_children;
|
||||
use msg::compositor_msg::{EventResult, LayerId, ScriptToCompositorMsg};
|
||||
use msg::constellation_msg::Msg as ConstellationMsg;
|
||||
use msg::constellation_msg::ScriptMsg as ConstellationMsg;
|
||||
use msg::constellation_msg::{ConstellationChan, FocusType, LoadData};
|
||||
use msg::constellation_msg::{MozBrowserEvent, PipelineId};
|
||||
use msg::constellation_msg::{PipelineNamespace};
|
||||
|
@ -403,7 +403,7 @@ pub struct ScriptTask {
|
|||
control_port: Receiver<ConstellationControlMsg>,
|
||||
|
||||
/// For communicating load url messages to the constellation
|
||||
constellation_chan: ConstellationChan,
|
||||
constellation_chan: ConstellationChan<ConstellationMsg>,
|
||||
|
||||
/// A handle to the compositor for communicating ready state messages.
|
||||
compositor: DOMRefCell<IpcSender<ScriptToCompositorMsg>>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue