mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Fix or selectively silence warnings in src/components.
This commit is contained in:
parent
53d5d35e7c
commit
b1c4a9156c
7 changed files with 34 additions and 29 deletions
|
@ -33,7 +33,7 @@ use servo_msg::constellation_msg::{ConstellationChan, InitLoadUrlMsg};
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
use servo_net::image_cache_task::ImageCacheTask;
|
use servo_net::image_cache_task::ImageCacheTask;
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
use servo_net::resource_task::ResourceTask;
|
use servo_net::resource_task::new_resource_task;
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
use servo_util::time::TimeProfiler;
|
use servo_util::time::TimeProfiler;
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
|
@ -106,7 +106,7 @@ pub fn run(opts: opts::Opts) {
|
||||||
pool.spawn(TaskOpts::new(), proc() {
|
pool.spawn(TaskOpts::new(), proc() {
|
||||||
let opts = &opts_clone;
|
let opts = &opts_clone;
|
||||||
// Create a Servo instance.
|
// Create a Servo instance.
|
||||||
let resource_task = ResourceTask();
|
let resource_task = new_resource_task();
|
||||||
// If we are emitting an output file, then we need to block on
|
// If we are emitting an output file, then we need to block on
|
||||||
// image load or we risk emitting an output file missing the
|
// image load or we risk emitting an output file missing the
|
||||||
// image.
|
// image.
|
||||||
|
|
|
@ -10,14 +10,6 @@ use png;
|
||||||
// reference count them.
|
// reference count them.
|
||||||
pub type Image = png::Image;
|
pub type Image = png::Image;
|
||||||
|
|
||||||
pub fn Image(width: u32, height: u32, color_type: png::ColorType, data: Vec<u8>) -> Image {
|
|
||||||
png::Image {
|
|
||||||
width: width,
|
|
||||||
height: height,
|
|
||||||
color_type: color_type,
|
|
||||||
pixels: data,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static TEST_IMAGE: &'static [u8] = include_bin!("test.jpeg");
|
static TEST_IMAGE: &'static [u8] = include_bin!("test.jpeg");
|
||||||
|
|
||||||
|
@ -62,7 +54,12 @@ pub fn load_from_memory(buffer: &[u8]) -> Option<Image> {
|
||||||
stb_image::ImageU8(mut image) => {
|
stb_image::ImageU8(mut image) => {
|
||||||
assert!(image.depth == 4);
|
assert!(image.depth == 4);
|
||||||
byte_swap(png::RGBA8, image.data.as_mut_slice());
|
byte_swap(png::RGBA8, image.data.as_mut_slice());
|
||||||
Some(Image(image.width as u32, image.height as u32, png::RGBA8, image.data))
|
Some(png::Image {
|
||||||
|
width: image.width as u32,
|
||||||
|
height: image.height as u32,
|
||||||
|
color_type: png::RGBA8,
|
||||||
|
pixels: image.data
|
||||||
|
})
|
||||||
}
|
}
|
||||||
stb_image::ImageF32(_image) => fail!("HDR images not implemented"),
|
stb_image::ImageF32(_image) => fail!("HDR images not implemented"),
|
||||||
stb_image::Error(_) => None
|
stb_image::Error(_) => None
|
||||||
|
|
|
@ -165,7 +165,7 @@ each URL scheme
|
||||||
type LoaderTaskFactory = extern "Rust" fn() -> LoaderTask;
|
type LoaderTaskFactory = extern "Rust" fn() -> LoaderTask;
|
||||||
|
|
||||||
/// Create a ResourceTask with the default loaders
|
/// Create a ResourceTask with the default loaders
|
||||||
pub fn ResourceTask() -> ResourceTask {
|
pub fn new_resource_task() -> ResourceTask {
|
||||||
let loaders = vec!(
|
let loaders = vec!(
|
||||||
("file".to_string(), file_loader::factory),
|
("file".to_string(), file_loader::factory),
|
||||||
("http".to_string(), http_loader::factory),
|
("http".to_string(), http_loader::factory),
|
||||||
|
@ -180,7 +180,7 @@ fn create_resource_task_with_loaders(loaders: Vec<(String, LoaderTaskFactory)>)
|
||||||
builder.spawn(proc() {
|
builder.spawn(proc() {
|
||||||
let (chan, port) = channel();
|
let (chan, port) = channel();
|
||||||
setup_chan.send(chan);
|
setup_chan.send(chan);
|
||||||
ResourceManager(port, loaders).start();
|
ResourceManager::new(port, loaders).start();
|
||||||
});
|
});
|
||||||
setup_port.recv()
|
setup_port.recv()
|
||||||
}
|
}
|
||||||
|
@ -192,13 +192,15 @@ struct ResourceManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn ResourceManager(from_client: Receiver<ControlMsg>,
|
impl ResourceManager {
|
||||||
loaders: Vec<(String, LoaderTaskFactory)>) -> ResourceManager {
|
fn new(from_client: Receiver<ControlMsg>, loaders: Vec<(String, LoaderTaskFactory)>)
|
||||||
|
-> ResourceManager {
|
||||||
ResourceManager {
|
ResourceManager {
|
||||||
from_client : from_client,
|
from_client : from_client,
|
||||||
loaders : loaders,
|
loaders : loaders,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
impl ResourceManager {
|
impl ResourceManager {
|
||||||
|
@ -244,13 +246,13 @@ impl ResourceManager {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_exit() {
|
fn test_exit() {
|
||||||
let resource_task = ResourceTask();
|
let resource_task = new_resource_task();
|
||||||
resource_task.send(Exit);
|
resource_task.send(Exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_bad_scheme() {
|
fn test_bad_scheme() {
|
||||||
let resource_task = ResourceTask();
|
let resource_task = new_resource_task();
|
||||||
let (start_chan, start) = channel();
|
let (start_chan, start) = channel();
|
||||||
resource_task.send(Load(LoadData::new(FromStr::from_str("bogus://whatever").unwrap()), start_chan));
|
resource_task.send(Load(LoadData::new(FromStr::from_str("bogus://whatever").unwrap()), start_chan));
|
||||||
let response = start.recv();
|
let response = start.recv();
|
||||||
|
|
|
@ -187,12 +187,14 @@ pub mod computed {
|
||||||
// TODO, as needed: root font size, viewport size, etc.
|
// TODO, as needed: root font size, viewport size, etc.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(non_snake_case_functions)]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn compute_Au(value: specified::Length, context: &Context) -> Au {
|
pub fn compute_Au(value: specified::Length, context: &Context) -> Au {
|
||||||
compute_Au_with_font_size(value, context.font_size)
|
compute_Au_with_font_size(value, context.font_size)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A special version of `compute_Au` used for `font-size`.
|
/// A special version of `compute_Au` used for `font-size`.
|
||||||
|
#[allow(non_snake_case_functions)]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn compute_Au_with_font_size(value: specified::Length, reference_font_size: Au) -> Au {
|
pub fn compute_Au_with_font_size(value: specified::Length, reference_font_size: Au) -> Au {
|
||||||
match value {
|
match value {
|
||||||
|
@ -210,6 +212,7 @@ pub mod computed {
|
||||||
LP_Length(Au),
|
LP_Length(Au),
|
||||||
LP_Percentage(CSSFloat),
|
LP_Percentage(CSSFloat),
|
||||||
}
|
}
|
||||||
|
#[allow(non_snake_case_functions)]
|
||||||
pub fn compute_LengthOrPercentage(value: specified::LengthOrPercentage, context: &Context)
|
pub fn compute_LengthOrPercentage(value: specified::LengthOrPercentage, context: &Context)
|
||||||
-> LengthOrPercentage {
|
-> LengthOrPercentage {
|
||||||
match value {
|
match value {
|
||||||
|
@ -224,6 +227,7 @@ pub mod computed {
|
||||||
LPA_Percentage(CSSFloat),
|
LPA_Percentage(CSSFloat),
|
||||||
LPA_Auto,
|
LPA_Auto,
|
||||||
}
|
}
|
||||||
|
#[allow(non_snake_case_functions)]
|
||||||
pub fn compute_LengthOrPercentageOrAuto(value: specified::LengthOrPercentageOrAuto,
|
pub fn compute_LengthOrPercentageOrAuto(value: specified::LengthOrPercentageOrAuto,
|
||||||
context: &Context) -> LengthOrPercentageOrAuto {
|
context: &Context) -> LengthOrPercentageOrAuto {
|
||||||
match value {
|
match value {
|
||||||
|
@ -239,6 +243,7 @@ pub mod computed {
|
||||||
LPN_Percentage(CSSFloat),
|
LPN_Percentage(CSSFloat),
|
||||||
LPN_None,
|
LPN_None,
|
||||||
}
|
}
|
||||||
|
#[allow(non_snake_case_functions)]
|
||||||
pub fn compute_LengthOrPercentageOrNone(value: specified::LengthOrPercentageOrNone,
|
pub fn compute_LengthOrPercentageOrNone(value: specified::LengthOrPercentageOrNone,
|
||||||
context: &Context) -> LengthOrPercentageOrNone {
|
context: &Context) -> LengthOrPercentageOrNone {
|
||||||
match value {
|
match value {
|
||||||
|
|
|
@ -1365,14 +1365,17 @@ mod property_bit_field {
|
||||||
self.storage[bit / uint::BITS] &= !(1 << (bit % uint::BITS))
|
self.storage[bit / uint::BITS] &= !(1 << (bit % uint::BITS))
|
||||||
}
|
}
|
||||||
% for i, property in enumerate(LONGHANDS):
|
% for i, property in enumerate(LONGHANDS):
|
||||||
|
#[allow(non_snake_case_functions)]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_${property.ident}(&self) -> bool {
|
pub fn get_${property.ident}(&self) -> bool {
|
||||||
self.get(${i})
|
self.get(${i})
|
||||||
}
|
}
|
||||||
|
#[allow(non_snake_case_functions)]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_${property.ident}(&mut self) {
|
pub fn set_${property.ident}(&mut self) {
|
||||||
self.set(${i})
|
self.set(${i})
|
||||||
}
|
}
|
||||||
|
#[allow(non_snake_case_functions)]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn clear_${property.ident}(&mut self) {
|
pub fn clear_${property.ident}(&mut self) {
|
||||||
self.clear(${i})
|
self.clear(${i})
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
use i = std::mem::init;
|
use i = std::mem::init;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::intrinsics;
|
use std::intrinsics;
|
||||||
|
use std::kinds::marker::ContravariantLifetime;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::raw::Slice;
|
use std::raw::Slice;
|
||||||
|
@ -85,7 +86,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> {
|
||||||
SmallVecIterator {
|
SmallVecIterator {
|
||||||
ptr: self.begin(),
|
ptr: self.begin(),
|
||||||
end: self.end(),
|
end: self.end(),
|
||||||
lifetime: None,
|
lifetime: ContravariantLifetime::<'a>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +95,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> {
|
||||||
SmallVecMutIterator {
|
SmallVecMutIterator {
|
||||||
ptr: mem::transmute(self.begin()),
|
ptr: mem::transmute(self.begin()),
|
||||||
end: mem::transmute(self.end()),
|
end: mem::transmute(self.end()),
|
||||||
lifetime: None,
|
lifetime: ContravariantLifetime::<'a>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +117,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> {
|
||||||
allocation: ptr_opt,
|
allocation: ptr_opt,
|
||||||
cap: inline_size,
|
cap: inline_size,
|
||||||
iter: iter,
|
iter: iter,
|
||||||
lifetime: None,
|
lifetime: ContravariantLifetime::<'a>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,7 +248,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> {
|
||||||
pub struct SmallVecIterator<'a,T> {
|
pub struct SmallVecIterator<'a,T> {
|
||||||
ptr: *T,
|
ptr: *T,
|
||||||
end: *T,
|
end: *T,
|
||||||
lifetime: Option<&'a T>
|
lifetime: ContravariantLifetime<'a>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a,T> Iterator<&'a T> for SmallVecIterator<'a,T> {
|
impl<'a,T> Iterator<&'a T> for SmallVecIterator<'a,T> {
|
||||||
|
@ -271,7 +272,7 @@ impl<'a,T> Iterator<&'a T> for SmallVecIterator<'a,T> {
|
||||||
pub struct SmallVecMutIterator<'a,T> {
|
pub struct SmallVecMutIterator<'a,T> {
|
||||||
ptr: *mut T,
|
ptr: *mut T,
|
||||||
end: *mut T,
|
end: *mut T,
|
||||||
lifetime: Option<&'a mut T>
|
lifetime: ContravariantLifetime<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a,T> Iterator<&'a mut T> for SmallVecMutIterator<'a,T> {
|
impl<'a,T> Iterator<&'a mut T> for SmallVecMutIterator<'a,T> {
|
||||||
|
@ -296,7 +297,7 @@ pub struct SmallVecMoveIterator<'a,T> {
|
||||||
allocation: Option<*mut u8>,
|
allocation: Option<*mut u8>,
|
||||||
cap: uint,
|
cap: uint,
|
||||||
iter: SmallVecIterator<'static,T>,
|
iter: SmallVecIterator<'static,T>,
|
||||||
lifetime: Option<&'a T>,
|
lifetime: ContravariantLifetime<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a,T> Iterator<T> for SmallVecMoveIterator<'a,T> {
|
impl<'a,T> Iterator<T> for SmallVecMoveIterator<'a,T> {
|
||||||
|
|
|
@ -48,8 +48,6 @@ enum SupervisorMsg<QueueData, WorkData> {
|
||||||
struct WorkerInfo<QueueData, WorkData> {
|
struct WorkerInfo<QueueData, WorkData> {
|
||||||
/// The communication channel to the workers.
|
/// The communication channel to the workers.
|
||||||
chan: Sender<WorkerMsg<QueueData, WorkData>>,
|
chan: Sender<WorkerMsg<QueueData, WorkData>>,
|
||||||
/// The buffer pool for this deque.
|
|
||||||
pool: BufferPool<WorkUnit<QueueData, WorkData>>,
|
|
||||||
/// The worker end of the deque, if we have it.
|
/// The worker end of the deque, if we have it.
|
||||||
deque: Option<Worker<WorkUnit<QueueData, WorkData>>>,
|
deque: Option<Worker<WorkUnit<QueueData, WorkData>>>,
|
||||||
/// The thief end of the work-stealing deque.
|
/// The thief end of the work-stealing deque.
|
||||||
|
@ -208,7 +206,6 @@ impl<QueueData: Send, WorkData: Send> WorkQueue<QueueData, WorkData> {
|
||||||
let (worker, thief) = pool.deque();
|
let (worker, thief) = pool.deque();
|
||||||
infos.push(WorkerInfo {
|
infos.push(WorkerInfo {
|
||||||
chan: worker_chan,
|
chan: worker_chan,
|
||||||
pool: pool,
|
|
||||||
deque: Some(worker),
|
deque: Some(worker),
|
||||||
thief: thief,
|
thief: thief,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue