script/dom/workers/
abstractworker.rs1use script_bindings::reflector::DomObject;
6use servo_base::id::PipelineId;
7use servo_constellation_traits::StructuredSerializedData;
8use servo_url::ImmutableOrigin;
9
10use crate::dom::bindings::refcounted::Trusted;
11use crate::messaging::CommonScriptMsg;
12
13#[derive(MallocSizeOf)]
15pub(crate) enum WorkerScriptMsg {
16 Common(CommonScriptMsg),
18 DOMMessage(MessageData),
20}
21
22#[derive(MallocSizeOf)]
23pub(crate) struct MessageData {
24 pub origin: ImmutableOrigin,
25 pub data: Box<StructuredSerializedData>,
26 pub pipeline_id: PipelineId,
27}
28
29pub(crate) struct SimpleWorkerErrorHandler<T: DomObject> {
30 pub(crate) addr: Trusted<T>,
31}
32
33impl<T: DomObject> SimpleWorkerErrorHandler<T> {
34 pub(crate) fn new(addr: Trusted<T>) -> SimpleWorkerErrorHandler<T> {
35 SimpleWorkerErrorHandler { addr }
36 }
37}