aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_traits/script_msg.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script_traits/script_msg.rs')
-rw-r--r--components/script_traits/script_msg.rs64
1 files changed, 64 insertions, 0 deletions
diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs
index 0ac5aeae4b4..ca6b6328793 100644
--- a/components/script_traits/script_msg.rs
+++ b/components/script_traits/script_msg.rs
@@ -8,13 +8,17 @@ use IFrameLoadInfo;
use MouseButton;
use MouseEventType;
use MozBrowserEvent;
+use WorkerGlobalScopeInit;
+use WorkerScriptLoadOrigin;
use canvas_traits::CanvasMsg;
+use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
use euclid::point::Point2D;
use euclid::size::Size2D;
use gfx_traits::LayerId;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
use msg::constellation_msg::{NavigationDirection, PipelineId, SubpageId};
+use net_traits::CoreResourceMsg;
use offscreen_gl_context::{GLContextAttributes, GLLimits};
use style_traits::cursor::Cursor;
use style_traits::viewport::ViewportConstraints;
@@ -40,6 +44,19 @@ pub enum EventResult {
DefaultPrevented,
}
+/// A log entry reported to the constellation
+/// We don't report all log entries, just serious ones.
+/// We need a separate type for this because LogLevel isn't serializable.
+#[derive(Clone, Debug, Deserialize, Serialize)]
+pub enum LogEntry {
+ /// Panic, with a reason and backtrace
+ Panic(String, String),
+ /// Error, with a reason
+ Error(String),
+ /// warning, with a reason
+ Warn(String)
+}
+
/// Messages from the script to the constellation.
#[derive(Deserialize, Serialize)]
pub enum ScriptMsg {
@@ -114,8 +131,55 @@ pub enum ScriptMsg {
TouchEventProcessed(EventResult),
/// Get Scroll Offset
GetScrollOffset(PipelineId, LayerId, IpcSender<Point2D<f32>>),
+ /// A log entry, with the pipeline id and thread name
+ LogEntry(Option<PipelineId>, Option<String>, LogEntry),
/// Notifies the constellation that this pipeline has exited.
PipelineExited(PipelineId),
+ /// Store the data required to activate a service worker for the given scope
+ RegisterServiceWorker(ScopeThings, Url),
/// Requests that the compositor shut down.
+ Exit
+}
+
+/// Entities required to spawn service workers
+#[derive(Deserialize, Serialize, Clone)]
+pub struct ScopeThings {
+ /// script resource url
+ pub script_url: Url,
+ /// pipeline which requested the activation
+ pub pipeline_id: PipelineId,
+ /// network load origin of the resource
+ pub worker_load_origin: WorkerScriptLoadOrigin,
+ /// base resources required to create worker global scopes
+ pub init: WorkerGlobalScopeInit,
+ /// the port to receive devtools message from
+ pub devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
+ /// service worker id
+ pub worker_id: WorkerId,
+}
+
+/// Channels to allow service worker manager to communicate with constellation and resource thread
+pub struct SWManagerSenders {
+ /// sender for communicating with constellation
+ pub swmanager_sender: IpcSender<SWManagerMsg>,
+ /// sender for communicating with resource thread
+ pub resource_sender: IpcSender<CoreResourceMsg>
+}
+
+/// Messages sent to Service Worker Manager thread
+#[derive(Deserialize, Serialize)]
+pub enum ServiceWorkerMsg {
+ /// Message to register the service worker
+ RegisterServiceWorker(ScopeThings, Url),
+ /// Timeout message sent by active service workers
+ Timeout(Url),
+ /// Exit the service worker manager
Exit,
}
+
+/// Messages outgoing from the Service Worker Manager thread to constellation
+#[derive(Deserialize, Serialize)]
+pub enum SWManagerMsg {
+ /// Provide the constellation with a means of communicating with the Service Worker Manager
+ OwnSender(IpcSender<ServiceWorkerMsg>),
+}