refactor(filemanager): use filemanagermsg to request embedder

This commit is contained in:
OJ Kwon 2018-04-03 10:00:06 -07:00
parent 52b9e4f0ab
commit 7cec47b3fa
No known key found for this signature in database
GPG key ID: 6C23A45602A44DA6
4 changed files with 22 additions and 18 deletions

View file

@ -28,7 +28,7 @@ use net_traits::storage_thread::StorageThreadMsg;
use profile_traits::mem::{Report, ReportsChan, ReportKind};
use profile_traits::mem::ProfilerChan as MemProfilerChan;
use profile_traits::time::ProfilerChan;
use script_traits::ConstellationMsg;
use script_traits::FileManagerMsg;
use serde::{Deserialize, Serialize};
use serde_json;
use servo_allocator;
@ -42,7 +42,7 @@ use std::io::prelude::*;
use std::ops::Deref;
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex, RwLock};
use std::sync::mpsc::{self, Sender};
use std::sync::mpsc::Sender;
use std::thread;
use storage_thread::StorageThreadFactory;
use websocket_loader;
@ -53,7 +53,7 @@ pub fn new_resource_threads(user_agent: Cow<'static, str>,
time_profiler_chan: ProfilerChan,
mem_profiler_chan: MemProfilerChan,
config_dir: Option<PathBuf>)
-> (ResourceThreads, ResourceThreads, Sender<Sender<ConstellationMsg>>) {
-> (ResourceThreads, ResourceThreads, IpcSender<IpcSender<FileManagerMsg>>) {
let (public_core, private_core, constellation_sender) = new_core_resource_thread(
user_agent,
devtools_chan,
@ -73,11 +73,11 @@ pub fn new_core_resource_thread(user_agent: Cow<'static, str>,
time_profiler_chan: ProfilerChan,
mem_profiler_chan: MemProfilerChan,
config_dir: Option<PathBuf>)
-> (CoreResourceThread, CoreResourceThread, Sender<Sender<ConstellationMsg>>) {
-> (CoreResourceThread, CoreResourceThread, IpcSender<IpcSender<FileManagerMsg>>) {
let (public_setup_chan, public_setup_port) = ipc::channel().unwrap();
let (private_setup_chan, private_setup_port) = ipc::channel().unwrap();
let (report_chan, report_port) = ipc::channel().unwrap();
let (constellation_sender, constellation_receiver) = mpsc::channel();
let (constellation_sender, constellation_receiver) = ipc::channel().unwrap();
thread::Builder::new().name("ResourceManager".to_owned()).spawn(move || {
let constellation_chan = constellation_receiver.recv().unwrap();
@ -377,7 +377,7 @@ impl CoreResourceManager {
pub fn new(user_agent: Cow<'static, str>,
devtools_channel: Option<Sender<DevtoolsControlMsg>>,
_profiler_chan: ProfilerChan,
constellation_chan: Sender<ConstellationMsg>) -> CoreResourceManager {
constellation_chan: IpcSender<FileManagerMsg>) -> CoreResourceManager {
CoreResourceManager {
user_agent: user_agent,
devtools_chan: devtools_channel,