Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re: Add new Servo Logo (continuing #25749) #25846

Closed
wants to merge 56 commits into from
Closed
Changes from 2 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
895500e
add a fetch token for blob urls
gterzian Feb 12, 2020
430a65b
Remove azure canvas backend
dralley Feb 25, 2020
2df4d9f
Implement mapReadAsync function of GPUBuffer
imiklos Feb 11, 2020
5a55ae1
Update web-platform-tests to revision 2be2d7e3abcde5baded3448b85d0bb8…
servo-wpt-sync Feb 25, 2020
0146ec0
Update webxr for openxr VR support.
jdm Feb 25, 2020
ba83f0f
Don't panic when dealing with disconnected websockets.
jdm Feb 25, 2020
3d46055
Update layout-2020 results.
jdm Feb 25, 2020
cd00e57
Auto merge of #25740 - gterzian:per_fetch_filemanager_handle, r=Manis…
bors-servo Feb 25, 2020
b317405
Replace Servo.ico with new logo asset
malqinneh Feb 25, 2020
598c6c8
Replace servo.png/.icns with new logo asset
malqinneh Feb 25, 2020
77b840e
Delete servo-100.png
malqinneh Feb 25, 2020
98a06ac
Delete servo-1000.png
malqinneh Feb 25, 2020
76f037e
Delete servo-1024.png
malqinneh Feb 25, 2020
ff2057e
Delete servo-500.png
malqinneh Feb 25, 2020
38d18e9
Delete servo-64.png
malqinneh Feb 25, 2020
5da9c29
Delete servo-500-icon.ico
malqinneh Feb 25, 2020
05e81c1
Add new Servo logo(s) with revised filename
malqinneh Feb 25, 2020
e4fdc83
Update Servo.ico to new filename structure
malqinneh Feb 25, 2020
6116012
Auto merge of #25831 - szeged:wgpu_read_map_async, r=jdm
bors-servo Feb 25, 2020
6494c60
Update servo.png to new filename structure
malqinneh Feb 25, 2020
831e5c8
Update servo64.png to new filename structure
malqinneh Feb 25, 2020
52d7c3c
Delete Servo.ico
malqinneh Feb 25, 2020
c8874f3
Delete servo.png
malqinneh Feb 25, 2020
f6059a4
Delete servo64.png
malqinneh Feb 25, 2020
4576de9
Auto merge of #25841 - dralley:remove-azure, r=SimonSapin
bors-servo Feb 25, 2020
0f9b046
Auto merge of #25842 - servo-wpt-sync:wpt_update_25-02-2020, r=jdm
bors-servo Feb 26, 2020
86ad6ed
Refactor arc() and ellipse() to use lyon_geom::Arc
pylbrecht Feb 19, 2020
f66cd03
Update web-platform-tests to revision a4677f682d251f7c072772973058e77…
servo-wpt-sync Feb 26, 2020
95ba624
Delete servo_1000.png
malqinneh Feb 26, 2020
badaa3a
Delete servo_500.png
malqinneh Feb 26, 2020
c373900
Delete servo_100.png
malqinneh Feb 26, 2020
429a59a
Remove intermittent timeout.
jdm Feb 26, 2020
ad9bfc2
Auto merge of #25801 - pylbrecht:arc.refactor, r=jdm
bors-servo Feb 26, 2020
bfba6b3
Auto merge of #25848 - servo-wpt-sync:wpt_update_26-02-2020, r=jdm
bors-servo Feb 26, 2020
412eccd
Auto merge of #25843 - jdm:xr-up, r=asajeffrey
bors-servo Feb 26, 2020
8fcacee
Update web-platform-tests to revision 1a7f5f868420607ef13a00c6ec14fd9…
servo-wpt-sync Feb 27, 2020
719b197
Auto merge of #25851 - servo-wpt-sync:wpt_update_27-02-2020, r=servo-…
bors-servo Feb 27, 2020
e8ef47e
Replace Servo.ico with new logo asset
malqinneh Feb 25, 2020
a314186
Replace servo.png/.icns with new logo asset
malqinneh Feb 25, 2020
d09bc64
Delete servo-100.png
malqinneh Feb 25, 2020
b04df87
Delete servo-1000.png
malqinneh Feb 25, 2020
5a031f7
Delete servo-1024.png
malqinneh Feb 25, 2020
43a3663
Delete servo-500.png
malqinneh Feb 25, 2020
cd899bb
Delete servo-64.png
malqinneh Feb 25, 2020
921c548
Delete servo-500-icon.ico
malqinneh Feb 25, 2020
15a2e51
Add new Servo logo(s) with revised filename
malqinneh Feb 25, 2020
4369b00
Update Servo.ico to new filename structure
malqinneh Feb 25, 2020
64bdf7a
Update servo.png to new filename structure
malqinneh Feb 25, 2020
4a55e7c
Update servo64.png to new filename structure
malqinneh Feb 25, 2020
33acb98
Delete servo.png
malqinneh Feb 25, 2020
738f40b
Delete servo64.png
malqinneh Feb 25, 2020
c636ca0
Delete servo_1000.png
malqinneh Feb 26, 2020
509b42e
Delete servo_500.png
malqinneh Feb 26, 2020
86a0e66
Delete servo_100.png
malqinneh Feb 26, 2020
fd4306c
Merge branch 'master' of https://github.com/malqinneh/servo
malqinneh Feb 28, 2020
93bb146
Delete servo.ico
malqinneh Feb 28, 2020
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -18,7 +18,7 @@ use hyper::StatusCode;
use ipc_channel::ipc::IpcReceiver;
use mime::{self, Mime};
use net_traits::blob_url_store::{parse_blob_url, BlobURLStoreError};
use net_traits::filemanager_thread::RelativePos;
use net_traits::filemanager_thread::{FileTokenCheck, RelativePos};
use net_traits::request::{
is_cors_safelisted_method, is_cors_safelisted_request_header, Origin, ResponseTainting, Window,
};
@@ -56,6 +56,7 @@ pub struct FetchContext {
pub user_agent: Cow<'static, str>,
pub devtools_chan: Option<Sender<DevtoolsControlMsg>>,
pub filemanager: FileManager,
pub file_token: FileTokenCheck,
pub cancellation_listener: Arc<Mutex<CancellationListener>>,
pub timing: ServoArc<Mutex<ResourceFetchTiming>>,
}
@@ -756,12 +757,12 @@ fn scheme_fetch(
let (done_sender, done_receiver) = unbounded();
*done_chan = Some((done_sender.clone(), done_receiver));
*response.body.lock().unwrap() = ResponseBody::Receiving(vec![]);
let check_url_validity = true;

if let Err(err) = context.filemanager.fetch_file(
&done_sender,
context.cancellation_listener.clone(),
id,
check_url_validity,
&context.file_token,
origin,
&mut response,
range,
@@ -11,14 +11,16 @@ use http::header::{self, HeaderValue};
use ipc_channel::ipc::{self, IpcSender};
use mime::{self, Mime};
use net_traits::blob_url_store::{BlobBuf, BlobURLStoreError};
use net_traits::filemanager_thread::{FileManagerResult, FileManagerThreadMsg, FileOrigin};
use net_traits::filemanager_thread::{
FileManagerResult, FileManagerThreadMsg, FileOrigin, FileTokenCheck,
};
use net_traits::filemanager_thread::{
FileManagerThreadError, ReadFileProgress, RelativePos, SelectedFile,
};
use net_traits::http_percent_encode;
use net_traits::response::{Response, ResponseBody};
use servo_arc::Arc as ServoArc;
use std::collections::HashMap;
use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::io::{BufRead, BufReader, Read, Seek, SeekFrom};
use std::mem;
@@ -46,6 +48,9 @@ struct FileStoreEntry {
/// by the user with createObjectURL. Validity can be revoked as well.
/// (The UUID is the one that maps to this entry in `FileManagerStore`)
is_valid_url: AtomicBool,
/// UUIDs of fetch instances that acquired an interest in this file,
/// when the url was still valid.
outstanding_tokens: HashSet<Uuid>,
}

#[derive(Clone)]
@@ -91,15 +96,14 @@ impl FileManager {
&self,
sender: IpcSender<FileManagerResult<ReadFileProgress>>,
id: Uuid,
check_url_validity: bool,
origin: FileOrigin,
) {
let store = self.store.clone();
self.thread_pool
.upgrade()
.and_then(|pool| {
pool.spawn(move || {
if let Err(e) = store.try_read_file(&sender, id, check_url_validity, origin) {
if let Err(e) = store.try_read_file(&sender, id, origin) {
let _ = sender.send(Err(FileManagerThreadError::BlobURLStoreError(e)));
}
});
@@ -110,6 +114,14 @@ impl FileManager {
});
}

pub fn get_token_for_file(&self, file_id: &Uuid) -> FileTokenCheck {
self.store.get_token_for_file(file_id)
}

pub fn invalidate_token(&self, token: &FileTokenCheck, file_id: &Uuid) {
self.store.invalidate_token(token, file_id);
}

// Read a file for the Fetch implementation.
// It gets the required headers synchronously and reads the actual content
// in a separate thread.
@@ -118,7 +130,7 @@ impl FileManager {
done_sender: &Sender<Data>,
cancellation_listener: Arc<Mutex<CancellationListener>>,
id: Uuid,
check_url_validity: bool,
file_token: &FileTokenCheck,
origin: FileOrigin,
response: &mut Response,
range: RangeRequestBounds,
@@ -127,9 +139,9 @@ impl FileManager {
done_sender,
cancellation_listener,
&id,
file_token,
&origin,
range,
check_url_validity,
response,
)
}
@@ -175,8 +187,8 @@ impl FileManager {
);
});
},
FileManagerThreadMsg::ReadFile(sender, id, check_url_validity, origin) => {
self.read_file(sender, id, check_url_validity, origin);
FileManagerThreadMsg::ReadFile(sender, id, origin) => {
self.read_file(sender, id, origin);
},
FileManagerThreadMsg::PromoteMemory(id, blob_buf, set_valid, origin) => {
self.promote_memory(id, blob_buf, set_valid, origin);
@@ -273,12 +285,12 @@ impl FileManager {
done_sender: &Sender<Data>,
cancellation_listener: Arc<Mutex<CancellationListener>>,
id: &Uuid,
file_token: &FileTokenCheck,
origin_in: &FileOrigin,
range: RangeRequestBounds,
check_url_validity: bool,
response: &mut Response,
) -> Result<(), BlobURLStoreError> {
let file_impl = self.store.get_impl(id, origin_in, check_url_validity)?;
let file_impl = self.store.get_impl(id, file_token, origin_in)?;
match file_impl {
FileImpl::Memory(buf) => {
let range = match range.get_final(Some(buf.size)) {
@@ -362,11 +374,11 @@ impl FileManager {
done_sender,
cancellation_listener,
&parent_id,
file_token,
origin_in,
RangeRequestBounds::Final(
RelativePos::full_range().slice_inner(&inner_rel_pos),
),
false,
response,
);
},
@@ -392,26 +404,82 @@ impl FileManagerStore {
pub fn get_impl(
&self,
id: &Uuid,
file_token: &FileTokenCheck,
origin_in: &FileOrigin,
check_url_validity: bool,
) -> Result<FileImpl, BlobURLStoreError> {
match self.entries.read().unwrap().get(id) {
Some(ref entry) => {
if *origin_in != *entry.origin {
Err(BlobURLStoreError::InvalidOrigin)
} else {
let is_valid = entry.is_valid_url.load(Ordering::Acquire);
if check_url_validity && !is_valid {
Err(BlobURLStoreError::InvalidFileID)
} else {
Ok(entry.file_impl.clone())
match file_token {
FileTokenCheck::NotRequired => Ok(entry.file_impl.clone()),
FileTokenCheck::Required(token) => {
if entry.outstanding_tokens.contains(token) {
return Ok(entry.file_impl.clone());
}
Err(BlobURLStoreError::InvalidFileID)
},
FileTokenCheck::ShouldFail => Err(BlobURLStoreError::InvalidFileID),
}
}
},
None => Err(BlobURLStoreError::InvalidFileID),
}
}

pub fn invalidate_token(&self, token: &FileTokenCheck, file_id: &Uuid) {
if let FileTokenCheck::Required(token) = token {
let mut entries = self.entries.write().unwrap();
if let Some(entry) = entries.get_mut(file_id) {
entry.outstanding_tokens.remove(token);

// Check if there are references left.
let zero_refs = entry.refs.load(Ordering::Acquire) == 0;

// Check if no other fetch has acquired a token for this file.
let no_outstanding_tokens = entry.outstanding_tokens.len() == 0;

// Check if there is still a blob URL outstanding.
let valid = entry.is_valid_url.load(Ordering::Acquire);

// Can we remove this file?
let do_remove = zero_refs && no_outstanding_tokens && !valid;

if do_remove {
entries.remove(&file_id);
}
}
}
}

pub fn get_token_for_file(&self, file_id: &Uuid) -> FileTokenCheck {
let mut entries = self.entries.write().unwrap();
let parent_id = match entries.get(file_id) {
Some(entry) => {
if let FileImpl::Sliced(ref parent_id, _) = entry.file_impl {
Some(parent_id.clone())
} else {
None
}
},
None => return FileTokenCheck::ShouldFail,
};
let file_id = match parent_id.as_ref() {
Some(id) => id,
None => file_id,
};
if let Some(entry) = entries.get_mut(file_id) {
if !entry.is_valid_url.load(Ordering::Acquire) {
return FileTokenCheck::ShouldFail;
}
let token = Uuid::new_v4();
entry.outstanding_tokens.insert(token.clone());
return FileTokenCheck::Required(token);
}
FileTokenCheck::ShouldFail
}

fn insert(&self, id: Uuid, entry: FileStoreEntry) {
self.entries.write().unwrap().insert(id, entry);
}
@@ -453,6 +521,7 @@ impl FileManagerStore {
// Valid here since AddSlicedURLEntry implies URL creation
// from a BlobImpl::Sliced
is_valid_url: AtomicBool::new(true),
outstanding_tokens: Default::default(),
},
);

@@ -604,6 +673,7 @@ impl FileManagerStore {
refs: AtomicUsize::new(1),
// Invalid here since create_entry is called by file selection
is_valid_url: AtomicBool::new(false),
outstanding_tokens: Default::default(),
},
);

@@ -626,11 +696,11 @@ impl FileManagerStore {
&self,
sender: &IpcSender<FileManagerResult<ReadFileProgress>>,
id: &Uuid,
file_token: &FileTokenCheck,
origin_in: &FileOrigin,
rel_pos: RelativePos,
check_url_validity: bool,
) -> Result<(), BlobURLStoreError> {
let file_impl = self.get_impl(id, origin_in, check_url_validity)?;
let file_impl = self.get_impl(id, file_token, origin_in)?;
match file_impl {
FileImpl::Memory(buf) => {
let range = rel_pos.to_abs_range(buf.size as usize);
@@ -686,9 +756,9 @@ impl FileManagerStore {
self.get_blob_buf(
sender,
&parent_id,
file_token,
origin_in,
rel_pos.slice_inner(&inner_rel_pos),
false,
)
},
}
@@ -699,15 +769,14 @@ impl FileManagerStore {
&self,
sender: &IpcSender<FileManagerResult<ReadFileProgress>>,
id: Uuid,
check_url_validity: bool,
origin_in: FileOrigin,
) -> Result<(), BlobURLStoreError> {
self.get_blob_buf(
sender,
&id,
&FileTokenCheck::NotRequired,
&origin_in,
RelativePos::full_range(),
check_url_validity,
)
}

@@ -724,10 +793,17 @@ impl FileManagerStore {
// last reference, and if it has a reference to parent id
// dec_ref on parent later if necessary
let is_valid = entry.is_valid_url.load(Ordering::Acquire);

// Check if no fetch has acquired a token for this file.
let no_outstanding_tokens = entry.outstanding_tokens.len() == 0;

// Can we remove this file?
let do_remove = !is_valid && no_outstanding_tokens;

if let FileImpl::Sliced(ref parent_id, _) = entry.file_impl {
(!is_valid, Some(parent_id.clone()))
(do_remove, Some(parent_id.clone()))
} else {
(!is_valid, None)
(do_remove, None)
}
}
} else {
@@ -762,6 +838,7 @@ impl FileManagerStore {
file_impl: FileImpl::Memory(blob_buf),
refs: AtomicUsize::new(1),
is_valid_url: AtomicBool::new(set_valid),
outstanding_tokens: Default::default(),
},
);
},
@@ -786,10 +863,16 @@ impl FileManagerStore {
// and store entry id holders
let zero_refs = entry.refs.load(Ordering::Acquire) == 0;

// Check if no fetch has acquired a token for this file.
let no_outstanding_tokens = entry.outstanding_tokens.len() == 0;

// Can we remove this file?
let do_remove = zero_refs && no_outstanding_tokens;

if let FileImpl::Sliced(ref parent_id, _) = entry.file_impl {
(zero_refs, Some(parent_id.clone()), Ok(()))
(do_remove, Some(parent_id.clone()), Ok(()))
} else {
(zero_refs, None, Ok(()))
(do_remove, None, Ok(()))
}
} else {
(false, None, Ok(()))
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.