mirror of
https://github.com/servo/servo.git
synced 2025-06-13 02:44:29 +00:00
Pass the UIProvider to FileManager::handle() as needed.
This commit is contained in:
parent
f672bf9eab
commit
ae1340bf50
6 changed files with 88 additions and 94 deletions
|
@ -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/. */
|
||||
|
||||
use filemanager_thread::{FileManager, UIProvider};
|
||||
use filemanager_thread::FileManager;
|
||||
use hyper::header::{Charset, ContentLength, ContentType, Headers};
|
||||
use hyper::header::{ContentDisposition, DispositionParam, DispositionType};
|
||||
use hyper_serde::Serde;
|
||||
|
@ -24,7 +24,7 @@ use util::thread::spawn_named;
|
|||
// TODO: Check on GET
|
||||
// https://w3c.github.io/FileAPI/#requestResponseModel
|
||||
|
||||
pub fn factory<UI: 'static + UIProvider>(filemanager: FileManager<UI>)
|
||||
pub fn factory(filemanager: FileManager)
|
||||
-> Box<FnBox(LoadData, LoadConsumer, Arc<MimeClassifier>, CancellationListener) + Send> {
|
||||
box move |load_data: LoadData, start_chan, classifier, cancel_listener| {
|
||||
spawn_named(format!("blob loader for {}", load_data.url), move || {
|
||||
|
@ -33,10 +33,9 @@ pub fn factory<UI: 'static + UIProvider>(filemanager: FileManager<UI>)
|
|||
}
|
||||
}
|
||||
|
||||
fn load_blob<UI: 'static + UIProvider>
|
||||
(load_data: LoadData, start_chan: LoadConsumer,
|
||||
fn load_blob(load_data: LoadData, start_chan: LoadConsumer,
|
||||
classifier: Arc<MimeClassifier>,
|
||||
filemanager: FileManager<UI>,
|
||||
filemanager: FileManager,
|
||||
cancel_listener: CancellationListener) {
|
||||
let (chan, recv) = ipc::channel().unwrap();
|
||||
if let Ok((id, origin, _fragment)) = parse_blob_url(&load_data.url.clone()) {
|
||||
|
@ -122,9 +121,9 @@ fn load_blob<UI: 'static + UIProvider>
|
|||
|
||||
/// https://fetch.spec.whatwg.org/#concept-basic-fetch (partial)
|
||||
// TODO: make async.
|
||||
pub fn load_blob_sync<UI: 'static + UIProvider>
|
||||
pub fn load_blob_sync
|
||||
(url: ServoUrl,
|
||||
filemanager: FileManager<UI>)
|
||||
filemanager: FileManager)
|
||||
-> Result<(Headers, Vec<u8>), NetworkError> {
|
||||
let (id, origin) = match parse_blob_url(&url) {
|
||||
Ok((id, origin, _fragment)) => (id, origin),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue