diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /third_party/rust/wgpu-core/src/pool.rs | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/wgpu-core/src/pool.rs')
-rw-r--r-- | third_party/rust/wgpu-core/src/pool.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/third_party/rust/wgpu-core/src/pool.rs b/third_party/rust/wgpu-core/src/pool.rs index 47de6d5feb..7d17f3a7a3 100644 --- a/third_party/rust/wgpu-core/src/pool.rs +++ b/third_party/rust/wgpu-core/src/pool.rs @@ -5,8 +5,8 @@ use std::{ }; use once_cell::sync::OnceCell; -use parking_lot::Mutex; +use crate::lock::{rank, Mutex}; use crate::{PreHashedKey, PreHashedMap}; type SlotInner<V> = Weak<V>; @@ -22,13 +22,15 @@ pub struct ResourcePool<K, V> { impl<K: Clone + Eq + Hash, V> ResourcePool<K, V> { pub fn new() -> Self { Self { - inner: Mutex::new(HashMap::default()), + inner: Mutex::new(rank::RESOURCE_POOL_INNER, HashMap::default()), } } - /// Get a resource from the pool with the given entry map, or create a new one if it doesn't exist using the given constructor. + /// Get a resource from the pool with the given entry map, or create a new + /// one if it doesn't exist using the given constructor. /// - /// Behaves such that only one resource will be created for each unique entry map at any one time. + /// Behaves such that only one resource will be created for each unique + /// entry map at any one time. pub fn get_or_init<F, E>(&self, key: K, constructor: F) -> Result<Arc<V>, E> where F: FnOnce(K) -> Result<Arc<V>, E>, @@ -96,6 +98,8 @@ impl<K: Clone + Eq + Hash, V> ResourcePool<K, V> { /// Remove the given entry map from the pool. /// /// Must *only* be called in the Drop impl of [`BindGroupLayout`]. + /// + /// [`BindGroupLayout`]: crate::binding_model::BindGroupLayout pub fn remove(&self, key: &K) { let hashed_key = PreHashedKey::from_key(key); |