Fetch cancellation: Add CancellationListener

This commit is contained in:
Manish Goregaokar 2017-11-17 14:57:07 -08:00
parent 27457e4d84
commit 6dd7af2bda
4 changed files with 38 additions and 10 deletions

View file

@ -25,7 +25,7 @@ use hyper_openssl;
use msg::constellation_msg::TEST_PIPELINE_ID;
use net::connector::create_ssl_client;
use net::fetch::cors_cache::CorsCache;
use net::fetch::methods::FetchContext;
use net::fetch::methods::{CancellationListener, FetchContext};
use net::filemanager_thread::FileManager;
use net::hsts::HstsEntry;
use net::test::HttpState;
@ -538,7 +538,7 @@ fn test_fetch_with_hsts() {
user_agent: DEFAULT_USER_AGENT.into(),
devtools_chan: None,
filemanager: FileManager::new(),
cancel_chan: None,
cancellation_listener: Arc::new(Mutex::new(CancellationListener::new(None))),
};
{

View file

@ -36,7 +36,7 @@ use devtools_traits::DevtoolsControlMsg;
use hyper::server::{Handler, Listening, Server};
use net::connector::create_ssl_client;
use net::fetch::cors_cache::CorsCache;
use net::fetch::methods::{self, FetchContext};
use net::fetch::methods::{self, CancellationListener, FetchContext};
use net::filemanager_thread::FileManager;
use net::test::HttpState;
use net_traits::FetchTaskTarget;
@ -44,7 +44,7 @@ use net_traits::request::Request;
use net_traits::response::Response;
use servo_config::resource_files::resources_dir_path;
use servo_url::ServoUrl;
use std::sync::Arc;
use std::sync::{Arc, Mutex};
use std::sync::mpsc::{Sender, channel};
const DEFAULT_USER_AGENT: &'static str = "Such Browser. Very Layout. Wow.";
@ -61,7 +61,7 @@ fn new_fetch_context(dc: Option<Sender<DevtoolsControlMsg>>) -> FetchContext {
user_agent: DEFAULT_USER_AGENT.into(),
devtools_chan: dc,
filemanager: FileManager::new(),
cancel_chan: None,
cancellation_listener: Arc::new(Mutex::new(CancellationListener::new(None))),
}
}
impl FetchTaskTarget for FetchResponseCollector {