diff options
Diffstat (limited to 'components/shared')
-rw-r--r-- | components/shared/compositing/lib.rs | 12 | ||||
-rw-r--r-- | components/shared/constellation/from_script_message.rs | 3 | ||||
-rw-r--r-- | components/shared/constellation/lib.rs | 2 | ||||
-rw-r--r-- | components/shared/constellation/structured_data/mod.rs | 4 | ||||
-rw-r--r-- | components/shared/constellation/structured_data/serializable.rs | 6 | ||||
-rw-r--r-- | components/shared/constellation/structured_data/transferable.rs | 10 | ||||
-rw-r--r-- | components/shared/embedder/input_events.rs | 56 | ||||
-rw-r--r-- | components/shared/embedder/webdriver.rs | 26 | ||||
-rw-r--r-- | components/shared/net/storage_thread.rs | 4 |
9 files changed, 112 insertions, 11 deletions
diff --git a/components/shared/compositing/lib.rs b/components/shared/compositing/lib.rs index 061dfe023df..d88217142cc 100644 --- a/components/shared/compositing/lib.rs +++ b/components/shared/compositing/lib.rs @@ -10,6 +10,7 @@ use base::id::{PipelineId, WebViewId}; use crossbeam_channel::Sender; use embedder_traits::{ AnimationState, EventLoopWaker, MouseButton, MouseButtonAction, TouchEventResult, + WebDriverMessageId, }; use euclid::Rect; use ipc_channel::ipc::IpcSender; @@ -101,9 +102,16 @@ pub enum CompositorMsg { /// The load of a page has completed LoadComplete(WebViewId), /// WebDriver mouse button event - WebDriverMouseButtonEvent(WebViewId, MouseButtonAction, MouseButton, f32, f32), + WebDriverMouseButtonEvent( + WebViewId, + MouseButtonAction, + MouseButton, + f32, + f32, + WebDriverMessageId, + ), /// WebDriver mouse move event - WebDriverMouseMoveEvent(WebViewId, f32, f32), + WebDriverMouseMoveEvent(WebViewId, f32, f32, WebDriverMessageId), // Webdriver wheel scroll event WebDriverWheelScrollEvent(WebViewId, f32, f32, f64, f64), diff --git a/components/shared/constellation/from_script_message.rs b/components/shared/constellation/from_script_message.rs index a5424abe6d1..fa391f93859 100644 --- a/components/shared/constellation/from_script_message.rs +++ b/components/shared/constellation/from_script_message.rs @@ -17,6 +17,7 @@ use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, Worke use embedder_traits::{ AnimationState, EmbedderMsg, FocusSequenceNumber, JSValue, JavaScriptEvaluationError, JavaScriptEvaluationId, MediaSessionEvent, TouchEventResult, ViewportDetails, + WebDriverMessageId, }; use euclid::default::Size2D as UntypedSize2D; use http::{HeaderMap, Method}; @@ -652,6 +653,8 @@ pub enum ScriptToConstellationMessage { JavaScriptEvaluationId, Result<JSValue, JavaScriptEvaluationError>, ), + /// Notify the completion of a webdriver command. + WebDriverInputComplete(WebDriverMessageId), } impl fmt::Debug for ScriptToConstellationMessage { diff --git a/components/shared/constellation/lib.rs b/components/shared/constellation/lib.rs index d85fbe31bdf..005295000c9 100644 --- a/components/shared/constellation/lib.rs +++ b/components/shared/constellation/lib.rs @@ -152,7 +152,7 @@ pub enum TraversalDirection { } /// A task on the <https://html.spec.whatwg.org/multipage/#port-message-queue> -#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)] +#[derive(Debug, Deserialize, MallocSizeOf, Serialize)] pub struct PortMessageTask { /// The origin of this task. pub origin: ImmutableOrigin, diff --git a/components/shared/constellation/structured_data/mod.rs b/components/shared/constellation/structured_data/mod.rs index 3fb9d0c5f67..81e3849e476 100644 --- a/components/shared/constellation/structured_data/mod.rs +++ b/components/shared/constellation/structured_data/mod.rs @@ -20,7 +20,7 @@ pub use transferable::*; /// A data-holder for serialized data and transferred objects. /// <https://html.spec.whatwg.org/multipage/#structuredserializewithtransfer> -#[derive(Clone, Debug, Default, Deserialize, MallocSizeOf, Serialize)] +#[derive(Debug, Default, Deserialize, MallocSizeOf, Serialize)] pub struct StructuredSerializedData { /// Data serialized by SpiderMonkey. pub serialized: Vec<u8>, @@ -32,6 +32,8 @@ pub struct StructuredSerializedData { pub exceptions: Option<HashMap<DomExceptionId, DomException>>, /// Transferred objects. pub ports: Option<HashMap<MessagePortId, MessagePortImpl>>, + /// Transform streams transferred objects. + pub transform_streams: Option<HashMap<MessagePortId, TransformStreamData>>, } impl StructuredSerializedData { diff --git a/components/shared/constellation/structured_data/serializable.rs b/components/shared/constellation/structured_data/serializable.rs index 194f0567c51..22370087665 100644 --- a/components/shared/constellation/structured_data/serializable.rs +++ b/components/shared/constellation/structured_data/serializable.rs @@ -88,7 +88,7 @@ impl Clone for BroadcastMsg { } /// File-based blob -#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)] +#[derive(Debug, Deserialize, MallocSizeOf, Serialize)] pub struct FileBlob { #[ignore_malloc_size_of = "Uuid are hard(not really)"] id: Uuid, @@ -164,7 +164,7 @@ impl BroadcastClone for BlobImpl { } /// The data backing a DOM Blob. -#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)] +#[derive(Debug, Deserialize, MallocSizeOf, Serialize)] pub struct BlobImpl { /// UUID of the blob. blob_id: BlobId, @@ -177,7 +177,7 @@ pub struct BlobImpl { } /// Different backends of Blob -#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)] +#[derive(Debug, Deserialize, MallocSizeOf, Serialize)] pub enum BlobData { /// File-based blob, whose content lives in the net process File(FileBlob), diff --git a/components/shared/constellation/structured_data/transferable.rs b/components/shared/constellation/structured_data/transferable.rs index 528c1e79e65..3210a41a538 100644 --- a/components/shared/constellation/structured_data/transferable.rs +++ b/components/shared/constellation/structured_data/transferable.rs @@ -15,6 +15,12 @@ use strum::EnumIter; use crate::PortMessageTask; +#[derive(Debug, Deserialize, MallocSizeOf, Serialize)] +pub struct TransformStreamData { + pub readable: (MessagePortId, MessagePortImpl), + pub writable: (MessagePortId, MessagePortImpl), +} + /// All the DOM interfaces that can be transferred. #[derive(Clone, Copy, Debug, EnumIter)] pub enum Transferrable { @@ -28,7 +34,7 @@ pub enum Transferrable { TransformStream, } -#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)] +#[derive(Debug, Deserialize, MallocSizeOf, Serialize)] enum MessagePortState { /// <https://html.spec.whatwg.org/multipage/#detached> Detached, @@ -42,7 +48,7 @@ enum MessagePortState { Disabled(bool), } -#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)] +#[derive(Debug, Deserialize, MallocSizeOf, Serialize)] /// The data and logic backing the DOM managed MessagePort. pub struct MessagePortImpl { /// The current state of the port. diff --git a/components/shared/embedder/input_events.rs b/components/shared/embedder/input_events.rs index acaa9afb3ff..869c4eee004 100644 --- a/components/shared/embedder/input_events.rs +++ b/components/shared/embedder/input_events.rs @@ -8,6 +8,8 @@ use malloc_size_of_derive::MallocSizeOf; use serde::{Deserialize, Serialize}; use webrender_api::units::DevicePoint; +use crate::WebDriverMessageId; + /// An input event that is sent from the embedder to Servo. #[derive(Clone, Debug, Deserialize, Serialize)] pub enum InputEvent { @@ -42,6 +44,38 @@ impl InputEvent { InputEvent::Wheel(event) => Some(event.point), } } + + pub fn webdriver_message_id(&self) -> Option<WebDriverMessageId> { + match self { + InputEvent::EditingAction(..) => None, + InputEvent::Gamepad(..) => None, + InputEvent::Ime(..) => None, + InputEvent::Keyboard(..) => None, + InputEvent::MouseButton(event) => event.webdriver_id, + InputEvent::MouseMove(event) => event.webdriver_id, + InputEvent::Touch(..) => None, + InputEvent::Wheel(..) => None, + } + } + + pub fn with_webdriver_message_id(self, webdriver_id: Option<WebDriverMessageId>) -> Self { + match self { + InputEvent::EditingAction(..) => {}, + InputEvent::Gamepad(..) => {}, + InputEvent::Ime(..) => {}, + InputEvent::Keyboard(..) => {}, + InputEvent::MouseButton(mut event) => { + event.webdriver_id = webdriver_id; + }, + InputEvent::MouseMove(mut event) => { + event.webdriver_id = webdriver_id; + }, + InputEvent::Touch(..) => {}, + InputEvent::Wheel(..) => {}, + }; + + self + } } #[derive(Clone, Copy, Debug, Deserialize, Serialize)] @@ -49,6 +83,18 @@ pub struct MouseButtonEvent { pub action: MouseButtonAction, pub button: MouseButton, pub point: DevicePoint, + webdriver_id: Option<WebDriverMessageId>, +} + +impl MouseButtonEvent { + pub fn new(action: MouseButtonAction, button: MouseButton, point: DevicePoint) -> Self { + Self { + action, + button, + point, + webdriver_id: None, + } + } } #[derive(Clone, Copy, Debug, Deserialize, Serialize)] @@ -102,6 +148,16 @@ pub enum MouseButtonAction { #[derive(Clone, Copy, Debug, Deserialize, Serialize)] pub struct MouseMoveEvent { pub point: DevicePoint, + webdriver_id: Option<WebDriverMessageId>, +} + +impl MouseMoveEvent { + pub fn new(point: DevicePoint) -> Self { + Self { + point, + webdriver_id: None, + } + } } /// The type of input represented by a multi-touch event. diff --git a/components/shared/embedder/webdriver.rs b/components/shared/embedder/webdriver.rs index 3716a29951a..e7118d32737 100644 --- a/components/shared/embedder/webdriver.rs +++ b/components/shared/embedder/webdriver.rs @@ -24,6 +24,9 @@ use webrender_api::units::DeviceIntSize; use crate::{MouseButton, MouseButtonAction}; +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub struct WebDriverMessageId(pub usize); + /// Messages to the constellation originating from the WebDriver server. #[derive(Debug, Deserialize, Serialize)] pub enum WebDriverCommandMsg { @@ -41,9 +44,23 @@ pub enum WebDriverCommandMsg { /// Act as if keys were pressed or release in the browsing context with the given ID. KeyboardAction(BrowsingContextId, KeyboardEvent), /// Act as if the mouse was clicked in the browsing context with the given ID. - MouseButtonAction(WebViewId, MouseButtonAction, MouseButton, f32, f32), + MouseButtonAction( + WebViewId, + MouseButtonAction, + MouseButton, + f32, + f32, + WebDriverMessageId, + IpcSender<WebDriverCommandResponse>, + ), /// Act as if the mouse was moved in the browsing context with the given ID. - MouseMoveAction(WebViewId, f32, f32), + MouseMoveAction( + WebViewId, + f32, + f32, + WebDriverMessageId, + IpcSender<WebDriverCommandResponse>, + ), /// Act as if the mouse wheel is scrolled in the browsing context given the given ID. WheelScrollAction(WebViewId, f32, f32, f64, f64), /// Set the window size. @@ -189,6 +206,11 @@ pub enum WebDriverFrameId { } #[derive(Debug, Deserialize, Serialize)] +pub struct WebDriverCommandResponse { + pub id: WebDriverMessageId, +} + +#[derive(Debug, Deserialize, Serialize)] pub enum WebDriverLoadStatus { Complete, Timeout, diff --git a/components/shared/net/storage_thread.rs b/components/shared/net/storage_thread.rs index 0253603016e..2ba0aa12445 100644 --- a/components/shared/net/storage_thread.rs +++ b/components/shared/net/storage_thread.rs @@ -4,6 +4,7 @@ use ipc_channel::ipc::IpcSender; use malloc_size_of_derive::MallocSizeOf; +use profile_traits::mem::ReportsChan; use serde::{Deserialize, Serialize}; use servo_url::ServoUrl; @@ -45,4 +46,7 @@ pub enum StorageThreadMsg { /// send a reply when done cleaning up thread resources and then shut it down Exit(IpcSender<()>), + + /// Measure memory used by this thread and send the report over the provided channel. + CollectMemoryReport(ReportsChan), } |