Implement trait-based ResourceThreads and clean up related naming issues

Changes include:

- Introduce an IpcSend trait to abstract over a collection of IpcSenders
- Implement ResourceThreads collection to abstract the resource-related
  sub threads across the component
- Rename original ResourceThread and ControlMsg into an unifed CoreResource__
  to accommodate above changes and avoid confusions
This commit is contained in:
Zhen Zhang 2016-05-18 00:07:42 +08:00
parent 051a749e0d
commit a51db4cfa8
22 changed files with 213 additions and 179 deletions

View file

@ -18,7 +18,7 @@ pub struct FileManager {
}
impl FileManager {
pub fn new(recv: IpcReceiver<FileManagerThreadMsg>) -> FileManager {
fn new(recv: IpcReceiver<FileManagerThreadMsg>) -> FileManager {
FileManager {
receiver: recv,
idmap: RefCell::new(HashMap::new()),
@ -36,7 +36,7 @@ impl FileManager {
}
/// Start the file manager event loop
pub fn start(&mut self) {
fn start(&mut self) {
loop {
match self.receiver.recv().unwrap() {
FileManagerThreadMsg::SelectFile(sender) => self.select_file(sender),