Files
servo/components/storage/storage_thread.rs
Ashwin Naren d12dc23083 storage: Move storage related backend threads to their own crate (#39418)
This PR moves storage related APIs (currently just webstorage and
indexeddb) into their own crate. This reduces the congestion in the net
thread.

Related Zulip thread:
https://servo.zulipchat.com/#narrow/channel/263398-general/topic/indexedDB.20location/with/535911631

Sub PRs:
- [x] Move shared storage/net stuff to base (`IpcSend` and
`CoreResourcePool`) #39419

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-09-28 08:00:20 +00:00

30 lines
1.1 KiB
Rust

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::path::PathBuf;
use base::generic_channel::GenericSender;
use ipc_channel::ipc::IpcSender;
use profile_traits::mem::ProfilerChan as MemProfilerChan;
use storage_traits::StorageThreads;
use storage_traits::indexeddb_thread::IndexedDBThreadMsg;
use storage_traits::storage_thread::StorageThreadMsg;
use crate::indexeddb::IndexedDBThreadFactory;
use crate::webstorage_thread::StorageThreadFactory;
#[allow(clippy::too_many_arguments)]
pub fn new_storage_threads(
mem_profiler_chan: MemProfilerChan,
config_dir: Option<PathBuf>,
) -> (StorageThreads, StorageThreads) {
let idb: IpcSender<IndexedDBThreadMsg> = IndexedDBThreadFactory::new(config_dir.clone());
let storage: GenericSender<StorageThreadMsg> =
StorageThreadFactory::new(config_dir, mem_profiler_chan);
(
StorageThreads::new(storage.clone(), idb.clone()),
StorageThreads::new(storage, idb),
)
}