mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Add logging to font-face loading.
This commit is contained in:
parent
d485bbec09
commit
476a209c45
1 changed files with 5 additions and 0 deletions
|
@ -223,25 +223,30 @@ impl FontCache {
|
||||||
let channel_to_self = self.channel_to_self.clone();
|
let channel_to_self = self.channel_to_self.clone();
|
||||||
let bytes = Mutex::new(Vec::new());
|
let bytes = Mutex::new(Vec::new());
|
||||||
let response_valid = Mutex::new(false);
|
let response_valid = Mutex::new(false);
|
||||||
|
debug!("Loading @font-face {} from {}", family_name, url);
|
||||||
fetch_async(request, &self.core_resource_thread, move |response| {
|
fetch_async(request, &self.core_resource_thread, move |response| {
|
||||||
match response {
|
match response {
|
||||||
FetchResponseMsg::ProcessRequestBody |
|
FetchResponseMsg::ProcessRequestBody |
|
||||||
FetchResponseMsg::ProcessRequestEOF => (),
|
FetchResponseMsg::ProcessRequestEOF => (),
|
||||||
FetchResponseMsg::ProcessResponse(meta_result) => {
|
FetchResponseMsg::ProcessResponse(meta_result) => {
|
||||||
|
trace!("@font-face {} metadata ok={:?}", family_name, meta_result.is_ok());
|
||||||
*response_valid.lock().unwrap() = meta_result.is_ok();
|
*response_valid.lock().unwrap() = meta_result.is_ok();
|
||||||
}
|
}
|
||||||
FetchResponseMsg::ProcessResponseChunk(new_bytes) => {
|
FetchResponseMsg::ProcessResponseChunk(new_bytes) => {
|
||||||
|
trace!("@font-face {} chunk={:?}", family_name, new_bytes);
|
||||||
if *response_valid.lock().unwrap() {
|
if *response_valid.lock().unwrap() {
|
||||||
bytes.lock().unwrap().extend(new_bytes.into_iter())
|
bytes.lock().unwrap().extend(new_bytes.into_iter())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FetchResponseMsg::ProcessResponseEOF(response) => {
|
FetchResponseMsg::ProcessResponseEOF(response) => {
|
||||||
|
trace!("@font-face {} EOF={:?}", family_name, response);
|
||||||
if response.is_err() || !*response_valid.lock().unwrap() {
|
if response.is_err() || !*response_valid.lock().unwrap() {
|
||||||
let msg = Command::AddWebFont(family_name.clone(), sources.clone(), sender.clone());
|
let msg = Command::AddWebFont(family_name.clone(), sources.clone(), sender.clone());
|
||||||
channel_to_self.send(msg).unwrap();
|
channel_to_self.send(msg).unwrap();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let bytes = mem::replace(&mut *bytes.lock().unwrap(), vec![]);
|
let bytes = mem::replace(&mut *bytes.lock().unwrap(), vec![]);
|
||||||
|
trace!("@font-face {} data={:?}", family_name, bytes);
|
||||||
let bytes = match fontsan::process(&bytes) {
|
let bytes = match fontsan::process(&bytes) {
|
||||||
Ok(san) => san,
|
Ok(san) => san,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue