mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Initial implementation of asynchronous blob url fetching
This commit is contained in:
parent
7c65505df3
commit
e84e1d607b
3 changed files with 171 additions and 90 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 https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::blob_loader::load_blob_sync;
|
||||
use crate::blob_loader::load_blob_async;
|
||||
use crate::data_loader::decode;
|
||||
use crate::fetch::cors_cache::CorsCache;
|
||||
use crate::filemanager_thread::FileManager;
|
||||
|
@ -657,19 +657,11 @@ fn scheme_fetch(
|
|||
));
|
||||
}
|
||||
|
||||
match load_blob_sync(url.clone(), context.filemanager.clone()) {
|
||||
Ok((headers, bytes)) => {
|
||||
let mut response =
|
||||
Response::new(url, ResourceFetchTiming::new(request.timing_type()));
|
||||
response.headers = headers;
|
||||
*response.body.lock().unwrap() = ResponseBody::Done(bytes);
|
||||
response
|
||||
},
|
||||
Err(e) => {
|
||||
debug!("Failed to load {}: {:?}", url, e);
|
||||
Response::network_error(e)
|
||||
},
|
||||
}
|
||||
let mut response = Response::new(url, ResourceFetchTiming::new(request.timing_type()));
|
||||
|
||||
load_blob_async(url.clone(), context.filemanager.clone(), &response, done_chan);
|
||||
|
||||
response
|
||||
},
|
||||
|
||||
"ftp" => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue