diff options
author | Alan Jeffrey <ajeffrey@mozilla.com> | 2017-06-14 18:14:54 -0500 |
---|---|---|
committer | Alan Jeffrey <ajeffrey@mozilla.com> | 2017-07-11 17:28:56 -0500 |
commit | ef033b8362b143f3671863313bcd792c4bf17f45 (patch) | |
tree | 24da8ea60c03dc7d8ed07a675dbff79135a07ba8 /components/script/script_thread.rs | |
parent | de331c6bc8f987521d600043285d32f42be07048 (diff) | |
download | servo-ef033b8362b143f3671863313bcd792c4bf17f45.tar.gz servo-ef033b8362b143f3671863313bcd792c4bf17f45.zip |
Implemented paint worklet properties.
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 94318472b50..641d761b373 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -79,7 +79,7 @@ use net_traits::request::{CredentialsMode, Destination, RedirectMode, RequestIni use net_traits::storage_thread::StorageType; use profile_traits::mem::{self, OpaqueSender, Report, ReportKind, ReportsChan}; use profile_traits::time::{self, ProfilerCategory, profile}; -use script_layout_interface::message::{self, NewLayoutThreadInfo, ReflowQueryType}; +use script_layout_interface::message::{self, Msg, NewLayoutThreadInfo, ReflowQueryType}; use script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use script_runtime::{ScriptPort, StackRootTLS, get_reports, new_rt_and_cx}; use script_traits::{CompositorEvent, ConstellationControlMsg}; @@ -718,8 +718,8 @@ impl ScriptThread { SCRIPT_THREAD_ROOT.with(|root| { let script_thread = unsafe { &*root.get().unwrap() }; script_thread.worklet_thread_pool.borrow_mut().get_or_insert_with(|| { - let chan = script_thread.chan.0.clone(); let init = WorkletGlobalScopeInit { + script_sender: script_thread.chan.0.clone(), resource_threads: script_thread.resource_threads.clone(), mem_profiler_chan: script_thread.mem_profiler_chan.clone(), time_profiler_chan: script_thread.time_profiler_chan.clone(), @@ -728,11 +728,20 @@ impl ScriptThread { scheduler_chan: script_thread.scheduler_chan.clone(), image_cache: script_thread.image_cache.clone(), }; - Rc::new(WorkletThreadPool::spawn(chan, init)) + Rc::new(WorkletThreadPool::spawn(init)) }).clone() }) } + pub fn send_to_layout(&self, pipeline_id: PipelineId, msg: Msg) { + let window = self.documents.borrow().find_window(pipeline_id); + let window = match window { + Some(window) => window, + None => return warn!("Message sent to layout after pipeline {} closed.", pipeline_id), + }; + let _ = window.layout_chan().send(msg); + } + /// Creates a new script thread. pub fn new(state: InitialScriptState, port: Receiver<MainThreadScriptMsg>, |