mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev.
This commit is contained in:
parent
ff8cbff810
commit
95fc29fa0d
255 changed files with 3550 additions and 3362 deletions
|
@ -12,6 +12,7 @@ use collections::str::Str;
|
|||
use std::borrow::ToOwned;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::{Sender, Receiver, channel};
|
||||
use font_template::{FontTemplate, FontTemplateDescriptor};
|
||||
use platform::font_template::FontTemplateData;
|
||||
use servo_net::resource_task::{ResourceTask, load_whole_resource};
|
||||
|
@ -80,11 +81,15 @@ pub enum Command {
|
|||
Exit(Sender<()>),
|
||||
}
|
||||
|
||||
unsafe impl Send for Command {}
|
||||
|
||||
/// Reply messages sent from the font cache task to the FontContext caller.
|
||||
pub enum Reply {
|
||||
GetFontTemplateReply(Option<Arc<FontTemplateData>>),
|
||||
}
|
||||
|
||||
unsafe impl Send for Reply {}
|
||||
|
||||
/// The font cache task itself. It maintains a list of reference counted
|
||||
/// font templates that are currently in use.
|
||||
struct FontCache {
|
||||
|
@ -109,7 +114,7 @@ fn add_generic_font(generic_fonts: &mut HashMap<LowercaseString, LowercaseString
|
|||
impl FontCache {
|
||||
fn run(&mut self) {
|
||||
loop {
|
||||
let msg = self.port.recv();
|
||||
let msg = self.port.recv().unwrap();
|
||||
|
||||
match msg {
|
||||
Command::GetFontTemplate(family, descriptor, result) => {
|
||||
|
@ -138,13 +143,13 @@ impl FontCache {
|
|||
family.add_template(url.to_string().as_slice(), Some(bytes));
|
||||
},
|
||||
Err(_) => {
|
||||
debug!("Failed to load web font: family={} url={}", family_name, url);
|
||||
debug!("Failed to load web font: family={:?} url={}", family_name, url);
|
||||
}
|
||||
}
|
||||
}
|
||||
Source::Local(ref local_family_name) => {
|
||||
let family = &mut self.web_families[family_name];
|
||||
get_variations_for_family(local_family_name.as_slice(), |path| {
|
||||
get_variations_for_family(local_family_name.as_slice(), |&mut:path| {
|
||||
family.add_template(path.as_slice(), None);
|
||||
});
|
||||
}
|
||||
|
@ -186,7 +191,7 @@ impl FontCache {
|
|||
let s = &mut self.local_families[*family_name];
|
||||
|
||||
if s.templates.len() == 0 {
|
||||
get_variations_for_family(family_name.as_slice(), |path| {
|
||||
get_variations_for_family(family_name.as_slice(), |&mut:path| {
|
||||
s.add_template(path.as_slice(), None);
|
||||
});
|
||||
}
|
||||
|
@ -244,7 +249,7 @@ impl FontCache {
|
|||
|
||||
/// The public interface to the font cache task, used exclusively by
|
||||
/// the per-thread/task FontContext structures.
|
||||
#[deriving(Clone)]
|
||||
#[derive(Clone)]
|
||||
pub struct FontCacheTask {
|
||||
chan: Sender<Command>,
|
||||
}
|
||||
|
@ -253,7 +258,7 @@ impl FontCacheTask {
|
|||
pub fn new(resource_task: ResourceTask) -> FontCacheTask {
|
||||
let (chan, port) = channel();
|
||||
|
||||
spawn_named("FontCacheTask".to_owned(), proc() {
|
||||
spawn_named("FontCacheTask".to_owned(), move || {
|
||||
// TODO: Allow users to specify these.
|
||||
let mut generic_fonts = HashMap::with_capacity(5);
|
||||
add_generic_font(&mut generic_fonts, "serif", "Times New Roman");
|
||||
|
@ -286,7 +291,7 @@ impl FontCacheTask {
|
|||
let (response_chan, response_port) = channel();
|
||||
self.chan.send(Command::GetFontTemplate(family, desc, response_chan));
|
||||
|
||||
let reply = response_port.recv();
|
||||
let reply = response_port.recv().unwrap();
|
||||
|
||||
match reply {
|
||||
Reply::GetFontTemplateReply(data) => {
|
||||
|
@ -301,7 +306,7 @@ impl FontCacheTask {
|
|||
let (response_chan, response_port) = channel();
|
||||
self.chan.send(Command::GetLastResortFontTemplate(desc, response_chan));
|
||||
|
||||
let reply = response_port.recv();
|
||||
let reply = response_port.recv().unwrap();
|
||||
|
||||
match reply {
|
||||
Reply::GetFontTemplateReply(data) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue