driver_manager_node/
node_manager.rs1use crate::node::Node;
6use async_trait::async_trait;
7use driver_manager_driver_host::DriverHost;
8use driver_manager_types::BindResultTracker;
9use driver_manager_utils::DictionaryUtil;
10use fidl_fuchsia_driver_framework as fdf;
11use std::cell::RefCell;
12use std::rc::{Rc, Weak};
13
14#[async_trait(?Send)]
15pub trait NodeManager {
16 fn clone_box(&self) -> Box<dyn NodeManager>;
17 fn bind(&self, node: &Rc<Node>, tracker: Rc<RefCell<BindResultTracker>>);
18 fn bind_to_url(
19 &self,
20 node: &Rc<Node>,
21 driver_url_suffix: &str,
22 tracker: Rc<RefCell<BindResultTracker>>,
23 );
24 fn start_driver(
25 &self,
26 _node: &Rc<Node>,
27 _url: &str,
28 _package_type: fdf::DriverPackageType,
29 ) -> Result<(), zx::Status> {
30 Err(zx::Status::NOT_SUPPORTED)
31 }
32 fn get_driver_host(
33 &self,
34 _driver_host_name_for_colocation: &str,
35 ) -> Option<Rc<dyn DriverHost>> {
36 None
37 }
38 async fn create_driver_host(
39 &self,
40 use_next_vdso: bool,
41 driver_host_name_for_colocation: String,
42 ) -> Result<Rc<dyn DriverHost>, zx::Status>;
43 async fn create_driver_host_dynamic_linker(
44 &self,
45 driver_host_name_for_colocation: String,
46 ) -> Result<Rc<dyn DriverHost>, zx::Status>;
47 fn is_test_shutdown_delay_enabled(&self) -> bool;
48 fn get_shutdown_test_rng(&self) -> Weak<RefCell<rand::rngs::StdRng>>;
49 async fn wait_for_bootup(&self);
50 fn get_dictionary_util(&self) -> Result<Rc<DictionaryUtil>, zx::Status>;
51 fn memory_attributor(&self) -> Option<Rc<dyn MemoryAttributor>>;
52}
53
54pub trait MemoryAttributor {
55 fn add_driver(&self, component_token: zx::Event, id: u64, process_koid: zx::Koid);
56 fn remove_driver(&self, id: u64);
57}