diff options
author | Ms2ger <Ms2ger@gmail.com> | 2016-11-02 15:48:23 +0100 |
---|---|---|
committer | Ms2ger <Ms2ger@gmail.com> | 2016-11-24 11:46:24 +0100 |
commit | fb1279ec3a97c16b17ee9ae3add69152029a4bc0 (patch) | |
tree | ecdaf182c5a1748a38238f5e70b5885e531a81bd /components/net/data_loader.rs | |
parent | ce24edc2b363389c3af138622e5ac88d1dd09d2c (diff) | |
download | servo-fb1279ec3a97c16b17ee9ae3add69152029a4bc0.tar.gz servo-fb1279ec3a97c16b17ee9ae3add69152029a4bc0.zip |
Remove CoreResourceMsg::Load.
Also remove now-dead code that rustc warns about.
It turns out that we lost support for some of our custom URL schemes; I intend
to reimplement them, but I believe this will be significantly easier to do
once the legacy code is out of the way.
Diffstat (limited to 'components/net/data_loader.rs')
-rw-r--r-- | components/net/data_loader.rs | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/components/net/data_loader.rs b/components/net/data_loader.rs index 7c26efac2a9..9b2b8ce2ac7 100644 --- a/components/net/data_loader.rs +++ b/components/net/data_loader.rs @@ -3,28 +3,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use hyper::mime::{Attr, Mime, SubLevel, TopLevel, Value}; -use mime_classifier::MimeClassifier; -use net_traits::{LoadData, Metadata, NetworkError}; -use net_traits::LoadConsumer; -use net_traits::ProgressMsg::{Done, Payload}; -use resource_thread::{CancellationListener, send_error, start_sending_sniffed_opt}; use rustc_serialize::base64::FromBase64; use servo_url::ServoUrl; -use std::sync::Arc; use url::Position; use url::percent_encoding::percent_decode; -pub fn factory(load_data: LoadData, - senders: LoadConsumer, - classifier: Arc<MimeClassifier>, - cancel_listener: CancellationListener) { - // 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 thread, if desired. - load(load_data, senders, classifier, cancel_listener) -} - pub enum DecodeError { InvalidDataUri, NonBase64DataUri, @@ -70,33 +53,3 @@ pub fn decode(url: &ServoUrl) -> Result<DecodeData, DecodeError> { } Ok((content_type, bytes)) } - -pub fn load(load_data: LoadData, - start_chan: LoadConsumer, - classifier: Arc<MimeClassifier>, - cancel_listener: CancellationListener) { - let url = load_data.url; - - if cancel_listener.is_cancelled() { - return; - } - - match decode(&url) { - Ok((content_type, bytes)) => { - let mut metadata = Metadata::default(url); - metadata.set_content_type(Some(content_type).as_ref()); - if let Ok(chan) = start_sending_sniffed_opt(start_chan, - metadata, - classifier, - &bytes, - load_data.context) { - let _ = chan.send(Payload(bytes)); - let _ = chan.send(Done(Ok(()))); - } - }, - Err(DecodeError::InvalidDataUri) => - send_error(url, NetworkError::Internal("invalid data uri".to_owned()), start_chan), - Err(DecodeError::NonBase64DataUri) => - send_error(url, NetworkError::Internal("non-base64 data uri".to_owned()), start_chan), - } -} |