servo: Add more resource_task docs

Source-Repo: https://github.com/servo/servo
Source-Revision: f2c97474c5e2acdf52e6dff1d56d1867efb6f050
This commit is contained in:
Brian Anderson 2012-07-28 17:08:33 -07:00
Родитель 28ea915792
Коммит dbdfa9cd37
1 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -15,19 +15,31 @@ import std::net::url::url;
import result::{result, ok, err}; import result::{result, ok, err};
enum ControlMsg { enum ControlMsg {
/// Request the data associated with a particular URL
Load(url, chan<ProgressMsg>), Load(url, chan<ProgressMsg>),
Exit Exit
} }
/// Messages sent in response to a `Load` message
enum ProgressMsg { enum ProgressMsg {
/// Binary data - there may be multiple of these
Payload(~[u8]), Payload(~[u8]),
/// Indicates loading is complete, either successfully or not
Done(result<(), ()>) Done(result<(), ()>)
} }
/// Handle to a resource task
type ResourceTask = chan<ControlMsg>; type ResourceTask = chan<ControlMsg>;
/// Creates a task to load a specific resource
/**
Creates a task to load a specific resource
The ResourceManager delegates loading to a different type of loader task for
each URL scheme
*/
type LoaderTaskFactory = fn~(url: url, chan<ProgressMsg>); type LoaderTaskFactory = fn~(url: url, chan<ProgressMsg>);
/// Create a ResourceTask with the default loaders
fn ResourceTask() -> ResourceTask { fn ResourceTask() -> ResourceTask {
let loaders = ~[ let loaders = ~[
(~"file", file_loader::factory), (~"file", file_loader::factory),