mirror of
https://github.com/servo/servo.git
synced 2025-08-14 09:55:35 +01:00
Add cancellability to file manager load and related refactoring
This commit is contained in:
parent
7807895d58
commit
17ae38a318
12 changed files with 137 additions and 189 deletions
|
@ -4,7 +4,6 @@
|
|||
|
||||
use ipc_channel::ipc;
|
||||
use msg::constellation_msg::{PipelineId, ReferrerPolicy};
|
||||
use net::filemanager_thread::{FileManagerThreadFactory, TFDProvider};
|
||||
use net::resource_thread::new_core_resource_thread;
|
||||
use net_traits::hosts::{parse_hostsfile, host_replacement};
|
||||
use net_traits::{CoreResourceMsg, LoadData, LoadConsumer, LoadContext};
|
||||
|
@ -16,8 +15,6 @@ use std::net::IpAddr;
|
|||
use std::sync::mpsc::channel;
|
||||
use url::Url;
|
||||
|
||||
const TFD_PROVIDER: &'static TFDProvider = &TFDProvider;
|
||||
|
||||
fn ip(s: &str) -> IpAddr {
|
||||
s.parse().unwrap()
|
||||
}
|
||||
|
@ -40,9 +37,8 @@ impl LoadOrigin for ResourceTest {
|
|||
fn test_exit() {
|
||||
let (tx, _rx) = ipc::channel().unwrap();
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let filemanager_chan = FileManagerThreadFactory::new(TFD_PROVIDER);
|
||||
let (resource_thread, _) = new_core_resource_thread(
|
||||
"".to_owned(), None, ProfilerChan(tx), filemanager_chan, None);
|
||||
"".to_owned(), None, ProfilerChan(tx), None);
|
||||
resource_thread.send(CoreResourceMsg::Exit(sender)).unwrap();
|
||||
receiver.recv().unwrap();
|
||||
}
|
||||
|
@ -51,9 +47,8 @@ fn test_exit() {
|
|||
fn test_bad_scheme() {
|
||||
let (tx, _rx) = ipc::channel().unwrap();
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let filemanager_chan = FileManagerThreadFactory::new(TFD_PROVIDER);
|
||||
let (resource_thread, _) = new_core_resource_thread(
|
||||
"".to_owned(), None, ProfilerChan(tx), filemanager_chan, None);
|
||||
"".to_owned(), None, ProfilerChan(tx), None);
|
||||
let (start_chan, start) = ipc::channel().unwrap();
|
||||
let url = Url::parse("bogus://whatever").unwrap();
|
||||
resource_thread.send(CoreResourceMsg::Load(LoadData::new(LoadContext::Browsing, url, &ResourceTest),
|
||||
|
@ -232,9 +227,8 @@ fn test_cancelled_listener() {
|
|||
|
||||
let (tx, _rx) = ipc::channel().unwrap();
|
||||
let (exit_sender, exit_receiver) = ipc::channel().unwrap();
|
||||
let filemanager_chan = FileManagerThreadFactory::new(TFD_PROVIDER);
|
||||
let (resource_thread, _) = new_core_resource_thread(
|
||||
"".to_owned(), None, ProfilerChan(tx), filemanager_chan, None);
|
||||
"".to_owned(), None, ProfilerChan(tx), None);
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let (id_sender, id_receiver) = ipc::channel().unwrap();
|
||||
let (sync_sender, sync_receiver) = ipc::channel().unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue