aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/image_cache.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/net/image_cache.rs')
-rw-r--r--components/net/image_cache.rs26
1 files changed, 24 insertions, 2 deletions
diff --git a/components/net/image_cache.rs b/components/net/image_cache.rs
index eab2f9c08fe..e3d31b11736 100644
--- a/components/net/image_cache.rs
+++ b/components/net/image_cache.rs
@@ -431,7 +431,7 @@ pub struct ImageCacheImpl {
store: Arc<Mutex<ImageCacheStore>>,
/// Thread pool for image decoding
- thread_pool: CoreResourceThreadPool,
+ thread_pool: Arc<CoreResourceThreadPool>,
}
impl ImageCache for ImageCacheImpl {
@@ -454,7 +454,10 @@ impl ImageCache for ImageCacheImpl {
placeholder_url: ServoUrl::parse("chrome://resources/rippy.png").unwrap(),
compositor_api,
})),
- thread_pool: CoreResourceThreadPool::new(thread_count, "ImageCache".to_string()),
+ thread_pool: Arc::new(CoreResourceThreadPool::new(
+ thread_count,
+ "ImageCache".to_string(),
+ )),
}
}
@@ -651,6 +654,25 @@ impl ImageCache for ImageCacheImpl {
},
}
}
+
+ fn create_new_image_cache(
+ &self,
+ compositor_api: CrossProcessCompositorApi,
+ ) -> Arc<dyn ImageCache> {
+ let store = self.store.lock().unwrap();
+ let placeholder_image = store.placeholder_image.clone();
+ let placeholder_url = store.placeholder_url.clone();
+ Arc::new(ImageCacheImpl {
+ store: Arc::new(Mutex::new(ImageCacheStore {
+ pending_loads: AllPendingLoads::new(),
+ completed_loads: HashMap::new(),
+ placeholder_image,
+ placeholder_url,
+ compositor_api,
+ })),
+ thread_pool: self.thread_pool.clone(),
+ })
+ }
}
impl ImageCacheImpl {