mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
storage: Move shared functionality to base (#39419)
Part of #39418. See that PR for a full description. Moves: - `read_json_from_file` - `write_json_to_file` - `IpcSendResult` - `IpcSend` Renames: - `CoreResourceThreadPool` to `ThreadPool` (shorter and more descriptive, as we use it for more than the core resource thread now) Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
parent
ba208b19cc
commit
f766b66a97
25 changed files with 254 additions and 98 deletions
|
@ -18,8 +18,6 @@ use profile_traits::path;
|
|||
use rustc_hash::FxHashMap;
|
||||
use servo_url::ServoUrl;
|
||||
|
||||
use crate::resource_thread;
|
||||
|
||||
const QUOTA_SIZE_LIMIT: usize = 5 * 1024 * 1024;
|
||||
|
||||
pub trait StorageThreadFactory {
|
||||
|
@ -62,7 +60,7 @@ impl StorageManager {
|
|||
fn new(port: GenericReceiver<StorageThreadMsg>, config_dir: Option<PathBuf>) -> StorageManager {
|
||||
let mut local_data = HashMap::new();
|
||||
if let Some(ref config_dir) = config_dir {
|
||||
resource_thread::read_json_from_file(&mut local_data, config_dir, "local_data.json");
|
||||
base::read_json_from_file(&mut local_data, config_dir, "local_data.json");
|
||||
}
|
||||
StorageManager {
|
||||
port,
|
||||
|
@ -142,7 +140,7 @@ impl StorageManager {
|
|||
|
||||
fn save_state(&self) {
|
||||
if let Some(ref config_dir) = self.config_dir {
|
||||
resource_thread::write_json_to_file(&self.local_data, config_dir, "local_data.json");
|
||||
base::write_json_to_file(&self.local_data, config_dir, "local_data.json");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue