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

@ -37,10 +37,10 @@ use util::mem::HeapSizeOf;
use websocket::header;
pub mod hosts;
pub mod image_cache_task;
pub mod image_cache_thread;
pub mod net_error_list;
pub mod response;
pub mod storage_task;
pub mod storage_thread;
/// Image handling.
///
@ -160,8 +160,8 @@ pub enum LoadConsumer {
Listener(AsyncResponseTarget),
}
/// Handle to a resource task
pub type ResourceTask = IpcSender<ControlMsg>;
/// Handle to a resource thread
pub type ResourceThread = IpcSender<ControlMsg>;
#[derive(PartialEq, Copy, Clone, Deserialize, Serialize)]
pub enum IncludeSubdomains {
@ -220,10 +220,10 @@ pub enum ControlMsg {
}
/// Initialized but unsent request. Encapsulates everything necessary to instruct
/// the resource task to make a new request. The `load` method *must* be called before
/// destruction or the task will panic.
/// the resource thread to make a new request. The `load` method *must* be called before
/// destruction or the thread will panic.
pub struct PendingAsyncLoad {
resource_task: ResourceTask,
resource_thread: ResourceThread,
url: Url,
pipeline: Option<PipelineId>,
guard: PendingLoadGuard,
@ -249,10 +249,10 @@ impl Drop for PendingLoadGuard {
}
impl PendingAsyncLoad {
pub fn new(context: LoadContext, resource_task: ResourceTask, url: Url, pipeline: Option<PipelineId>)
pub fn new(context: LoadContext, resource_thread: ResourceThread, url: Url, pipeline: Option<PipelineId>)
-> PendingAsyncLoad {
PendingAsyncLoad {
resource_task: resource_task,
resource_thread: resource_thread,
url: url,
pipeline: pipeline,
guard: PendingLoadGuard { loaded: false, },
@ -265,7 +265,7 @@ impl PendingAsyncLoad {
self.guard.neuter();
let load_data = LoadData::new(self.context, self.url, self.pipeline);
let consumer = LoadConsumer::Listener(listener);
self.resource_task.send(ControlMsg::Load(load_data, consumer, None)).unwrap();
self.resource_thread.send(ControlMsg::Load(load_data, consumer, None)).unwrap();
}
}
@ -360,12 +360,12 @@ pub enum ProgressMsg {
/// Convenience function for synchronously loading a whole resource.
pub fn load_whole_resource(context: LoadContext,
resource_task: &ResourceTask,
resource_thread: &ResourceThread,
url: Url,
pipeline_id: Option<PipelineId>)
-> Result<(Metadata, Vec<u8>), String> {
let (start_chan, start_port) = ipc::channel().unwrap();
resource_task.send(ControlMsg::Load(LoadData::new(context, url, pipeline_id),
resource_thread.send(ControlMsg::Load(LoadData::new(context, url, pipeline_id),
LoadConsumer::Channel(start_chan), None)).unwrap();
let response = start_port.recv().unwrap();