add process and task managers
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
use crate::VirtualMachineRuntime;
|
||||
use crate::process::ProcessManager;
|
||||
use crate::task::TaskId;
|
||||
use crate::task::TaskManager;
|
||||
use prometeu_hal::telemetry::CertificationConfig;
|
||||
|
||||
pub struct SystemOS {
|
||||
pub vm_runtime: VirtualMachineRuntime,
|
||||
pub process_manager: ProcessManager,
|
||||
pub task_manager: TaskManager,
|
||||
}
|
||||
|
||||
impl SystemOS {
|
||||
pub fn new(cap_config: Option<CertificationConfig>) -> Self {
|
||||
Self {
|
||||
vm_runtime: VirtualMachineRuntime::new(cap_config),
|
||||
process_manager: ProcessManager::new(),
|
||||
task_manager: TaskManager::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create_vm_game_task(&mut self, app_id: u32, title: impl Into<String>) -> TaskId {
|
||||
let title = title.into();
|
||||
let process_id = self.process_manager.spawn_vm_game(app_id, title.clone());
|
||||
let task_id = self.task_manager.create_game_task(process_id, app_id, title);
|
||||
self.task_manager.set_foreground(task_id);
|
||||
|
||||
task_id
|
||||
}
|
||||
|
||||
pub fn create_vm_shell_task(&mut self, app_id: u32, title: impl Into<String>) -> TaskId {
|
||||
let title = title.into();
|
||||
let process_id = self.process_manager.spawn_vm_shell(app_id, title.clone());
|
||||
let task_id = self.task_manager.create_shell_task(process_id, app_id, title);
|
||||
self.task_manager.set_foreground(task_id);
|
||||
|
||||
task_id
|
||||
}
|
||||
|
||||
pub fn create_native_shell_task(&mut self, app_id: u32, title: impl Into<String>) -> TaskId {
|
||||
let title = title.into();
|
||||
let process_id = self.process_manager.spawn_native_shell(app_id, title.clone());
|
||||
let task_id = self.task_manager.create_shell_task(process_id, app_id, title);
|
||||
self.task_manager.set_foreground(task_id);
|
||||
|
||||
task_id
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user