diff options
-rw-r--r-- | components/net_traits/lib.rs | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index 40dcdd7c15c..de59bf654d7 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -274,16 +274,6 @@ impl PendingAsyncLoad { } } - /// Initiate the network request associated with this pending load. - pub fn load(mut self) -> IpcReceiver<LoadResponse> { - self.guard.neuter(); - let load_data = LoadData::new(self.url, self.pipeline); - let (sender, receiver) = ipc::channel().unwrap(); - let consumer = LoadConsumer::Channel(sender); - self.resource_task.send(ControlMsg::Load(load_data, consumer)).unwrap(); - receiver - } - /// Initiate the network request associated with this pending load, using the provided target. pub fn load_async(mut self, listener: AsyncResponseTarget) { self.guard.neuter(); @@ -399,33 +389,3 @@ pub fn load_whole_resource(resource_task: &ResourceTask, url: Url, pipeline_id: } } } - -/// Load a URL asynchronously and iterate over chunks of bytes from the response. -pub fn load_bytes_iter(pending: PendingAsyncLoad) -> (Metadata, ProgressMsgPortIterator) { - let input_port = pending.load(); - let response = input_port.recv().unwrap(); - let iter = ProgressMsgPortIterator { - progress_port: response.progress_port - }; - (response.metadata, iter) -} - -/// Iterator that reads chunks of bytes from a ProgressMsg port -pub struct ProgressMsgPortIterator { - progress_port: IpcReceiver<ProgressMsg>, -} - -impl Iterator for ProgressMsgPortIterator { - type Item = Vec<u8>; - - fn next(&mut self) -> Option<Vec<u8>> { - match self.progress_port.recv().unwrap() { - ProgressMsg::Payload(data) => Some(data), - ProgressMsg::Done(Ok(())) => None, - ProgressMsg::Done(Err(e)) => { - error!("error receiving bytes: {}", e); - None - } - } - } -} |