diff options
author | Kunal Mohan <kunalmohan99@gmail.com> | 2020-05-15 00:03:07 +0530 |
---|---|---|
committer | Kunal Mohan <kunalmohan99@gmail.com> | 2020-05-15 01:15:01 +0530 |
commit | e5065c7eb291a83ba489bc41b6c0241f39ed1c0a (patch) | |
tree | 8b207f81a31195abb29683ba4118c69537bf1bd6 /components/script/script_thread.rs | |
parent | 6c506ba2608c082a6c3c908b5e72f1cb5ea8a082 (diff) | |
download | servo-e5065c7eb291a83ba489bc41b6c0241f39ed1c0a.tar.gz servo-e5065c7eb291a83ba489bc41b6c0241f39ed1c0a.zip |
Share single gpu_id_hub among all threads in a process
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index fb216e614ba..6a2c4b09c1e 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -55,6 +55,7 @@ use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::globalscope::GlobalScope; use crate::dom::htmlanchorelement::HTMLAnchorElement; use crate::dom::htmliframeelement::{HTMLIFrameElement, NavigationType}; +use crate::dom::identityhub::Identities; use crate::dom::mutationobserver::MutationObserver; use crate::dom::node::{ from_untrusted_node_address, window_from_node, Node, NodeDamage, ShadowIncluding, @@ -129,6 +130,7 @@ use net_traits::{ Metadata, NetworkError, ReferrerPolicy, ResourceFetchTiming, ResourceThreads, ResourceTimingType, }; +use parking_lot::Mutex; use percent_encoding::percent_decode; use profile_traits::mem::{self as profile_mem, OpaqueSender, ReportsChan}; use profile_traits::time::{self as profile_time, profile, ProfilerCategory}; @@ -698,6 +700,9 @@ pub struct ScriptThread { /// Code is running as a consequence of a user interaction is_user_interacting: Cell<bool>, + + /// Channel to WebGPU + gpu_id_hub: Arc<Mutex<Identities>>, } /// In the event of thread panic, all data on the stack runs its destructor. However, there @@ -1151,6 +1156,7 @@ impl ScriptThread { image_cache: script_thread.image_cache.clone(), is_headless: script_thread.headless, user_agent: script_thread.user_agent.clone(), + gpu_id_hub: script_thread.gpu_id_hub.clone(), }; Rc::new(WorkletThreadPool::spawn(init)) }) @@ -1396,6 +1402,7 @@ impl ScriptThread { node_ids: Default::default(), is_user_interacting: Cell::new(false), + gpu_id_hub: Arc::new(Mutex::new(Identities::new())), } } @@ -3313,6 +3320,7 @@ impl ScriptThread { self.user_agent.clone(), self.player_context.clone(), self.event_loop_waker.as_ref().map(|w| (*w).clone_box()), + self.gpu_id_hub.clone(), ); // Initialize the browsing context for the window. |