mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
continue messageport, transferable, postmessage options
This commit is contained in:
parent
c3b17c1201
commit
2f8932a6a1
100 changed files with 2456 additions and 1171 deletions
|
@ -17,8 +17,10 @@ extern crate malloc_size_of_derive;
|
|||
extern crate serde;
|
||||
|
||||
mod script_msg;
|
||||
pub mod transferable;
|
||||
pub mod webdriver_msg;
|
||||
|
||||
use crate::transferable::MessagePortImpl;
|
||||
use crate::webdriver_msg::{LoadStatus, WebDriverScriptCommand};
|
||||
use bluetooth_traits::BluetoothRequest;
|
||||
use canvas_traits::webgl::WebGLPipeline;
|
||||
|
@ -36,7 +38,7 @@ use keyboard_types::{CompositionEvent, KeyboardEvent};
|
|||
use libc::c_void;
|
||||
use media::WindowGLContext;
|
||||
use msg::constellation_msg::BackgroundHangMonitorRegister;
|
||||
use msg::constellation_msg::{BrowsingContextId, HistoryStateId, PipelineId};
|
||||
use msg::constellation_msg::{BrowsingContextId, HistoryStateId, MessagePortId, PipelineId};
|
||||
use msg::constellation_msg::{PipelineNamespaceId, TopLevelBrowsingContextId, TraversalDirection};
|
||||
use net_traits::image::base::Image;
|
||||
use net_traits::image_cache::ImageCache;
|
||||
|
@ -51,7 +53,7 @@ use servo_atoms::Atom;
|
|||
use servo_url::ImmutableOrigin;
|
||||
use servo_url::ServoUrl;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
use std::fmt;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::Arc;
|
||||
|
@ -324,8 +326,11 @@ pub enum ConstellationControlMsg {
|
|||
source_browsing_context: TopLevelBrowsingContextId,
|
||||
/// The expected origin of the target.
|
||||
target_origin: Option<ImmutableOrigin>,
|
||||
/// The source origin of the message.
|
||||
/// https://html.spec.whatwg.org/multipage/#dom-messageevent-origin
|
||||
source_origin: ImmutableOrigin,
|
||||
/// The data to be posted.
|
||||
data: Vec<u8>,
|
||||
data: StructuredSerializedData,
|
||||
},
|
||||
/// Updates the current pipeline ID of a given iframe.
|
||||
/// First PipelineId is for the parent, second is the new PipelineId for the frame.
|
||||
|
@ -1013,3 +1018,33 @@ impl ScriptToConstellationChan {
|
|||
self.sender.send((self.pipeline_id, msg))
|
||||
}
|
||||
}
|
||||
|
||||
/// A data-holder for serialized data and transferred objects.
|
||||
/// <https://html.spec.whatwg.org/multipage/#structuredserializewithtransfer>
|
||||
#[derive(Debug, Deserialize, MallocSizeOf, Serialize)]
|
||||
pub struct StructuredSerializedData {
|
||||
/// Data serialized by SpiderMonkey.
|
||||
pub serialized: Vec<u8>,
|
||||
/// Transferred objects.
|
||||
pub ports: Option<HashMap<MessagePortId, MessagePortImpl>>,
|
||||
}
|
||||
|
||||
/// A task on the https://html.spec.whatwg.org/multipage/#port-message-queue
|
||||
#[derive(Debug, Deserialize, MallocSizeOf, Serialize)]
|
||||
pub struct PortMessageTask {
|
||||
/// The origin of this task.
|
||||
pub origin: ImmutableOrigin,
|
||||
/// A data-holder for serialized data and transferred objects.
|
||||
pub data: StructuredSerializedData,
|
||||
}
|
||||
|
||||
/// Messages for communication between the constellation and a global managing ports.
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub enum MessagePortMsg {
|
||||
/// Enables a port to catch-up on messages that were sent while the transfer was ongoing.
|
||||
CompleteTransfer(MessagePortId, VecDeque<PortMessageTask>),
|
||||
/// Remove a port, the entangled one doesn't exists anymore.
|
||||
RemoveMessagePort(MessagePortId),
|
||||
/// Handle a new port-message-task.
|
||||
NewTask(MessagePortId, PortMessageTask),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue