task -> thread

This commit is contained in:
rohan.prinja 2015-11-14 05:07:55 +09:00 committed by Rohan Prinja
parent f00532bab0
commit 1f02c4ebbb
119 changed files with 1209 additions and 1207 deletions

View file

@ -9,7 +9,7 @@ use hyper::mime::{Mime, SubLevel, TopLevel};
use mime_classifier::MIMEClassifier;
use net_traits::ProgressMsg::Done;
use net_traits::{LoadConsumer, LoadData, Metadata};
use resource_task::{CancellationListener, send_error, start_sending_sniffed_opt};
use resource_thread::{CancellationListener, send_error, start_sending_sniffed_opt};
use std::sync::Arc;
use url::Url;
use util::resource_files::resources_dir_path;

View file

@ -6,7 +6,7 @@ use hyper::mime::{Mime, TopLevel, SubLevel, Attr, Value};
use mime_classifier::MIMEClassifier;
use net_traits::ProgressMsg::{Done, Payload};
use net_traits::{LoadConsumer, LoadData, Metadata};
use resource_task::{CancellationListener, send_error, start_sending_sniffed_opt};
use resource_thread::{CancellationListener, send_error, start_sending_sniffed_opt};
use rustc_serialize::base64::FromBase64;
use std::sync::Arc;
use url::SchemeData;
@ -16,10 +16,10 @@ pub fn factory(load_data: LoadData,
senders: LoadConsumer,
classifier: Arc<MIMEClassifier>,
cancel_listener: CancellationListener) {
// NB: we don't spawn a new task.
// NB: we don't spawn a new thread.
// Hypothesis: data URLs are too small for parallel base64 etc. to be worth it.
// Should be tested at some point.
// Left in separate function to allow easy moving to a task, if desired.
// Left in separate function to allow easy moving to a thread, if desired.
load(load_data, senders, classifier, cancel_listener)
}

View file

@ -196,8 +196,8 @@ impl CORSCache for BasicCORSCache {
}
}
/// Various messages that can be sent to a CORSCacheTask
pub enum CORSCacheTaskMsg {
/// Various messages that can be sent to a CORSCacheThread
pub enum CORSCacheThreadMsg {
Clear(CacheRequestDetails, Sender<()>),
Cleanup(Sender<()>),
MatchHeader(CacheRequestDetails, String, Sender<bool>),
@ -208,119 +208,119 @@ pub enum CORSCacheTaskMsg {
ExitMsg
}
/// A Sender to a CORSCacheTask
/// A Sender to a CORSCacheThread
///
/// This can be used as a CORS Cache.
/// The methods on this type block until they can run, and it behaves similar to a mutex
pub type CORSCacheSender = Sender<CORSCacheTaskMsg>;
pub type CORSCacheSender = Sender<CORSCacheThreadMsg>;
impl CORSCache for CORSCacheSender {
fn clear (&mut self, request: CacheRequestDetails) {
let (tx, rx) = channel();
let _ = self.send(CORSCacheTaskMsg::Clear(request, tx));
let _ = self.send(CORSCacheThreadMsg::Clear(request, tx));
let _ = rx.recv();
}
fn cleanup(&mut self) {
let (tx, rx) = channel();
let _ = self.send(CORSCacheTaskMsg::Cleanup(tx));
let _ = self.send(CORSCacheThreadMsg::Cleanup(tx));
let _ = rx.recv();
}
fn match_header(&mut self, request: CacheRequestDetails, header_name: &str) -> bool {
let (tx, rx) = channel();
let _ = self.send(CORSCacheTaskMsg::MatchHeader(request, header_name.to_owned(), tx));
let _ = self.send(CORSCacheThreadMsg::MatchHeader(request, header_name.to_owned(), tx));
rx.recv().unwrap_or(false)
}
fn match_header_and_update(&mut self, request: CacheRequestDetails, header_name: &str, new_max_age: u32) -> bool {
let (tx, rx) = channel();
let _ = self.send(CORSCacheTaskMsg::MatchHeaderUpdate(request, header_name.to_owned(), new_max_age, tx));
let _ = self.send(CORSCacheThreadMsg::MatchHeaderUpdate(request, header_name.to_owned(), new_max_age, tx));
rx.recv().unwrap_or(false)
}
fn match_method(&mut self, request: CacheRequestDetails, method: Method) -> bool {
let (tx, rx) = channel();
let _ = self.send(CORSCacheTaskMsg::MatchMethod(request, method, tx));
let _ = self.send(CORSCacheThreadMsg::MatchMethod(request, method, tx));
rx.recv().unwrap_or(false)
}
fn match_method_and_update(&mut self, request: CacheRequestDetails, method: Method, new_max_age: u32) -> bool {
let (tx, rx) = channel();
let _ = self.send(CORSCacheTaskMsg::MatchMethodUpdate(request, method, new_max_age, tx));
let _ = self.send(CORSCacheThreadMsg::MatchMethodUpdate(request, method, new_max_age, tx));
rx.recv().unwrap_or(false)
}
fn insert(&mut self, entry: CORSCacheEntry) {
let (tx, rx) = channel();
let _ = self.send(CORSCacheTaskMsg::Insert(entry, tx));
let _ = self.send(CORSCacheThreadMsg::Insert(entry, tx));
let _ = rx.recv();
}
}
/// A simple task-based CORS Cache that can be sent messages
/// A simple thread-based CORS Cache that can be sent messages
///
/// #Example
/// ```ignore
/// let task = CORSCacheTask::new();
/// let builder = TaskBuilder::new().named("XHRTask");
/// let mut sender = task.sender();
/// builder.spawn(move || { task.run() });
/// let thread = CORSCacheThread::new();
/// let builder = ThreadBuilder::new().named("XHRThread");
/// let mut sender = thread.sender();
/// builder.spawn(move || { thread.run() });
/// sender.insert(CORSCacheEntry::new(/* parameters here */));
/// ```
pub struct CORSCacheTask {
receiver: Receiver<CORSCacheTaskMsg>,
pub struct CORSCacheThread {
receiver: Receiver<CORSCacheThreadMsg>,
cache: BasicCORSCache,
sender: CORSCacheSender
}
impl CORSCacheTask {
pub fn new() -> CORSCacheTask {
impl CORSCacheThread {
pub fn new() -> CORSCacheThread {
let (tx, rx) = channel();
CORSCacheTask {
CORSCacheThread {
receiver: rx,
cache: BasicCORSCache(vec![]),
sender: tx
}
}
/// Provides a sender to the cache task
/// Provides a sender to the cache thread
pub fn sender(&self) -> CORSCacheSender {
self.sender.clone()
}
/// Runs the cache task
/// This blocks the current task, so it is advised
/// to spawn a new task for this
/// Runs the cache thread
/// This blocks the current thread, so it is advised
/// to spawn a new thread for this
/// Send ExitMsg to the associated Sender to exit
pub fn run(&mut self) {
loop {
match self.receiver.recv().unwrap() {
CORSCacheTaskMsg::Clear(request, tx) => {
CORSCacheThreadMsg::Clear(request, tx) => {
self.cache.clear(request);
let _ = tx.send(());
},
CORSCacheTaskMsg::Cleanup(tx) => {
CORSCacheThreadMsg::Cleanup(tx) => {
self.cache.cleanup();
let _ = tx.send(());
},
CORSCacheTaskMsg::MatchHeader(request, header, tx) => {
CORSCacheThreadMsg::MatchHeader(request, header, tx) => {
let _ = tx.send(self.cache.match_header(request, &header));
},
CORSCacheTaskMsg::MatchHeaderUpdate(request, header, new_max_age, tx) => {
CORSCacheThreadMsg::MatchHeaderUpdate(request, header, new_max_age, tx) => {
let _ = tx.send(self.cache.match_header_and_update(request, &header, new_max_age));
},
CORSCacheTaskMsg::MatchMethod(request, method, tx) => {
CORSCacheThreadMsg::MatchMethod(request, method, tx) => {
let _ = tx.send(self.cache.match_method(request, method));
},
CORSCacheTaskMsg::MatchMethodUpdate(request, method, new_max_age, tx) => {
CORSCacheThreadMsg::MatchMethodUpdate(request, method, new_max_age, tx) => {
let _ = tx.send(self.cache.match_method_and_update(request, method, new_max_age));
},
CORSCacheTaskMsg::Insert(entry, tx) => {
CORSCacheThreadMsg::Insert(entry, tx) => {
self.cache.insert(entry);
let _ = tx.send(());
},
CORSCacheTaskMsg::ExitMsg => break
CORSCacheThreadMsg::ExitMsg => break
}
}
}

View file

@ -17,14 +17,14 @@ use hyper::mime::{Attr, Mime, SubLevel, TopLevel, Value};
use hyper::status::StatusCode;
use net_traits::response::{CacheState, HttpsState, Response, ResponseType, TerminationReason};
use net_traits::{AsyncFetchListener, Metadata};
use resource_task::CancellationListener;
use resource_thread::CancellationListener;
use std::ascii::AsciiExt;
use std::cell::{Cell, RefCell};
use std::rc::Rc;
use std::str::FromStr;
use std::thread;
use url::{Origin, Url, UrlParser};
use util::task::spawn_named;
use util::thread::spawn_named;
/// A [request context](https://fetch.spec.whatwg.org/#concept-request-context)
#[derive(Copy, Clone, PartialEq)]

View file

@ -7,8 +7,8 @@ use mime_classifier::MIMEClassifier;
use mime_guess::guess_mime_type;
use net_traits::ProgressMsg::{Done, Payload};
use net_traits::{LoadConsumer, LoadData, Metadata};
use resource_task::{CancellationListener, ProgressSender};
use resource_task::{send_error, start_sending_sniffed, start_sending_sniffed_opt};
use resource_thread::{CancellationListener, ProgressSender};
use resource_thread::{send_error, start_sending_sniffed, start_sending_sniffed_opt};
use std::borrow::ToOwned;
use std::error::Error;
use std::fs::File;
@ -16,7 +16,7 @@ use std::io::Read;
use std::path::PathBuf;
use std::sync::Arc;
use url::Url;
use util::task::spawn_named;
use util::thread::spawn_named;
static READ_SIZE: usize = 8192;

View file

@ -29,7 +29,7 @@ use net_traits::hosts::replace_hosts;
use net_traits::{CookieSource, IncludeSubdomains, LoadConsumer, LoadContext, LoadData, Metadata};
use openssl::ssl::error::{SslError, OpensslError};
use openssl::ssl::{SSL_OP_NO_SSLV2, SSL_OP_NO_SSLV3, SSL_VERIFY_PEER, SslContext, SslMethod};
use resource_task::{CancellationListener, send_error, start_sending_sniffed_opt};
use resource_thread::{CancellationListener, send_error, start_sending_sniffed_opt};
use std::borrow::ToOwned;
use std::boxed::FnBox;
use std::collections::HashSet;
@ -41,7 +41,7 @@ use time;
use time::Tm;
use url::Url;
use util::resource_files::resources_dir_path;
use util::task::spawn_named;
use util::thread::spawn_named;
use uuid;
pub type Connector = HttpsConnector<Openssl>;

View file

@ -5,10 +5,10 @@
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
use net_traits::image::base::{Image, load_from_memory};
use net_traits::image_cache_task::ImageResponder;
use net_traits::image_cache_task::{ImageCacheChan, ImageCacheCommand, ImageCacheTask, ImageState};
use net_traits::image_cache_task::{ImageCacheResult, ImageResponse, UsePlaceholder};
use net_traits::{AsyncResponseTarget, ControlMsg, LoadConsumer, LoadData, ResourceTask};
use net_traits::image_cache_thread::ImageResponder;
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheCommand, ImageCacheThread, ImageState};
use net_traits::image_cache_thread::{ImageCacheResult, ImageResponse, UsePlaceholder};
use net_traits::{AsyncResponseTarget, ControlMsg, LoadConsumer, LoadData, ResourceThread};
use net_traits::{ResponseAction, LoadContext};
use std::borrow::ToOwned;
use std::collections::HashMap;
@ -20,19 +20,19 @@ use std::sync::Arc;
use std::sync::mpsc::{Receiver, Select, Sender, channel};
use url::Url;
use util::resource_files::resources_dir_path;
use util::task::spawn_named;
use util::taskpool::TaskPool;
use util::thread::spawn_named;
use util::threadpool::ThreadPool;
///
/// TODO(gw): Remaining work on image cache:
/// * Make use of the prefetch support in various parts of the code.
/// * Profile time in GetImageIfAvailable - might be worth caching these results per paint / layout task.
/// * Profile time in GetImageIfAvailable - might be worth caching these results per paint / layout thread.
///
/// MAYBE(Yoric):
/// * For faster lookups, it might be useful to store the LoadKey in the DOM once we have performed a first load.
/// Represents an image that is either being loaded
/// by the resource task, or decoded by a worker thread.
/// by the resource thread, or decoded by a worker thread.
struct PendingLoad {
// The bytes loaded so far. Reset to an empty vector once loading
// is complete and the buffer has been transmitted to the decoder.
@ -215,7 +215,7 @@ struct ImageCache {
// Receive commands from clients
cmd_receiver: Receiver<ImageCacheCommand>,
// Receive notifications from the resource task
// Receive notifications from the resource thread
progress_receiver: Receiver<ResourceLoadInfo>,
progress_sender: Sender<ResourceLoadInfo>,
@ -224,10 +224,10 @@ struct ImageCache {
decoder_sender: Sender<DecoderMsg>,
// Worker threads for decoding images.
task_pool: TaskPool,
thread_pool: ThreadPool,
// Resource task handle
resource_task: ResourceTask,
// Resource thread handle
resource_thread: ResourceThread,
// Images that are loading over network, or decoding.
pending_loads: AllPendingLoads,
@ -239,13 +239,13 @@ struct ImageCache {
placeholder_image: Option<Arc<Image>>,
}
/// Message that the decoder worker threads send to main image cache task.
/// Message that the decoder worker threads send to main image cache thread.
struct DecoderMsg {
key: LoadKey,
image: Option<Image>,
}
/// The types of messages that the main image cache task receives.
/// The types of messages that the main image cache thread receives.
enum SelectResult {
Command(ImageCacheCommand),
Progress(ResourceLoadInfo),
@ -338,7 +338,7 @@ impl ImageCache {
None
}
// Handle progress messages from the resource task
// Handle progress messages from the resource thread
fn handle_progress(&mut self, msg: ResourceLoadInfo) {
match (msg.action, msg.key) {
(ResponseAction::HeadersAvailable(_), _) => {}
@ -355,7 +355,7 @@ impl ImageCache {
let bytes = mem::replace(&mut pending_load.bytes, vec!());
let sender = self.decoder_sender.clone();
self.task_pool.execute(move || {
self.thread_pool.execute(move || {
let image = load_from_memory(&bytes);
let msg = DecoderMsg {
key: key,
@ -423,7 +423,7 @@ impl ImageCache {
match cache_result {
CacheResult::Miss => {
// A new load request! Request the load from
// the resource task.
// the resource thread.
let load_data = LoadData::new(LoadContext::Image, (*ref_url).clone(), None);
let (action_sender, action_receiver) = ipc::channel().unwrap();
let response_target = AsyncResponseTarget {
@ -440,7 +440,7 @@ impl ImageCache {
key: load_key,
}).unwrap();
});
self.resource_task.send(msg).unwrap();
self.resource_thread.send(msg).unwrap();
}
CacheResult::Hit => {
// Request is already on its way.
@ -452,7 +452,7 @@ impl ImageCache {
}
/// Create a new image cache.
pub fn new_image_cache_task(resource_task: ResourceTask) -> ImageCacheTask {
pub fn new_image_cache_thread(resource_thread: ResourceThread) -> ImageCacheThread {
let (ipc_command_sender, ipc_command_receiver) = ipc::channel().unwrap();
let (progress_sender, progress_receiver) = channel();
let (decoder_sender, decoder_receiver) = channel();
@ -480,15 +480,15 @@ pub fn new_image_cache_task(resource_task: ResourceTask) -> ImageCacheTask {
progress_receiver: progress_receiver,
decoder_sender: decoder_sender,
decoder_receiver: decoder_receiver,
task_pool: TaskPool::new(4),
thread_pool: ThreadPool::new(4),
pending_loads: AllPendingLoads::new(),
completed_loads: HashMap::new(),
resource_task: resource_task,
resource_thread: resource_thread,
placeholder_image: placeholder_image,
};
cache.run();
});
ImageCacheTask::new(ipc_command_sender)
ImageCacheThread::new(ipc_command_sender)
}

View file

@ -36,11 +36,11 @@ pub mod data_loader;
pub mod file_loader;
pub mod hsts;
pub mod http_loader;
pub mod image_cache_task;
pub mod image_cache_thread;
pub mod mime_classifier;
pub mod pub_domains;
pub mod resource_task;
pub mod storage_task;
pub mod resource_thread;
pub mod storage_thread;
pub mod websocket_loader;
/// An implementation of the [Fetch spec](https://fetch.spec.whatwg.org/)

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! A task that takes a URL and streams back the binary data.
//! A thread that takes a URL and streams back the binary data.
use about_loader;
use cookie;
@ -19,7 +19,7 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use mime_classifier::{ApacheBugFlag, MIMEClassifier, NoSniffFlag};
use net_traits::LoadContext;
use net_traits::ProgressMsg::Done;
use net_traits::{AsyncResponseTarget, Metadata, ProgressMsg, ResourceTask, ResponseAction};
use net_traits::{AsyncResponseTarget, Metadata, ProgressMsg, ResourceThread, ResponseAction};
use net_traits::{ControlMsg, CookieSource, LoadConsumer, LoadData, LoadResponse, ResourceId};
use net_traits::{WebSocketCommunicate, WebSocketConnectData};
use std::borrow::ToOwned;
@ -30,7 +30,7 @@ use std::sync::mpsc::{Receiver, Sender, channel};
use std::sync::{Arc, RwLock};
use url::Url;
use util::prefs;
use util::task::spawn_named;
use util::thread::spawn_named;
use websocket_loader;
pub enum ProgressSender {
@ -145,9 +145,9 @@ fn start_sending_opt(start_chan: LoadConsumer, metadata: Metadata) -> Result<Pro
}
}
/// Create a ResourceTask
pub fn new_resource_task(user_agent: String,
devtools_chan: Option<Sender<DevtoolsControlMsg>>) -> ResourceTask {
/// Create a ResourceThread
pub fn new_resource_thread(user_agent: String,
devtools_chan: Option<Sender<DevtoolsControlMsg>>) -> ResourceThread {
let hsts_preload = match preload_hsts_domains() {
Some(list) => list,
None => HSTSList::new()
@ -175,7 +175,7 @@ struct ResourceChannelManager {
}
impl ResourceChannelManager {
fn start(&mut self, control_sender: ResourceTask) {
fn start(&mut self, control_sender: ResourceThread) {
loop {
match self.from_client.recv().unwrap() {
ControlMsg::Load(load_data, consumer, id_sender) =>
@ -213,15 +213,15 @@ pub struct CancellableResource {
/// If we haven't initiated any cancel requests, then the loaders ask
/// the listener to remove the `ResourceId` in the `HashMap` of
/// `ResourceManager` once they finish loading
resource_task: ResourceTask,
resource_thread: ResourceThread,
}
impl CancellableResource {
pub fn new(receiver: Receiver<()>, res_id: ResourceId, res_task: ResourceTask) -> CancellableResource {
pub fn new(receiver: Receiver<()>, res_id: ResourceId, res_thread: ResourceThread) -> CancellableResource {
CancellableResource {
cancel_receiver: receiver,
resource_id: res_id,
resource_task: res_task,
resource_thread: res_thread,
}
}
}
@ -264,7 +264,7 @@ impl Drop for CancellationListener {
fn drop(&mut self) {
if let Some(ref resource) = self.cancel_resource {
// Ensure that the resource manager stops tracking this request now that it's terminated.
let _ = resource.resource_task.send(ControlMsg::Cancel(resource.resource_id));
let _ = resource.resource_thread.send(ControlMsg::Cancel(resource.resource_id));
}
}
}
@ -313,7 +313,7 @@ impl ResourceManager {
load_data: LoadData,
consumer: LoadConsumer,
id_sender: Option<IpcSender<ResourceId>>,
resource_task: ResourceTask) {
resource_thread: ResourceThread) {
fn from_factory(factory: fn(LoadData, LoadConsumer, Arc<MIMEClassifier>, CancellationListener))
-> Box<FnBox(LoadData,
@ -331,7 +331,7 @@ impl ResourceManager {
let (cancel_sender, cancel_receiver) = channel();
self.cancel_load_map.insert(current_res_id, cancel_sender);
self.next_resource_id.0 += 1;
CancellableResource::new(cancel_receiver, current_res_id, resource_task)
CancellableResource::new(cancel_receiver, current_res_id, resource_thread)
});
let cancel_listener = CancellationListener::new(cancel_resource);
@ -346,12 +346,12 @@ impl ResourceManager {
"data" => from_factory(data_loader::factory),
"about" => from_factory(about_loader::factory),
_ => {
debug!("resource_task: no loader for scheme {}", load_data.url.scheme);
debug!("resource_thread: no loader for scheme {}", load_data.url.scheme);
send_error(load_data.url, "no loader for scheme".to_owned(), consumer);
return
}
};
debug!("resource_task: loading url: {}", load_data.url.serialize());
debug!("resource_thread: loading url: {}", load_data.url.serialize());
loader.call_box((load_data,
consumer,

View file

@ -3,23 +3,23 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use net_traits::storage_task::{StorageTask, StorageTaskMsg, StorageType};
use net_traits::storage_thread::{StorageThread, StorageThreadMsg, StorageType};
use std::borrow::ToOwned;
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::sync::mpsc::channel;
use url::Url;
use util::task::spawn_named;
use util::thread::spawn_named;
const QUOTA_SIZE_LIMIT: usize = 5 * 1024 * 1024;
pub trait StorageTaskFactory {
pub trait StorageThreadFactory {
fn new() -> Self;
}
impl StorageTaskFactory for StorageTask {
/// Create a StorageTask
fn new() -> StorageTask {
impl StorageThreadFactory for StorageThread {
/// Create a StorageThread
fn new() -> StorageThread {
let (chan, port) = ipc::channel().unwrap();
spawn_named("StorageManager".to_owned(), move || {
StorageManager::new(port).start();
@ -29,13 +29,13 @@ impl StorageTaskFactory for StorageTask {
}
struct StorageManager {
port: IpcReceiver<StorageTaskMsg>,
port: IpcReceiver<StorageThreadMsg>,
session_data: HashMap<String, (usize, BTreeMap<String, String>)>,
local_data: HashMap<String, (usize, BTreeMap<String, String>)>,
}
impl StorageManager {
fn new(port: IpcReceiver<StorageTaskMsg>) -> StorageManager {
fn new(port: IpcReceiver<StorageThreadMsg>) -> StorageManager {
StorageManager {
port: port,
session_data: HashMap::new(),
@ -48,28 +48,28 @@ impl StorageManager {
fn start(&mut self) {
loop {
match self.port.recv().unwrap() {
StorageTaskMsg::Length(sender, url, storage_type) => {
StorageThreadMsg::Length(sender, url, storage_type) => {
self.length(sender, url, storage_type)
}
StorageTaskMsg::Key(sender, url, storage_type, index) => {
StorageThreadMsg::Key(sender, url, storage_type, index) => {
self.key(sender, url, storage_type, index)
}
StorageTaskMsg::Keys(sender, url, storage_type) => {
StorageThreadMsg::Keys(sender, url, storage_type) => {
self.keys(sender, url, storage_type)
}
StorageTaskMsg::SetItem(sender, url, storage_type, name, value) => {
StorageThreadMsg::SetItem(sender, url, storage_type, name, value) => {
self.set_item(sender, url, storage_type, name, value)
}
StorageTaskMsg::GetItem(sender, url, storage_type, name) => {
StorageThreadMsg::GetItem(sender, url, storage_type, name) => {
self.request_item(sender, url, storage_type, name)
}
StorageTaskMsg::RemoveItem(sender, url, storage_type, name) => {
StorageThreadMsg::RemoveItem(sender, url, storage_type, name) => {
self.remove_item(sender, url, storage_type, name)
}
StorageTaskMsg::Clear(sender, url, storage_type) => {
StorageThreadMsg::Clear(sender, url, storage_type) => {
self.clear(sender, url, storage_type)
}
StorageTaskMsg::Exit => {
StorageThreadMsg::Exit => {
break
}
}

View file

@ -10,7 +10,7 @@ use net_traits::{WebSocketCommunicate, WebSocketConnectData, WebSocketDomAction,
use std::ascii::AsciiExt;
use std::sync::{Arc, Mutex};
use std::thread;
use util::task::spawn_named;
use util::thread::spawn_named;
use websocket::client::receiver::Receiver;
use websocket::client::request::Url;
use websocket::client::sender::Sender;