diff --git a/components/net/filemanager_thread.rs b/components/net/filemanager_thread.rs index 97807f3f01e..5c59a6aae8c 100644 --- a/components/net/filemanager_thread.rs +++ b/components/net/filemanager_thread.rs @@ -7,7 +7,7 @@ use mime_guess::guess_mime_type_opt; use net_traits::blob_url_store::{BlobBuf, BlobURLStoreError}; use net_traits::filemanager_thread::{FileManagerResult, FileManagerThreadMsg, FileOrigin, FilterPattern}; use net_traits::filemanager_thread::{FileManagerThreadError, ReadFileProgress, RelativePos, SelectedFile}; -use script_traits::ConstellationMsg; +use script_traits::FileManagerMsg; #[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))] use servo_config::opts; use servo_config::prefs::PREFS; @@ -18,7 +18,6 @@ use std::ops::Index; use std::path::{Path, PathBuf}; use std::sync::{Arc, RwLock}; use std::sync::atomic::{self, AtomicBool, AtomicUsize, Ordering}; -use std::sync::mpsc::Sender; use std::thread; #[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))] use url::Url; @@ -63,12 +62,12 @@ enum FileImpl { #[derive(Clone)] pub struct FileManager { - constellation_chan: Sender, + constellation_chan: IpcSender, store: Arc, } impl FileManager { - pub fn new(constellation_chan: Sender) -> FileManager { + pub fn new(constellation_chan: IpcSender) -> FileManager { FileManager { constellation_chan: constellation_chan, store: Arc::new(FileManagerStore::new()), @@ -222,13 +221,13 @@ impl FileManagerStore { fn get_selected_files(&self, patterns: Vec, multiple_files: bool, - constellation_chan: Sender) -> Option> { + constellation_chan: IpcSender) -> Option> { if opts::get().headless { return None; } let (ipc_sender, ipc_receiver) = ipc::channel().expect("Failed to create IPC channel!"); - let msg = ConstellationMsg::OpenFileSelectDialog(patterns, multiple_files, ipc_sender); + let msg = FileManagerMsg::OpenFileSelectDialog(patterns, multiple_files, ipc_sender); constellation_chan.send(msg).map(|_| ipc_receiver.recv().unwrap()).unwrap_or_default() } @@ -238,7 +237,7 @@ impl FileManagerStore { sender: IpcSender>, origin: FileOrigin, opt_test_path: Option, - constellation_chan: Sender) { + constellation_chan: IpcSender) { // Check if the select_files preference is enabled // to ensure process-level security against compromised script; // Then try applying opt_test_path directly for testing convenience @@ -266,7 +265,7 @@ impl FileManagerStore { sender: IpcSender>>, origin: FileOrigin, opt_test_paths: Option>, - constellation_chan: Sender) { + constellation_chan: IpcSender) { // Check if the select_files preference is enabled // to ensure process-level security against compromised script; // Then try applying opt_test_paths directly for testing convenience diff --git a/components/net/resource_thread.rs b/components/net/resource_thread.rs index 6030f30dea4..3f3e8c10843 100644 --- a/components/net/resource_thread.rs +++ b/components/net/resource_thread.rs @@ -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) - -> (ResourceThreads, ResourceThreads, Sender>) { + -> (ResourceThreads, ResourceThreads, IpcSender>) { 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) - -> (CoreResourceThread, CoreResourceThread, Sender>) { + -> (CoreResourceThread, CoreResourceThread, IpcSender>) { 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>, _profiler_chan: ProfilerChan, - constellation_chan: Sender) -> CoreResourceManager { + constellation_chan: IpcSender) -> CoreResourceManager { CoreResourceManager { user_agent: user_agent, devtools_chan: devtools_channel, diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 4fd94207b47..65449d0d9af 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -523,7 +523,7 @@ fn create_constellation(user_agent: Cow<'static, str>, webgl_threads, webvr_chan, }; - let (constellation_chan, from_swmanager_sender) = + let (constellation_chan, from_swmanager_sender, from_filemanager_sender) = Constellation::::start(initial_state); @@ -533,7 +533,7 @@ fn create_constellation(user_agent: Cow<'static, str>, webvr_constellation_sender.send(constellation_chan.clone()).unwrap(); } - resource_constellation_sender.send(constellation_chan.clone()).unwrap(); + resource_constellation_sender.send(from_filemanager_sender.clone()).unwrap(); // channels to communicate with Service Worker Manager let sw_senders = SWManagerSenders { diff --git a/ports/servo/browser.rs b/ports/servo/browser.rs index afdaeb173c9..b1f2627fb68 100644 --- a/ports/servo/browser.rs +++ b/ports/servo/browser.rs @@ -18,6 +18,7 @@ use servo::servo_url::ServoUrl; use servo::webrender_api::ScrollLocation; use std::mem; use std::rc::Rc; +#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))] use std::thread; use tinyfiledialogs; @@ -344,7 +345,9 @@ fn platform_get_selected_devices(devices: Vec, sender: IpcSender, multiple_files: bool, sender: IpcSender>>) { +fn platform_get_selected_files(patterns: Vec, + multiple_files: bool, + sender: IpcSender>>) { let picker_name = if multiple_files { "Pick files" } else { "Pick a file" }; thread::Builder::new().name(picker_name.to_owned()).spawn(move || { @@ -368,7 +371,9 @@ fn platform_get_selected_files(patterns: Vec, multiple_files: boo } #[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))] -fn platform_get_selected_files(_patterns: Vec, _multiple_files: bool, sender: IpcSender>>) { +fn platform_get_selected_files(_patterns: Vec, + _multiple_files: bool, + sender: IpcSender>>) { sender.send(None); }