Auto merge of #5568 - jdm:net_uint, r=jdm

This commit is contained in:
bors-servo 2015-04-08 01:47:56 -05:00
commit cad27a9d25
8 changed files with 19 additions and 20 deletions

View file

@ -46,14 +46,14 @@ impl HeaderOrMethod {
pub struct CORSCacheEntry { pub struct CORSCacheEntry {
pub origin: Url, pub origin: Url,
pub url: Url, pub url: Url,
pub max_age: uint, pub max_age: u32,
pub credentials: bool, pub credentials: bool,
pub header_or_method: HeaderOrMethod, pub header_or_method: HeaderOrMethod,
created: Timespec created: Timespec
} }
impl CORSCacheEntry { impl CORSCacheEntry {
fn new (origin:Url, url: Url, max_age: uint, credentials: bool, header_or_method: HeaderOrMethod) -> CORSCacheEntry { fn new (origin:Url, url: Url, max_age: u32, credentials: bool, header_or_method: HeaderOrMethod) -> CORSCacheEntry {
CORSCacheEntry { CORSCacheEntry {
origin: origin, origin: origin,
url: url, url: url,
@ -86,7 +86,7 @@ pub trait CORSCache {
/// Updates max age if an entry for a [matching header](http://fetch.spec.whatwg.org/#concept-cache-match-header) is found. /// Updates max age if an entry for a [matching header](http://fetch.spec.whatwg.org/#concept-cache-match-header) is found.
/// ///
/// If not, it will insert an equivalent entry /// If not, it will insert an equivalent entry
fn match_header_and_update(&mut self, request: CacheRequestDetails, header_name: &str, new_max_age: uint) -> bool; fn match_header_and_update(&mut self, request: CacheRequestDetails, header_name: &str, new_max_age: u32) -> bool;
/// Returns true if an entry with a [matching method](http://fetch.spec.whatwg.org/#concept-cache-match-method) is found /// Returns true if an entry with a [matching method](http://fetch.spec.whatwg.org/#concept-cache-match-method) is found
fn match_method(&mut self, request: CacheRequestDetails, method: Method) -> bool; fn match_method(&mut self, request: CacheRequestDetails, method: Method) -> bool;
@ -94,7 +94,7 @@ pub trait CORSCache {
/// Updates max age if an entry for [a matching method](http://fetch.spec.whatwg.org/#concept-cache-match-method) is found. /// Updates max age if an entry for [a matching method](http://fetch.spec.whatwg.org/#concept-cache-match-method) is found.
/// ///
/// If not, it will insert an equivalent entry /// If not, it will insert an equivalent entry
fn match_method_and_update(&mut self, request: CacheRequestDetails, method: Method, new_max_age: uint) -> bool; fn match_method_and_update(&mut self, request: CacheRequestDetails, method: Method, new_max_age: u32) -> bool;
/// Insert an entry /// Insert an entry
fn insert(&mut self, entry: CORSCacheEntry); fn insert(&mut self, entry: CORSCacheEntry);
} }
@ -152,7 +152,7 @@ impl CORSCache for BasicCORSCache {
self.find_entry_by_header(&request, header_name).is_some() self.find_entry_by_header(&request, header_name).is_some()
} }
fn match_header_and_update(&mut self, request: CacheRequestDetails, header_name: &str, new_max_age: uint) -> bool { fn match_header_and_update(&mut self, request: CacheRequestDetails, header_name: &str, new_max_age: u32) -> bool {
match self.find_entry_by_header(&request, header_name).map(|e| e.max_age = new_max_age) { match self.find_entry_by_header(&request, header_name).map(|e| e.max_age = new_max_age) {
Some(_) => true, Some(_) => true,
None => { None => {
@ -167,7 +167,7 @@ impl CORSCache for BasicCORSCache {
self.find_entry_by_method(&request, method).is_some() self.find_entry_by_method(&request, method).is_some()
} }
fn match_method_and_update(&mut self, request: CacheRequestDetails, method: Method, new_max_age: uint) -> bool { fn match_method_and_update(&mut self, request: CacheRequestDetails, method: Method, new_max_age: u32) -> bool {
match self.find_entry_by_method(&request, method.clone()).map(|e| e.max_age = new_max_age) { match self.find_entry_by_method(&request, method.clone()).map(|e| e.max_age = new_max_age) {
Some(_) => true, Some(_) => true,
None => { None => {
@ -190,9 +190,9 @@ pub enum CORSCacheTaskMsg {
Clear(CacheRequestDetails, Sender<()>), Clear(CacheRequestDetails, Sender<()>),
Cleanup(Sender<()>), Cleanup(Sender<()>),
MatchHeader(CacheRequestDetails, String, Sender<bool>), MatchHeader(CacheRequestDetails, String, Sender<bool>),
MatchHeaderUpdate(CacheRequestDetails, String, uint, Sender<bool>), MatchHeaderUpdate(CacheRequestDetails, String, u32, Sender<bool>),
MatchMethod(CacheRequestDetails, Method, Sender<bool>), MatchMethod(CacheRequestDetails, Method, Sender<bool>),
MatchMethodUpdate(CacheRequestDetails, Method, uint, Sender<bool>), MatchMethodUpdate(CacheRequestDetails, Method, u32, Sender<bool>),
Insert(CORSCacheEntry, Sender<()>), Insert(CORSCacheEntry, Sender<()>),
ExitMsg ExitMsg
} }
@ -222,7 +222,7 @@ impl CORSCache for CORSCacheSender {
rx.recv().unwrap_or(false) rx.recv().unwrap_or(false)
} }
fn match_header_and_update(&mut self, request: CacheRequestDetails, header_name: &str, new_max_age: uint) -> bool { fn match_header_and_update(&mut self, request: CacheRequestDetails, header_name: &str, new_max_age: u32) -> bool {
let (tx, rx) = channel(); let (tx, rx) = channel();
self.send(CORSCacheTaskMsg::MatchHeaderUpdate(request, header_name.to_string(), new_max_age, tx)); self.send(CORSCacheTaskMsg::MatchHeaderUpdate(request, header_name.to_string(), new_max_age, tx));
rx.recv().unwrap_or(false) rx.recv().unwrap_or(false)
@ -234,7 +234,7 @@ impl CORSCache for CORSCacheSender {
rx.recv().unwrap_or(false) rx.recv().unwrap_or(false)
} }
fn match_method_and_update(&mut self, request: CacheRequestDetails, method: Method, new_max_age: uint) -> bool { fn match_method_and_update(&mut self, request: CacheRequestDetails, method: Method, new_max_age: u32) -> bool {
let (tx, rx) = channel(); let (tx, rx) = channel();
self.send(CORSCacheTaskMsg::MatchMethodUpdate(request, method, new_max_age, tx)); self.send(CORSCacheTaskMsg::MatchMethodUpdate(request, method, new_max_age, tx));
rx.recv().unwrap_or(false) rx.recv().unwrap_or(false)

View file

@ -84,7 +84,7 @@ pub struct Request {
pub credentials_mode: CredentialsMode, pub credentials_mode: CredentialsMode,
pub use_url_credentials: bool, pub use_url_credentials: bool,
pub manual_redirect: bool, pub manual_redirect: bool,
pub redirect_count: uint, pub redirect_count: u32,
pub response_tainting: ResponseTainting, pub response_tainting: ResponseTainting,
pub cache: Option<Box<CORSCache+'static>> pub cache: Option<Box<CORSCache+'static>>
} }

View file

@ -15,7 +15,7 @@ use std::sync::Arc;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use util::task::spawn_named; use util::task::spawn_named;
static READ_SIZE: uint = 8192; static READ_SIZE: usize = 8192;
enum ReadStatus { enum ReadStatus {
Partial(Vec<u8>), Partial(Vec<u8>),

View file

@ -70,8 +70,8 @@ fn load(mut load_data: LoadData, classifier: Arc<MIMEClassifier>, cookies_chan:
// FIXME: At the time of writing this FIXME, servo didn't have any central // FIXME: At the time of writing this FIXME, servo didn't have any central
// location for configuration. If you're reading this and such a // location for configuration. If you're reading this and such a
// repository DOES exist, please update this constant to use it. // repository DOES exist, please update this constant to use it.
let max_redirects = 50u; let max_redirects = 50;
let mut iters = 0u; let mut iters = 0;
let start_chan = load_data.consumer; let start_chan = load_data.consumer;
let mut url = load_data.url.clone(); let mut url = load_data.url.clone();
let mut redirected_to = HashSet::new(); let mut redirected_to = HashSet::new();

View file

@ -6,7 +6,6 @@
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(collections)] #![feature(collections)]
#![feature(core)] #![feature(core)]
#![feature(int_uint)]
#![feature(io)] #![feature(io)]
#![cfg_attr(test, feature(net))] #![cfg_attr(test, feature(net))]
#![feature(path)] #![feature(path)]

View file

@ -86,17 +86,17 @@ impl StorageManager {
} }
} }
fn length(&self, sender: Sender<u32>, url: Url, storage_type: StorageType) { fn length(&self, sender: Sender<usize>, url: Url, storage_type: StorageType) {
let origin = self.get_origin_as_string(url); let origin = self.get_origin_as_string(url);
let data = self.select_data(storage_type); let data = self.select_data(storage_type);
sender.send(data.get(&origin).map_or(0u, |entry| entry.len()) as u32).unwrap(); sender.send(data.get(&origin).map_or(0, |entry| entry.len())).unwrap();
} }
fn key(&self, sender: Sender<Option<DOMString>>, url: Url, storage_type: StorageType, index: u32) { fn key(&self, sender: Sender<Option<DOMString>>, url: Url, storage_type: StorageType, index: u32) {
let origin = self.get_origin_as_string(url); let origin = self.get_origin_as_string(url);
let data = self.select_data(storage_type); let data = self.select_data(storage_type);
sender.send(data.get(&origin) sender.send(data.get(&origin)
.and_then(|entry| entry.keys().nth(index as uint)) .and_then(|entry| entry.keys().nth(index as usize))
.map(|key| key.clone())).unwrap(); .map(|key| key.clone())).unwrap();
} }

View file

@ -16,7 +16,7 @@ pub enum StorageType {
/// Request operations on the storage data associated with a particular url /// Request operations on the storage data associated with a particular url
pub enum StorageTaskMsg { pub enum StorageTaskMsg {
/// gets the number of key/value pairs present in the associated storage data /// gets the number of key/value pairs present in the associated storage data
Length(Sender<u32>, Url, StorageType), Length(Sender<usize>, Url, StorageType),
/// gets the name of the key at the specified index in the associated storage data /// gets the name of the key at the specified index in the associated storage data
Key(Sender<Option<DOMString>>, Url, StorageType, u32), Key(Sender<Option<DOMString>>, Url, StorageType, u32),

View file

@ -63,7 +63,7 @@ impl<'a> StorageMethods for JSRef<'a, Storage> {
let (sender, receiver) = channel(); let (sender, receiver) = channel();
self.get_storage_task().send(StorageTaskMsg::Length(sender, self.get_url(), self.storage_type)).unwrap(); self.get_storage_task().send(StorageTaskMsg::Length(sender, self.get_url(), self.storage_type)).unwrap();
receiver.recv().unwrap() receiver.recv().unwrap() as u32
} }
fn Key(self, index: u32) -> Option<DOMString> { fn Key(self, index: u32) -> Option<DOMString> {