aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock95
-rw-r--r--components/jstraceable_derive/lib.rs14
-rw-r--r--components/profile/heartbeats.rs63
-rw-r--r--components/profile/mem.rs155
-rw-r--r--components/profile/time.rs234
-rw-r--r--components/profile/trace_dump.rs13
-rw-r--r--components/profile_traits/energy.rs6
-rw-r--r--components/profile_traits/ipc.rs18
-rw-r--r--components/profile_traits/lib.rs3
-rw-r--r--components/profile_traits/mem.rs61
-rw-r--r--components/profile_traits/time.rs65
-rw-r--r--components/script/dom/audiobuffer.rs7
-rw-r--r--components/script/dom/baseaudiocontext.rs28
-rw-r--r--components/script/dom/offlineaudiocontext.rs4
-rw-r--r--components/script/dom/webglrenderingcontext.rs47
-rw-r--r--components/servo/lib.rs331
-rw-r--r--components/size_of_test/lib.rs12
-rw-r--r--ports/libsimpleservo/build.rs13
-rw-r--r--servo-tidy.toml9
-rw-r--r--tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-one-sample-loop.html.ini3
-rw-r--r--tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-time-limits.html.ini3
-rw-r--r--tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/buffer-resampling.html.ini3
-rw-r--r--tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sample-accurate-scheduling.html.ini6
-rw-r--r--tests/wpt/metadata/webaudio/the-audio-api/the-oscillatornode-interface/detune-limiting.html.ini9
24 files changed, 749 insertions, 453 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 5e03df182d5..ee14093c660 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -455,6 +455,14 @@ dependencies = [
]
[[package]]
+name = "cloudabi"
+version = "0.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "cmake"
version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -604,6 +612,18 @@ dependencies = [
]
[[package]]
+name = "crossbeam-channel"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "parking_lot 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "smallvec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "crossbeam-deque"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -627,6 +647,19 @@ dependencies = [
]
[[package]]
+name = "crossbeam-epoch"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "scopeguard 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "crossbeam-utils"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -635,6 +668,11 @@ dependencies = [
]
[[package]]
+name = "crossbeam-utils"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
name = "cssparser"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1630,6 +1668,23 @@ dependencies = [
]
[[package]]
+name = "ipc-channel"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "crossbeam-channel 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
+ "mio 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "uuid 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "itertools"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2751,6 +2806,23 @@ dependencies = [
]
[[package]]
+name = "rand"
+version = "0.5.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
name = "range"
version = "0.0.1"
dependencies = [
@@ -2778,7 +2850,7 @@ dependencies = [
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -3196,7 +3268,7 @@ dependencies = [
[[package]]
name = "servo-media"
version = "0.1.0"
-source = "git+https://github.com/servo/media#6ecac1c6259b3995e8d6a368e49777e5c2d398ae"
+source = "git+https://github.com/servo/media#44ad355b020168e78ab32db2c6f5286e7db2ba77"
dependencies = [
"servo-media-audio 0.1.0 (git+https://github.com/servo/media)",
"servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)",
@@ -3206,7 +3278,7 @@ dependencies = [
[[package]]
name = "servo-media-audio"
version = "0.1.0"
-source = "git+https://github.com/servo/media#6ecac1c6259b3995e8d6a368e49777e5c2d398ae"
+source = "git+https://github.com/servo/media#44ad355b020168e78ab32db2c6f5286e7db2ba77"
dependencies = [
"byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3219,7 +3291,7 @@ dependencies = [
[[package]]
name = "servo-media-gstreamer"
version = "0.1.0"
-source = "git+https://github.com/servo/media#6ecac1c6259b3995e8d6a368e49777e5c2d398ae"
+source = "git+https://github.com/servo/media#44ad355b020168e78ab32db2c6f5286e7db2ba77"
dependencies = [
"byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3227,7 +3299,7 @@ dependencies = [
"gstreamer-app 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
"gstreamer-audio 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
"gstreamer-player 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "ipc-channel 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "ipc-channel 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-media-audio 0.1.0 (git+https://github.com/servo/media)",
"servo-media-player 0.1.0 (git+https://github.com/servo/media)",
@@ -3237,9 +3309,9 @@ dependencies = [
[[package]]
name = "servo-media-player"
version = "0.1.0"
-source = "git+https://github.com/servo/media#6ecac1c6259b3995e8d6a368e49777e5c2d398ae"
+source = "git+https://github.com/servo/media#44ad355b020168e78ab32db2c6f5286e7db2ba77"
dependencies = [
- "ipc-channel 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "ipc-channel 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -3323,7 +3395,7 @@ dependencies = [
[[package]]
name = "servo_media_derive"
version = "0.1.0"
-source = "git+https://github.com/servo/media#6ecac1c6259b3995e8d6a368e49777e5c2d398ae"
+source = "git+https://github.com/servo/media#44ad355b020168e78ab32db2c6f5286e7db2ba77"
dependencies = [
"quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -4279,6 +4351,7 @@ dependencies = [
"checksum clap 2.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc34bf7d5d66268b466b9852bca925ec1d2650654dab4da081e63fd230145c2e"
"checksum clipboard 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b9b4623b47d8637fc9d47564583d4cc01eb8c8e34e26b2bf348bf4b036acb657"
"checksum clipboard-win 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14cc3e6c075926b96490d5f90d4a5af7be8012a4d8a8698e619655085a7641a3"
+"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
"checksum cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "56d741ea7a69e577f6d06b36b7dff4738f680593dc27a701ffa8506b73ce28bb"
"checksum cocoa 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5cd1afb83b2de9c41e5dfedb2bcccb779d433b958404876009ae4b01746ff23"
"checksum color_quant 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a475fc4af42d83d28adf72968d9bcfaf035a1a9381642d8e85d8a04957767b0d"
@@ -4289,9 +4362,12 @@ dependencies = [
"checksum core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92801c908ea6301ae619ed842a72e01098085fc321b9c2f3f833dad555bba055"
"checksum core-text 11.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157ff38a92496dc676ce36d9124554e9ac66f1c1039f952690ac64f71cfa5968"
"checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb"
+"checksum crossbeam-channel 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6c0a94250b0278d7fc5a894c3d276b11ea164edc8bf8feb10ca1ea517b44a649"
"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3"
"checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150"
+"checksum crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30fecfcac6abfef8771151f8be4abc9e4edc112c2bcb233314cafde2680536e9"
"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9"
+"checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015"
"checksum cssparser 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)" = "495beddc39b1987b8e9f029354eccbd5ef88eb5f1cd24badb764dce338acf2e0"
"checksum cssparser-macros 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f3a5383ae18dbfdeb569ed62019f5bddb2a95cd2d3833313c475a0d014777805"
"checksum darling 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a78af487e4eb8f4421a1770687b328af6bb4494ca93435210678c6eea875c11"
@@ -4376,6 +4452,7 @@ dependencies = [
"checksum io-surface 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5f9a33981dff54baaff80f4decb487a65d148a3c00facc97820d0f09128f74dd"
"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08"
"checksum ipc-channel 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db9daf099728ac5390c73f54e6e3708f0c514d2b51f24373830f568702eadfca"
+"checksum ipc-channel 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd75debad4ffd295c00c6e3634d254df30050b0837a85e5cd039ac424365f24a"
"checksum itertools 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b07332223953b5051bceb67e8c4700aa65291535568e1f12408c43c4a42c0394"
"checksum itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c069bbec61e1ca5a596166e55dfe4773ff745c3d16b700013bcaff9a6df2c682"
"checksum jemalloc-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "479294d130502fada93c7a957e8d059b632b03d6204aca37af557dee947f30a9"
@@ -4467,6 +4544,8 @@ dependencies = [
"checksum quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e44651a0dc4cdd99f71c83b561e221f714912d11af1a4dff0631f923d53af035"
"checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1"
"checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5"
+"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c"
+"checksum rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2"
"checksum rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "485541959c8ecc49865526fe6c4de9653dd6e60d829d6edf0be228167b60372d"
"checksum rayon-core 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d24ad214285a7729b174ed6d3bcfcb80177807f959d95fafd5bfc5c4f201ac8"
"checksum redox_syscall 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "29dbdfd4b9df8ab31dec47c6087b7b13cbf4a776f335e4de8efba8288dda075b"
diff --git a/components/jstraceable_derive/lib.rs b/components/jstraceable_derive/lib.rs
index a780a6e2167..ac793f4d85a 100644
--- a/components/jstraceable_derive/lib.rs
+++ b/components/jstraceable_derive/lib.rs
@@ -3,15 +3,15 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
extern crate quote;
-#[macro_use] extern crate syn;
-#[macro_use] extern crate synstructure;
+#[macro_use]
+extern crate syn;
+#[macro_use]
+extern crate synstructure;
decl_derive!([JSTraceable] => js_traceable_derive);
fn js_traceable_derive(s: synstructure::Structure) -> quote::Tokens {
- let match_body = s.each(|binding| {
- Some(quote!(#binding.trace(tracer);))
- });
+ let match_body = s.each(|binding| Some(quote!(#binding.trace(tracer);)));
let ast = s.ast();
let name = ast.ident;
@@ -19,7 +19,9 @@ fn js_traceable_derive(s: synstructure::Structure) -> quote::Tokens {
let mut where_clause = where_clause.unwrap_or(&parse_quote!(where)).clone();
for param in ast.generics.type_params() {
let ident = param.ident;
- where_clause.predicates.push(parse_quote!(#ident: ::dom::bindings::trace::JSTraceable))
+ where_clause
+ .predicates
+ .push(parse_quote!(#ident: ::dom::bindings::trace::JSTraceable))
}
let tokens = quote! {
diff --git a/components/profile/heartbeats.rs b/components/profile/heartbeats.rs
index 0d474fe3a11..ef95c853fce 100644
--- a/components/profile/heartbeats.rs
+++ b/components/profile/heartbeats.rs
@@ -14,24 +14,22 @@ use std::path::Path;
/// Initialize heartbeats
pub fn init() {
- lock_and_work(|hbs_opt|
+ lock_and_work(|hbs_opt| {
if hbs_opt.is_none() {
let mut hbs: Box<HashMap<ProfilerCategory, Heartbeat>> = Box::new(HashMap::new());
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ApplicationHeartbeat);
*hbs_opt = Some(Box::into_raw(hbs))
}
- );
+ });
}
/// Log regmaining buffer data and cleanup heartbeats
pub fn cleanup() {
- let hbs_opt_box: Option<Box<HashMap<ProfilerCategory, Heartbeat>>> = lock_and_work(|hbs_opt|
- hbs_opt.take().map(|hbs_ptr|
- unsafe {
- Box::from_raw(hbs_ptr)
- }
- )
- );
+ let hbs_opt_box: Option<Box<HashMap<ProfilerCategory, Heartbeat>>> = lock_and_work(|hbs_opt| {
+ hbs_opt
+ .take()
+ .map(|hbs_ptr| unsafe { Box::from_raw(hbs_ptr) })
+ });
if let Some(mut hbs) = hbs_opt_box {
for (_, v) in hbs.iter_mut() {
// log any remaining heartbeat records before dropping
@@ -43,23 +41,23 @@ pub fn cleanup() {
/// Check if a heartbeat exists for the given category
pub fn is_heartbeat_enabled(category: &ProfilerCategory) -> bool {
- let is_enabled = lock_and_work(|hbs_opt|
- hbs_opt.map_or(false, |hbs_ptr|
- unsafe {
- (*hbs_ptr).contains_key(category)
- }
- )
- );
+ let is_enabled = lock_and_work(|hbs_opt| {
+ hbs_opt.map_or(false, |hbs_ptr| unsafe {
+ (*hbs_ptr).contains_key(category)
+ })
+ });
is_enabled || is_create_heartbeat(category)
}
/// Issue a heartbeat (if one exists) for the given category
-pub fn maybe_heartbeat(category: &ProfilerCategory,
- start_time: u64,
- end_time: u64,
- start_energy: u64,
- end_energy: u64) {
- lock_and_work(|hbs_opt|
+pub fn maybe_heartbeat(
+ category: &ProfilerCategory,
+ start_time: u64,
+ end_time: u64,
+ start_energy: u64,
+ end_energy: u64,
+) {
+ lock_and_work(|hbs_opt| {
if let Some(hbs_ptr) = *hbs_opt {
unsafe {
if !(*hbs_ptr).contains_key(category) {
@@ -70,13 +68,14 @@ pub fn maybe_heartbeat(category: &ProfilerCategory,
}
}
}
- );
+ });
}
// TODO(cimes): Android doesn't really do environment variables. Need a better way to configure dynamically.
fn is_create_heartbeat(category: &ProfilerCategory) -> bool {
- opts::get().profile_heartbeats || var_os(format!("SERVO_HEARTBEAT_ENABLE_{:?}", category)).is_some()
+ opts::get().profile_heartbeats ||
+ var_os(format!("SERVO_HEARTBEAT_ENABLE_{:?}", category)).is_some()
}
fn open_heartbeat_log<P: AsRef<Path>>(name: P) -> Option<File> {
@@ -111,8 +110,10 @@ fn get_heartbeat_window_size(category: &ProfilerCategory) -> usize {
}
/// Possibly create a heartbeat
-fn maybe_create_heartbeat(hbs: &mut HashMap<ProfilerCategory, Heartbeat>,
- category: ProfilerCategory) {
+fn maybe_create_heartbeat(
+ hbs: &mut HashMap<ProfilerCategory, Heartbeat>,
+ category: ProfilerCategory,
+) {
if is_create_heartbeat(&category) {
// get optional log file
let logfile: Option<File> = get_heartbeat_log(&category);
@@ -151,11 +152,11 @@ mod synchronized_heartbeat {
static HBS_SPINLOCK: AtomicBool = ATOMIC_BOOL_INIT;
pub fn lock_and_work<F, R>(work: F) -> R
- where F: FnOnce(&mut Option<*mut HashMap<ProfilerCategory, Heartbeat>>) -> R {
+ where
+ F: FnOnce(&mut Option<*mut HashMap<ProfilerCategory, Heartbeat>>) -> R,
+ {
while HBS_SPINLOCK.compare_and_swap(false, true, Ordering::SeqCst) {}
- let result = unsafe {
- work(&mut HBS)
- };
+ let result = unsafe { work(&mut HBS) };
HBS_SPINLOCK.store(false, Ordering::SeqCst);
result
}
@@ -163,7 +164,7 @@ mod synchronized_heartbeat {
/// Callback function used to log the window buffer.
/// When this is called from native C, the heartbeat is safely locked internally and the global lock is held.
/// If calling from this file, you must already hold the global lock!
- pub extern fn heartbeat_window_callback(hb: *const HeartbeatContext) {
+ pub extern "C" fn heartbeat_window_callback(hb: *const HeartbeatContext) {
unsafe {
if let Some(hbs_ptr) = HBS {
for (_, v) in (*hbs_ptr).iter_mut() {
diff --git a/components/profile/mem.rs b/components/profile/mem.rs
index bb2a3873a91..2f2cda21847 100644
--- a/components/profile/mem.rs
+++ b/components/profile/mem.rs
@@ -36,22 +36,24 @@ impl Profiler {
// Create the timer thread if a period was provided.
if let Some(period) = period {
let chan = chan.clone();
- thread::Builder::new().name("Memory profiler timer".to_owned()).spawn(move || {
- loop {
+ thread::Builder::new()
+ .name("Memory profiler timer".to_owned())
+ .spawn(move || loop {
thread::sleep(duration_from_seconds(period));
if chan.send(ProfilerMsg::Print).is_err() {
break;
}
- }
- }).expect("Thread spawning failed");
+ }).expect("Thread spawning failed");
}
// Always spawn the memory profiler. If there is no timer thread it won't receive regular
// `Print` events, but it will still receive the other events.
- thread::Builder::new().name("Memory profiler".to_owned()).spawn(move || {
- let mut mem_profiler = Profiler::new(port);
- mem_profiler.start();
- }).expect("Thread spawning failed");
+ thread::Builder::new()
+ .name("Memory profiler".to_owned())
+ .spawn(move || {
+ let mut mem_profiler = Profiler::new(port);
+ mem_profiler.start();
+ }).expect("Thread spawning failed");
let mem_profiler_chan = ProfilerChan(chan);
@@ -59,12 +61,17 @@ impl Profiler {
// be unregistered, because as long as the memory profiler is running the system memory
// reporter can make measurements.
let (system_reporter_sender, system_reporter_receiver) = ipc::channel().unwrap();
- ROUTER.add_route(system_reporter_receiver.to_opaque(), Box::new(|message| {
- let request: ReporterRequest = message.to().unwrap();
- system_reporter::collect_reports(request)
- }));
- mem_profiler_chan.send(ProfilerMsg::RegisterReporter("system".to_owned(),
- Reporter(system_reporter_sender)));
+ ROUTER.add_route(
+ system_reporter_receiver.to_opaque(),
+ Box::new(|message| {
+ let request: ReporterRequest = message.to().unwrap();
+ system_reporter::collect_reports(request)
+ }),
+ );
+ mem_profiler_chan.send(ProfilerMsg::RegisterReporter(
+ "system".to_owned(),
+ Reporter(system_reporter_sender),
+ ));
mem_profiler_chan
}
@@ -79,9 +86,9 @@ impl Profiler {
pub fn start(&mut self) {
while let Ok(msg) = self.port.recv() {
- if !self.handle_msg(msg) {
- break
- }
+ if !self.handle_msg(msg) {
+ break;
+ }
}
}
@@ -92,8 +99,10 @@ impl Profiler {
let name_clone = name.clone();
match self.reporters.insert(name, reporter) {
None => true,
- Some(_) => panic!(format!("RegisterReporter: '{}' name is already in use",
- name_clone)),
+ Some(_) => panic!(format!(
+ "RegisterReporter: '{}' name is already in use",
+ name_clone
+ )),
}
},
@@ -101,8 +110,7 @@ impl Profiler {
// Panic if it hasn't previously been registered.
match self.reporters.remove(&name) {
Some(_) => true,
- None =>
- panic!(format!("UnregisterReporter: '{}' name is unknown", &name)),
+ None => panic!(format!("UnregisterReporter: '{}' name is unknown", &name)),
}
},
@@ -111,7 +119,7 @@ impl Profiler {
true
},
- ProfilerMsg::Exit => false
+ ProfilerMsg::Exit => false,
}
}
@@ -149,17 +157,20 @@ impl Profiler {
ReportKind::ExplicitJemallocHeapSize |
ReportKind::ExplicitSystemHeapSize |
ReportKind::ExplicitNonHeapSize |
- ReportKind::ExplicitUnknownLocationSize =>
- report.path.insert(0, String::from("explicit")),
+ ReportKind::ExplicitUnknownLocationSize => {
+ report.path.insert(0, String::from("explicit"))
+ },
ReportKind::NonExplicitSize => {},
}
// Update the reported fractions of the heaps, when appropriate.
match report.kind {
- ReportKind::ExplicitJemallocHeapSize =>
- jemalloc_heap_reported_size += report.size,
- ReportKind::ExplicitSystemHeapSize =>
- system_heap_reported_size += report.size,
+ ReportKind::ExplicitJemallocHeapSize => {
+ jemalloc_heap_reported_size += report.size
+ },
+ ReportKind::ExplicitSystemHeapSize => {
+ system_heap_reported_size += report.size
+ },
_ => {},
}
@@ -182,12 +193,16 @@ impl Profiler {
// Compute and insert the heap-unclassified values.
if let Some(jemalloc_heap_allocated_size) = jemalloc_heap_allocated_size {
- forest.insert(&path!["explicit", "jemalloc-heap-unclassified"],
- jemalloc_heap_allocated_size - jemalloc_heap_reported_size);
+ forest.insert(
+ &path!["explicit", "jemalloc-heap-unclassified"],
+ jemalloc_heap_allocated_size - jemalloc_heap_reported_size,
+ );
}
if let Some(system_heap_allocated_size) = system_heap_allocated_size {
- forest.insert(&path!["explicit", "system-heap-unclassified"],
- system_heap_allocated_size - system_heap_reported_size);
+ forest.insert(
+ &path!["explicit", "system-heap-unclassified"],
+ system_heap_allocated_size - system_heap_reported_size,
+ );
}
forest.print();
@@ -222,7 +237,7 @@ impl ReportsTree {
size: 0,
count: 0,
path_seg: path_seg,
- children: vec![]
+ children: vec![],
}
}
@@ -249,7 +264,7 @@ impl ReportsTree {
t.children.len() - 1
},
};
- let tmp = t; // this temporary is needed to satisfy the borrow checker
+ let tmp = t; // this temporary is needed to satisfy the borrow checker
t = &mut tmp.children[i];
}
@@ -286,9 +301,18 @@ impl ReportsTree {
}
let mebi = 1024f64 * 1024f64;
- let count_str = if self.count > 1 { format!(" [{}]", self.count) } else { "".to_owned() };
- println!("|{}{:8.2} MiB -- {}{}",
- indent_str, (self.size as f64) / mebi, self.path_seg, count_str);
+ let count_str = if self.count > 1 {
+ format!(" [{}]", self.count)
+ } else {
+ "".to_owned()
+ };
+ println!(
+ "|{}{:8.2} MiB -- {}{}",
+ indent_str,
+ (self.size as f64) / mebi,
+ self.path_seg,
+ count_str
+ );
for child in &self.children {
child.print(depth + 1);
@@ -314,7 +338,8 @@ impl ReportsForest {
let (head, tail) = path.split_first().unwrap();
// Get the right tree, creating it if necessary.
if !self.trees.contains_key(head) {
- self.trees.insert(head.clone(), ReportsTree::new(head.clone()));
+ self.trees
+ .insert(head.clone(), ReportsTree::new(head.clone()));
}
let t = self.trees.get_mut(head).unwrap();
@@ -405,7 +430,10 @@ mod system_reporter {
// directly from the jemalloc documentation.
// "Total number of bytes allocated by the application."
- report(path![JEMALLOC_HEAP_ALLOCATED_STR], jemalloc_stat("stats.allocated"));
+ report(
+ path![JEMALLOC_HEAP_ALLOCATED_STR],
+ jemalloc_stat("stats.allocated"),
+ );
// "Total number of bytes in active pages allocated by the application.
// This is a multiple of the page size, and greater than or equal to
@@ -422,20 +450,20 @@ mod system_reporter {
}
#[cfg(target_os = "linux")]
- extern {
+ extern "C" {
fn mallinfo() -> struct_mallinfo;
}
#[cfg(target_os = "linux")]
#[repr(C)]
pub struct struct_mallinfo {
- arena: c_int,
- ordblks: c_int,
- smblks: c_int,
- hblks: c_int,
- hblkhd: c_int,
- usmblks: c_int,
- fsmblks: c_int,
+ arena: c_int,
+ ordblks: c_int,
+ smblks: c_int,
+ hblks: c_int,
+ hblkhd: c_int,
+ usmblks: c_int,
+ fsmblks: c_int,
uordblks: c_int,
fordblks: c_int,
keepcost: c_int,
@@ -487,15 +515,26 @@ mod system_reporter {
// Using the same values for the `old` and `new` parameters is enough
// to get the statistics updated.
let rv = unsafe {
- mallctl(epoch_c_name.as_ptr(), epoch_ptr, &mut epoch_len, epoch_ptr,
- epoch_len)
+ mallctl(
+ epoch_c_name.as_ptr(),
+ epoch_ptr,
+ &mut epoch_len,
+ epoch_ptr,
+ epoch_len,
+ )
};
if rv != 0 {
return None;
}
let rv = unsafe {
- mallctl(value_c_name.as_ptr(), value_ptr, &mut value_len, null_mut(), 0)
+ mallctl(
+ value_c_name.as_ptr(),
+ value_ptr,
+ &mut value_len,
+ null_mut(),
+ 0,
+ )
};
if rv != 0 {
return None;
@@ -511,9 +550,7 @@ mod system_reporter {
#[cfg(target_os = "linux")]
fn page_size() -> usize {
- unsafe {
- ::libc::sysconf(::libc::_SC_PAGESIZE) as usize
- }
+ unsafe { ::libc::sysconf(::libc::_SC_PAGESIZE) as usize }
}
#[cfg(target_os = "linux")]
@@ -585,14 +622,18 @@ mod system_reporter {
};
let seg_re = Regex::new(
- r"^[:xdigit:]+-[:xdigit:]+ (....) [:xdigit:]+ [:xdigit:]+:[:xdigit:]+ \d+ +(.*)").unwrap();
+ r"^[:xdigit:]+-[:xdigit:]+ (....) [:xdigit:]+ [:xdigit:]+:[:xdigit:]+ \d+ +(.*)",
+ ).unwrap();
let rss_re = Regex::new(r"^Rss: +(\d+) kB").unwrap();
// We record each segment's resident size.
let mut seg_map: HashMap<String, usize> = HashMap::new();
#[derive(PartialEq)]
- enum LookingFor { Segment, Rss }
+ enum LookingFor {
+ Segment,
+ Rss,
+ }
let mut looking_for = LookingFor::Segment;
let mut curr_seg_name = String::new();
@@ -644,7 +685,9 @@ mod system_reporter {
curr_seg_name.clone()
};
match seg_map.entry(seg_name) {
- Entry::Vacant(entry) => { entry.insert(rss); },
+ Entry::Vacant(entry) => {
+ entry.insert(rss);
+ },
Entry::Occupied(mut entry) => *entry.get_mut() += rss,
}
}
diff --git a/components/profile/time.rs b/components/profile/time.rs
index 6c1130345e0..fd09ca8cd8e 100644
--- a/components/profile/time.rs
+++ b/components/profile/time.rs
@@ -50,11 +50,7 @@ impl Formattable for Option<TimerMetadata> {
},
_ => {
/* The profiling output is the terminal */
- let url = if url.len() > 30 {
- &url[..30]
- } else {
- url
- };
+ let url = if url.len() > 30 { &url[..30] } else { url };
let incremental = match meta.incremental {
TimerMetadataReflowType::Incremental => " yes",
TimerMetadataReflowType::FirstReflow => " no ",
@@ -67,16 +63,12 @@ impl Formattable for Option<TimerMetadata> {
},
}
},
- None => {
- match *output {
- Some(OutputOptions::FileName(_)) => {
- format!(" {}\t{}\t{}", " N/A", " N/A", " N/A")
- },
- _ => {
- format!(" {:14} {:9} {:30}", " N/A", " N/A", " N/A")
- }
- }
- }
+ None => match *output {
+ Some(OutputOptions::FileName(_)) => {
+ format!(" {}\t{}\t{}", " N/A", " N/A", " N/A")
+ },
+ _ => format!(" {:14} {:9} {:30}", " N/A", " N/A", " N/A"),
+ },
}
}
}
@@ -102,7 +94,7 @@ impl Formattable for ProfilerCategory {
ProfilerCategory::LayoutSelectorMatch |
ProfilerCategory::LayoutTreeBuilder |
ProfilerCategory::LayoutTextShaping => "| + ",
- _ => ""
+ _ => "",
};
let name = match *self {
ProfilerCategory::Compositing => "Compositing",
@@ -183,27 +175,29 @@ impl Profiler {
Some(ref option) => {
// Spawn the time profiler thread
let outputoption = option.clone();
- thread::Builder::new().name("Time profiler".to_owned()).spawn(move || {
- let trace = file_path.as_ref()
- .and_then(|p| TraceDump::new(p).ok());
- let mut profiler = Profiler::new(port, trace, Some(outputoption));
- profiler.start();
- }).expect("Thread spawning failed");
+ thread::Builder::new()
+ .name("Time profiler".to_owned())
+ .spawn(move || {
+ let trace = file_path.as_ref().and_then(|p| TraceDump::new(p).ok());
+ let mut profiler = Profiler::new(port, trace, Some(outputoption));
+ profiler.start();
+ }).expect("Thread spawning failed");
// decide if we need to spawn the timer thread
match option {
- &OutputOptions::FileName(_) |
- &OutputOptions::DB(_, _, _, _) => { /* no timer thread needed */ },
+ &OutputOptions::FileName(_) | &OutputOptions::DB(_, _, _, _) => {
+ /* no timer thread needed */
+ },
&OutputOptions::Stdout(period) => {
// Spawn a timer thread
let chan = chan.clone();
- thread::Builder::new().name("Time profiler timer".to_owned()).spawn(move || {
- loop {
+ thread::Builder::new()
+ .name("Time profiler timer".to_owned())
+ .spawn(move || loop {
thread::sleep(duration_from_seconds(period));
if chan.send(ProfilerMsg::Print).is_err() {
break;
}
- }
- }).expect("Thread spawning failed");
+ }).expect("Thread spawning failed");
},
}
},
@@ -211,37 +205,37 @@ impl Profiler {
// this is when the -p option hasn't been specified
if file_path.is_some() {
// Spawn the time profiler
- thread::Builder::new().name("Time profiler".to_owned()).spawn(move || {
- let trace = file_path.as_ref()
- .and_then(|p| TraceDump::new(p).ok());
- let mut profiler = Profiler::new(port, trace, None);
- profiler.start();
- }).expect("Thread spawning failed");
+ thread::Builder::new()
+ .name("Time profiler".to_owned())
+ .spawn(move || {
+ let trace = file_path.as_ref().and_then(|p| TraceDump::new(p).ok());
+ let mut profiler = Profiler::new(port, trace, None);
+ profiler.start();
+ }).expect("Thread spawning failed");
} else {
// No-op to handle messages when the time profiler is not printing:
- thread::Builder::new().name("Time profiler".to_owned()).spawn(move || {
- loop {
+ thread::Builder::new()
+ .name("Time profiler".to_owned())
+ .spawn(move || loop {
match port.recv() {
Err(_) => break,
Ok(ProfilerMsg::Exit(chan)) => {
let _ = chan.send(());
break;
},
- _ => {}
+ _ => {},
}
- }
- }).expect("Thread spawning failed");
+ }).expect("Thread spawning failed");
}
- }
+ },
}
heartbeats::init();
let profiler_chan = ProfilerChan(chan);
// only spawn the application-level profiler thread if its heartbeat is enabled
- let run_ap_thread = || {
- heartbeats::is_heartbeat_enabled(&ProfilerCategory::ApplicationHeartbeat)
- };
+ let run_ap_thread =
+ || heartbeats::is_heartbeat_enabled(&ProfilerCategory::ApplicationHeartbeat);
if run_ap_thread() {
let profiler_chan = profiler_chan.clone();
// min of 1 heartbeat/sec, max of 20 should provide accurate enough power/energy readings
@@ -249,39 +243,52 @@ impl Profiler {
const SLEEP_MS: u32 = 10;
const MIN_ENERGY_INTERVAL_MS: u32 = 50;
const MAX_ENERGY_INTERVAL_MS: u32 = 1000;
- let interval_ms = enforce_range(MIN_ENERGY_INTERVAL_MS, MAX_ENERGY_INTERVAL_MS, energy_interval_ms());
+ let interval_ms = enforce_range(
+ MIN_ENERGY_INTERVAL_MS,
+ MAX_ENERGY_INTERVAL_MS,
+ energy_interval_ms(),
+ );
let loop_count: u32 = (interval_ms as f32 / SLEEP_MS as f32).ceil() as u32;
- thread::Builder::new().name("Application heartbeat profiler".to_owned()).spawn(move || {
- let mut start_time = precise_time_ns();
- let mut start_energy = read_energy_uj();
- loop {
- for _ in 0..loop_count {
- if run_ap_thread() {
- thread::sleep(Duration::from_millis(SLEEP_MS as u64))
- } else {
- return
+ thread::Builder::new()
+ .name("Application heartbeat profiler".to_owned())
+ .spawn(move || {
+ let mut start_time = precise_time_ns();
+ let mut start_energy = read_energy_uj();
+ loop {
+ for _ in 0..loop_count {
+ if run_ap_thread() {
+ thread::sleep(Duration::from_millis(SLEEP_MS as u64))
+ } else {
+ return;
+ }
}
+ let end_time = precise_time_ns();
+ let end_energy = read_energy_uj();
+ // send using the inner channel
+ // (using ProfilerChan.send() forces an unwrap
+ // and sometimes panics for this background profiler)
+ let ProfilerChan(ref c) = profiler_chan;
+ if let Err(_) = c.send(ProfilerMsg::Time(
+ (ProfilerCategory::ApplicationHeartbeat, None),
+ (start_time, end_time),
+ (start_energy, end_energy),
+ )) {
+ return;
+ }
+ start_time = end_time;
+ start_energy = end_energy;
}
- let end_time = precise_time_ns();
- let end_energy = read_energy_uj();
- // send using the inner channel
- // (using ProfilerChan.send() forces an unwrap and sometimes panics for this background profiler)
- let ProfilerChan(ref c) = profiler_chan;
- if let Err(_) = c.send(ProfilerMsg::Time((ProfilerCategory::ApplicationHeartbeat, None),
- (start_time, end_time),
- (start_energy, end_energy))) {
- return;
- }
- start_time = end_time;
- start_energy = end_energy;
- }
- }).expect("Thread spawning failed");
+ }).expect("Thread spawning failed");
}
profiler_chan
}
- pub fn new(port: IpcReceiver<ProfilerMsg>, trace: Option<TraceDump>, output: Option<OutputOptions>) -> Profiler {
+ pub fn new(
+ port: IpcReceiver<ProfilerMsg>,
+ trace: Option<TraceDump>,
+ output: Option<OutputOptions>,
+ ) -> Profiler {
Profiler {
port: port,
buckets: BTreeMap::new(),
@@ -293,9 +300,9 @@ impl Profiler {
pub fn start(&mut self) {
while let Ok(msg) = self.port.recv() {
- if !self.handle_msg(msg) {
- break
- }
+ if !self.handle_msg(msg) {
+ break;
+ }
}
}
@@ -320,7 +327,9 @@ impl Profiler {
ProfilerMsg::Get(k, sender) => {
let vec_option = self.buckets.get(&k);
match vec_option {
- Some(vec_entry) => sender.send(ProfilerData::Record(vec_entry.to_vec())).unwrap(),
+ Some(vec_entry) => sender
+ .send(ProfilerData::Record(vec_entry.to_vec()))
+ .unwrap(),
None => sender.send(ProfilerData::NoRecords).unwrap(),
};
},
@@ -344,11 +353,12 @@ impl Profiler {
let data_len = data.len();
debug_assert!(data_len > 0);
- let (mean, median, min, max) =
- (data.iter().sum::<f64>() / (data_len as f64),
+ let (mean, median, min, max) = (
+ data.iter().sum::<f64>() / (data_len as f64),
data[data_len / 2],
data[0],
- data[data_len - 1]);
+ data[data_len - 1],
+ );
(mean, median, min, max)
}
@@ -357,21 +367,34 @@ impl Profiler {
Some(OutputOptions::FileName(ref filename)) => {
let path = Path::new(&filename);
let mut file = match File::create(&path) {
- Err(e) => panic!("Couldn't create {}: {}",
- path.display(),
- Error::description(&e)),
+ Err(e) => panic!(
+ "Couldn't create {}: {}",
+ path.display(),
+ Error::description(&e)
+ ),
Ok(file) => file,
};
- write!(file, "_category_\t_incremental?_\t_iframe?_\t_url_\t_mean (ms)_\t\
- _median (ms)_\t_min (ms)_\t_max (ms)_\t_events_\n").unwrap();
+ write!(
+ file,
+ "_category_\t_incremental?_\t_iframe?_\t_url_\t_mean (ms)_\t\
+ _median (ms)_\t_min (ms)_\t_max (ms)_\t_events_\n"
+ ).unwrap();
for (&(ref category, ref meta), ref mut data) in &mut self.buckets {
data.sort_by(|a, b| a.partial_cmp(b).expect("No NaN values in profiles"));
let data_len = data.len();
if data_len > 0 {
let (mean, median, min, max) = Self::get_statistics(data);
- write!(file, "{}\t{}\t{:15.4}\t{:15.4}\t{:15.4}\t{:15.4}\t{:15}\n",
- category.format(&self.output), meta.format(&self.output),
- mean, median, min, max, data_len).unwrap();
+ write!(
+ file,
+ "{}\t{}\t{:15.4}\t{:15.4}\t{:15.4}\t{:15.4}\t{:15}\n",
+ category.format(&self.output),
+ meta.format(&self.output),
+ mean,
+ median,
+ min,
+ max,
+ data_len
+ ).unwrap();
}
}
},
@@ -379,18 +402,35 @@ impl Profiler {
let stdout = io::stdout();
let mut lock = stdout.lock();
- writeln!(&mut lock, "{:35} {:14} {:9} {:30} {:15} {:15} {:-15} {:-15} {:-15}",
- "_category_", "_incremental?_", "_iframe?_",
- " _url_", " _mean (ms)_", " _median (ms)_",
- " _min (ms)_", " _max (ms)_", " _events_").unwrap();
+ writeln!(
+ &mut lock,
+ "{:35} {:14} {:9} {:30} {:15} {:15} {:-15} {:-15} {:-15}",
+ "_category_",
+ "_incremental?_",
+ "_iframe?_",
+ " _url_",
+ " _mean (ms)_",
+ " _median (ms)_",
+ " _min (ms)_",
+ " _max (ms)_",
+ " _events_"
+ ).unwrap();
for (&(ref category, ref meta), ref mut data) in &mut self.buckets {
data.sort_by(|a, b| a.partial_cmp(b).expect("No NaN values in profiles"));
let data_len = data.len();
if data_len > 0 {
let (mean, median, min, max) = Self::get_statistics(data);
- writeln!(&mut lock, "{:-35}{} {:15.4} {:15.4} {:15.4} {:15.4} {:15}",
- category.format(&self.output), meta.format(&self.output), mean, median, min, max,
- data_len).unwrap();
+ writeln!(
+ &mut lock,
+ "{:-35}{} {:15.4} {:15.4} {:15.4} {:15.4} {:15}",
+ category.format(&self.output),
+ meta.format(&self.output),
+ mean,
+ median,
+ min,
+ max,
+ data_len
+ ).unwrap();
}
}
writeln!(&mut lock, "").unwrap();
@@ -434,22 +474,22 @@ impl Profiler {
}
}
}
-
},
None => { /* Do nothing if no output option has been set */ },
};
}
}
-fn enforce_range<T>(min: T, max: T, value: T) -> T where T: Ord {
+fn enforce_range<T>(min: T, max: T, value: T) -> T
+where
+ T: Ord,
+{
assert!(min <= max);
match value.cmp(&max) {
Ordering::Equal | Ordering::Greater => max,
- Ordering::Less => {
- match value.cmp(&min) {
- Ordering::Equal | Ordering::Less => min,
- Ordering::Greater => value,
- }
+ Ordering::Less => match value.cmp(&min) {
+ Ordering::Equal | Ordering::Less => min,
+ Ordering::Greater => value,
},
}
}
diff --git a/components/profile/trace_dump.rs b/components/profile/trace_dump.rs
index b0c8f9d7ef5..4654f4dfb57 100644
--- a/components/profile/trace_dump.rs
+++ b/components/profile/trace_dump.rs
@@ -38,7 +38,8 @@ impl TraceDump {
/// Create a new TraceDump and write the prologue of the HTML file out to
/// disk.
pub fn new<P>(trace_file_path: P) -> io::Result<TraceDump>
- where P: AsRef<path::Path>
+ where
+ P: AsRef<path::Path>,
{
let mut file = fs::File::create(trace_file_path)?;
write_prologue(&mut file)?;
@@ -46,10 +47,12 @@ impl TraceDump {
}
/// Write one trace to the trace dump file.
- pub fn write_one(&mut self,
- category: &(ProfilerCategory, Option<TimerMetadata>),
- time: (u64, u64),
- energy: (u64, u64)) {
+ pub fn write_one(
+ &mut self,
+ category: &(ProfilerCategory, Option<TimerMetadata>),
+ time: (u64, u64),
+ energy: (u64, u64),
+ ) {
let entry = TraceEntry {
category: category.0,
metadata: category.1.clone(),
diff --git a/components/profile_traits/energy.rs b/components/profile_traits/energy.rs
index 1e34645b180..bbd427ca834 100644
--- a/components/profile_traits/energy.rs
+++ b/components/profile_traits/energy.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
#[cfg(feature = "energy-profiling")]
pub fn read_energy_uj() -> u64 {
energymon::read_energy_uj()
@@ -33,7 +32,6 @@ mod energymon {
use std::mem;
use std::sync::{Once, ONCE_INIT};
-
static mut EM: Option<*mut EnergyMon> = None;
fn init() {
@@ -60,9 +58,7 @@ mod energymon {
pub fn get_min_interval_ms() -> u32 {
init();
- unsafe {
- EM.map_or(0, |em| ((*em).interval_us() as f64 / 1000.0).ceil() as u32)
- }
+ unsafe { EM.map_or(0, |em| ((*em).interval_us() as f64 / 1000.0).ceil() as u32) }
}
}
diff --git a/components/profile_traits/ipc.rs b/components/profile_traits/ipc.rs
index fe64d54ef07..cd4553ea8bc 100644
--- a/components/profile_traits/ipc.rs
+++ b/components/profile_traits/ipc.rs
@@ -10,12 +10,18 @@ use time;
use time::ProfilerCategory;
use time::ProfilerChan;
-pub struct IpcReceiver<T> where T: for<'de> Deserialize<'de> + Serialize {
+pub struct IpcReceiver<T>
+where
+ T: for<'de> Deserialize<'de> + Serialize,
+{
ipc_receiver: ipc::IpcReceiver<T>,
time_profile_chan: ProfilerChan,
}
-impl<T> IpcReceiver<T> where T: for<'de> Deserialize<'de> + Serialize {
+impl<T> IpcReceiver<T>
+where
+ T: for<'de> Deserialize<'de> + Serialize,
+{
pub fn recv(&self) -> Result<T, bincode::Error> {
time::profile(
ProfilerCategory::IpcReceiver,
@@ -34,8 +40,12 @@ impl<T> IpcReceiver<T> where T: for<'de> Deserialize<'de> + Serialize {
}
}
-pub fn channel<T>(time_profile_chan: ProfilerChan) -> Result<(ipc::IpcSender<T>, IpcReceiver<T>), Error>
- where T: for<'de> Deserialize<'de> + Serialize, {
+pub fn channel<T>(
+ time_profile_chan: ProfilerChan,
+) -> Result<(ipc::IpcSender<T>, IpcReceiver<T>), Error>
+where
+ T: for<'de> Deserialize<'de> + Serialize,
+{
let (ipc_sender, ipc_receiver) = ipc::channel()?;
let profiled_ipc_receiver = IpcReceiver {
ipc_receiver,
diff --git a/components/profile_traits/lib.rs b/components/profile_traits/lib.rs
index 029e59a3241..e70d0b7ac40 100644
--- a/components/profile_traits/lib.rs
+++ b/components/profile_traits/lib.rs
@@ -12,7 +12,8 @@ extern crate bincode;
extern crate ipc_channel;
#[macro_use]
extern crate log;
-#[macro_use] extern crate serde;
+#[macro_use]
+extern crate serde;
extern crate servo_config;
extern crate signpost;
diff --git a/components/profile_traits/mem.rs b/components/profile_traits/mem.rs
index b0df9ac7db7..8e4d756884b 100644
--- a/components/profile_traits/mem.rs
+++ b/components/profile_traits/mem.rs
@@ -21,15 +21,24 @@ pub trait OpaqueSender<T> {
impl<T> OpaqueSender<T> for Sender<T> {
fn send(&self, message: T) {
if let Err(e) = Sender::send(self, message) {
- warn!("Error communicating with the target thread from the profiler: {}", e);
+ warn!(
+ "Error communicating with the target thread from the profiler: {}",
+ e
+ );
}
}
}
-impl<T> OpaqueSender<T> for IpcSender<T> where T: serde::Serialize {
+impl<T> OpaqueSender<T> for IpcSender<T>
+where
+ T: serde::Serialize,
+{
fn send(&self, message: T) {
if let Err(e) = IpcSender::send(self, message) {
- warn!("Error communicating with the target thread from the profiler: {}", e);
+ warn!(
+ "Error communicating with the target thread from the profiler: {}",
+ e
+ );
}
}
}
@@ -50,24 +59,32 @@ impl ProfilerChan {
}
/// Runs `f()` with memory profiling.
- pub fn run_with_memory_reporting<F, M, T, C>(&self, f: F,
- reporter_name: String,
- channel_for_reporter: C,
- msg: M)
- where F: FnOnce(),
- M: Fn(ReportsChan) -> T + Send + 'static,
- T: Send + 'static,
- C: OpaqueSender<T> + Send + 'static
+ pub fn run_with_memory_reporting<F, M, T, C>(
+ &self,
+ f: F,
+ reporter_name: String,
+ channel_for_reporter: C,
+ msg: M,
+ ) where
+ F: FnOnce(),
+ M: Fn(ReportsChan) -> T + Send + 'static,
+ T: Send + 'static,
+ C: OpaqueSender<T> + Send + 'static,
{
// Register the memory reporter.
let (reporter_sender, reporter_receiver) = ipc::channel().unwrap();
- ROUTER.add_route(reporter_receiver.to_opaque(), Box::new(move |message| {
- // Just injects an appropriate event into the paint thread's queue.
- let request: ReporterRequest = message.to().unwrap();
- channel_for_reporter.send(msg(request.reports_channel));
- }));
- self.send(ProfilerMsg::RegisterReporter(reporter_name.clone(),
- Reporter(reporter_sender)));
+ ROUTER.add_route(
+ reporter_receiver.to_opaque(),
+ Box::new(move |message| {
+ // Just injects an appropriate event into the paint thread's queue.
+ let request: ReporterRequest = message.to().unwrap();
+ channel_for_reporter.send(msg(request.reports_channel));
+ }),
+ );
+ self.send(ProfilerMsg::RegisterReporter(
+ reporter_name.clone(),
+ Reporter(reporter_sender),
+ ));
f();
@@ -154,9 +171,10 @@ pub struct Reporter(pub IpcSender<ReporterRequest>);
impl Reporter {
/// Collect one or more memory reports. Returns true on success, and false on failure.
pub fn collect_reports(&self, reports_chan: ReportsChan) {
- self.0.send(ReporterRequest {
- reports_channel: reports_chan,
- }).unwrap()
+ self.0
+ .send(ReporterRequest {
+ reports_channel: reports_chan,
+ }).unwrap()
}
}
@@ -188,4 +206,3 @@ pub enum ProfilerMsg {
/// Tells the memory profiler to shut down.
Exit,
}
-
diff --git a/components/profile_traits/time.rs b/components/profile_traits/time.rs
index 2c297003b9e..f905348a882 100644
--- a/components/profile_traits/time.rs
+++ b/components/profile_traits/time.rs
@@ -37,9 +37,16 @@ pub enum ProfilerData {
#[derive(Clone, Deserialize, Serialize)]
pub enum ProfilerMsg {
/// Normal message used for reporting time
- Time((ProfilerCategory, Option<TimerMetadata>), (u64, u64), (u64, u64)),
+ Time(
+ (ProfilerCategory, Option<TimerMetadata>),
+ (u64, u64),
+ (u64, u64),
+ ),
/// Message used to get time spend entries for a particular ProfilerBuckets (in nanoseconds)
- Get((ProfilerCategory, Option<TimerMetadata>), IpcSender<ProfilerData>),
+ Get(
+ (ProfilerCategory, Option<TimerMetadata>),
+ IpcSender<ProfilerData>,
+ ),
/// Message used to force print the profiling metrics
Print,
/// Tells the profiler to shut down.
@@ -118,12 +125,14 @@ pub enum TimerMetadataReflowType {
FirstReflow,
}
-pub fn profile<T, F>(category: ProfilerCategory,
- meta: Option<TimerMetadata>,
- profiler_chan: ProfilerChan,
- callback: F)
- -> T
- where F: FnOnce() -> T,
+pub fn profile<T, F>(
+ category: ProfilerCategory,
+ meta: Option<TimerMetadata>,
+ profiler_chan: ProfilerChan,
+ callback: F,
+) -> T
+where
+ F: FnOnce() -> T,
{
if opts::get().signpost {
signpost::start(category as u32, &[0, 0, 0, (category as usize) >> 4]);
@@ -139,24 +148,30 @@ pub fn profile<T, F>(category: ProfilerCategory,
signpost::end(category as u32, &[0, 0, 0, (category as usize) >> 4]);
}
- send_profile_data(category,
- meta,
- &profiler_chan,
- start_time,
- end_time,
- start_energy,
- end_energy);
+ send_profile_data(
+ category,
+ meta,
+ &profiler_chan,
+ start_time,
+ end_time,
+ start_energy,
+ end_energy,
+ );
val
}
-pub fn send_profile_data(category: ProfilerCategory,
- meta: Option<TimerMetadata>,
- profiler_chan: &ProfilerChan,
- start_time: u64,
- end_time: u64,
- start_energy: u64,
- end_energy: u64) {
- profiler_chan.send(ProfilerMsg::Time((category, meta),
- (start_time, end_time),
- (start_energy, end_energy)));
+pub fn send_profile_data(
+ category: ProfilerCategory,
+ meta: Option<TimerMetadata>,
+ profiler_chan: &ProfilerChan,
+ start_time: u64,
+ end_time: u64,
+ start_energy: u64,
+ end_energy: u64,
+) {
+ profiler_chan.send(ProfilerMsg::Time(
+ (category, meta),
+ (start_time, end_time),
+ (start_energy, end_energy),
+ ));
}
diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs
index 8cf3bb6648f..761bcde404b 100644
--- a/components/script/dom/audiobuffer.rs
+++ b/components/script/dom/audiobuffer.rs
@@ -64,7 +64,7 @@ impl AudioBuffer {
number_of_channels: u32,
length: u32,
sample_rate: f32,
- initial_data: Option<&[f32]>,
+ initial_data: Option<&[Vec<f32>]>,
) -> DomRoot<AudioBuffer> {
let buffer = AudioBuffer::new_inherited(number_of_channels, length, sample_rate);
let buffer = reflect_dom_object(Box::new(buffer), global, AudioBufferBinding::Wrap);
@@ -93,20 +93,19 @@ impl AudioBuffer {
}
#[allow(unsafe_code)]
- pub fn set_channels(&self, initial_data: Option<&[f32]>) {
+ pub fn set_channels(&self, initial_data: Option<&[Vec<f32>]>) {
let global = self.global();
let cx = global.get_cx();
let _ac = JSAutoCompartment::new(cx, global.reflector().get_jsobject().get());
let chans = self.js_channels.borrow_mut();
for channel in 0..self.number_of_channels {
rooted!(in (cx) let mut array = ptr::null_mut::<JSObject>());
- let offset = (channel * self.length) as usize;
match initial_data {
Some(data) => {
let _ = unsafe {
Float32Array::create(
cx,
- CreateWith::Slice(&data[offset..offset + (self.length as usize) - 1]),
+ CreateWith::Slice(data[channel as usize].as_slice()),
array.handle_mut(),
)
};
diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs
index 8cd9afa00ce..dbd821b64fe 100644
--- a/components/script/dom/baseaudiocontext.rs
+++ b/components/script/dom/baseaudiocontext.rs
@@ -405,6 +405,7 @@ impl BaseAudioContextMethods for BaseAudioContext {
let audio_data = audio_data.to_vec();
let decoded_audio = Arc::new(Mutex::new(Vec::new()));
let decoded_audio_ = decoded_audio.clone();
+ let decoded_audio__ = decoded_audio.clone();
let this = Trusted::new(self);
let this_ = this.clone();
let task_source = window.dom_manipulation_task_source();
@@ -412,15 +413,30 @@ impl BaseAudioContextMethods for BaseAudioContext {
let canceller = window.task_canceller(TaskSourceName::DOMManipulation);
let canceller_ = window.task_canceller(TaskSourceName::DOMManipulation);
let callbacks = AudioDecoderCallbacks::new()
+ .ready(move |channel_count| {
+ decoded_audio
+ .lock()
+ .unwrap()
+ .resize(channel_count as usize, Vec::new());
+ })
+ .progress(move |buffer, channel| {
+ let mut decoded_audio = decoded_audio_.lock().unwrap();
+ decoded_audio[(channel - 1) as usize].extend_from_slice((*buffer).as_ref());
+ })
.eos(move || {
let _ = task_source.queue_with_canceller(
task!(audio_decode_eos: move || {
let this = this.root();
- let decoded_audio = decoded_audio.lock().unwrap();
+ let decoded_audio = decoded_audio__.lock().unwrap();
+ let length = if decoded_audio.len() >= 1 {
+ decoded_audio[0].len()
+ } else {
+ 0
+ };
let buffer = AudioBuffer::new(
&this.global().as_window(),
- 1, // XXX servo-media should provide this info
- decoded_audio.len() as u32,
+ decoded_audio.len() as u32 /* number of channels */,
+ length as u32,
this.sample_rate,
Some(decoded_audio.as_slice()));
let mut resolvers = this.decode_resolvers.borrow_mut();
@@ -451,12 +467,6 @@ impl BaseAudioContextMethods for BaseAudioContext {
&canceller_,
);
})
- .progress(move |buffer| {
- decoded_audio_
- .lock()
- .unwrap()
- .extend_from_slice((*buffer).as_ref());
- })
.build();
self.audio_context_impl
.decode_audio_data(audio_data, callbacks);
diff --git a/components/script/dom/offlineaudiocontext.rs b/components/script/dom/offlineaudiocontext.rs
index 4490d5df6f9..21376c11a4d 100644
--- a/components/script/dom/offlineaudiocontext.rs
+++ b/components/script/dom/offlineaudiocontext.rs
@@ -144,6 +144,10 @@ impl OfflineAudioContextMethods for OfflineAudioContext {
task!(resolve: move || {
let this = this.root();
let processed_audio = processed_audio.lock().unwrap();
+ let processed_audio: Vec<_> = processed_audio
+ .chunks(this.length as usize)
+ .map(|channel| channel.to_vec())
+ .collect();
let buffer = AudioBuffer::new(
&this.global().as_window(),
this.channel_count,
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index d227af7ea1a..ab7178ffa16 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -4017,14 +4017,15 @@ fn rgba8_image_to_tex_image_data(
match (format, data_type) {
(TexFormat::RGBA, TexDataType::UnsignedByte) => pixels,
(TexFormat::RGB, TexDataType::UnsignedByte) => {
- // Remove alpha channel
- let mut rgb8 = Vec::<u8>::with_capacity(pixel_count * 3);
- for rgba8 in pixels.chunks(4) {
- rgb8.push(rgba8[0]);
- rgb8.push(rgba8[1]);
- rgb8.push(rgba8[2]);
+ for i in 0..pixel_count {
+ let rgb = {
+ let rgb = &pixels[i * 4..i * 4 + 3];
+ [rgb[0], rgb[1], rgb[2]]
+ };
+ pixels[i * 3..i * 3 + 3].copy_from_slice(&rgb);
}
- rgb8
+ pixels.truncate(pixel_count * 3);
+ pixels
},
(TexFormat::Alpha, TexDataType::UnsignedByte) => {
for i in 0..pixel_count {
@@ -4126,8 +4127,8 @@ fn rgba8_image_to_tex_image_data(
(TexFormat::Luminance, TexDataType::Float) => {
for rgba8 in pixels.chunks_mut(4) {
- let p = luminance(rgba8[0], rgba8[1], rgba8[2]);
- NativeEndian::write_f32(rgba8, p as f32);
+ let p = rgba8[0] as f32;
+ NativeEndian::write_f32(rgba8, p);
}
pixels
},
@@ -4135,8 +4136,7 @@ fn rgba8_image_to_tex_image_data(
(TexFormat::LuminanceAlpha, TexDataType::Float) => {
let mut data = Vec::<u8>::with_capacity(pixel_count * 8);
for rgba8 in pixels.chunks(4) {
- let p = luminance(rgba8[0], rgba8[1], rgba8[2]);
- data.write_f32::<NativeEndian>(p as f32).unwrap();
+ data.write_f32::<NativeEndian>(rgba8[0] as f32).unwrap();
data.write_f32::<NativeEndian>(rgba8[3] as f32).unwrap();
}
data
@@ -4172,23 +4172,20 @@ fn rgba8_image_to_tex_image_data(
},
(TexFormat::Luminance, TexDataType::HalfFloat) => {
for i in 0..pixel_count {
- let p = {
- let rgb = &pixels[i * 4..i * 4 + 3];
- f16::from_f32(luminance(rgb[0], rgb[1], rgb[2]) as f32).as_bits()
- };
+ let p = f16::from_f32(pixels[i * 4] as f32).as_bits();
NativeEndian::write_u16(&mut pixels[i * 2..i * 2 + 2], p);
}
pixels.truncate(pixel_count * 2);
pixels
},
(TexFormat::LuminanceAlpha, TexDataType::HalfFloat) => {
- let mut data = Vec::<u8>::with_capacity(pixel_count * 8);
- for rgba8 in pixels.chunks(4) {
- let p = luminance(rgba8[0], rgba8[1], rgba8[2]);
- data.write_u16::<NativeEndian>(f16::from_f32(p as f32).as_bits()).unwrap();
- data.write_u16::<NativeEndian>(f16::from_f32(rgba8[3] as f32).as_bits()).unwrap();
+ for rgba8 in pixels.chunks_mut(4) {
+ let lum = f16::from_f32(rgba8[0] as f32).as_bits();
+ let a = f16::from_f32(rgba8[3] as f32).as_bits();
+ NativeEndian::write_u16(&mut rgba8[0..2], lum);
+ NativeEndian::write_u16(&mut rgba8[2..4], a);
}
- data
+ pixels
},
// Validation should have ensured that we only hit the
@@ -4197,11 +4194,3 @@ fn rgba8_image_to_tex_image_data(
_ => unreachable!("Unsupported formats {:?} {:?}", format, data_type)
}
}
-
-// https://en.wikipedia.org/wiki/Relative_luminance
-#[inline]
-fn luminance(r: u8, g: u8, b: u8) -> u8 {
- (0.2126 * (r as f32) +
- 0.7152 * (g as f32) +
- 0.0722 * (b as f32)) as u8
-}
diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index 278e590bae5..f6edcc45bde 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -66,7 +66,7 @@ fn webdriver(port: u16, constellation: Sender<ConstellationMsg>) {
}
#[cfg(not(feature = "webdriver"))]
-fn webdriver(_port: u16, _constellation: Sender<ConstellationMsg>) { }
+fn webdriver(_port: u16, _constellation: Sender<ConstellationMsg>) {}
use bluetooth::BluetoothThreadFactory;
use bluetooth_traits::BluetoothRequest;
@@ -128,7 +128,10 @@ pub struct Servo<Window: WindowMethods + 'static> {
embedder_events: Vec<(Option<BrowserId>, EmbedderMsg)>,
}
-impl<Window> Servo<Window> where Window: WindowMethods + 'static {
+impl<Window> Servo<Window>
+where
+ Window: WindowMethods + 'static,
+{
pub fn new(window: Rc<Window>) -> Servo<Window> {
// Global configuration options, parsed from the command line.
let opts = opts::get();
@@ -148,15 +151,13 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static {
let (embedder_proxy, embedder_receiver) =
create_embedder_channel(window.create_event_loop_waker());
let supports_clipboard = window.supports_clipboard();
- let time_profiler_chan = profile_time::Profiler::create(&opts.time_profiling,
- opts.time_profiler_trace_path.clone());
+ let time_profiler_chan = profile_time::Profiler::create(
+ &opts.time_profiling,
+ opts.time_profiler_trace_path.clone(),
+ );
let mem_profiler_chan = profile_mem::Profiler::create(opts.mem_profiler_period);
- let debugger_chan = opts.debugger_port.map(|port| {
- debugger::start_server(port)
- });
- let devtools_chan = opts.devtools_port.map(|port| {
- devtools::start_server(port)
- });
+ let debugger_chan = opts.debugger_port.map(|port| debugger::start_server(port));
+ let devtools_chan = opts.devtools_port.map(|port| devtools::start_server(port));
let coordinates = window.get_coordinates();
@@ -180,23 +181,28 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static {
let render_notifier = Box::new(RenderNotifier::new(compositor_proxy.clone()));
- webrender::Renderer::new(window.gl(), render_notifier, webrender::RendererOptions {
- device_pixel_ratio: coordinates.hidpi_factor.get(),
- resource_override_path: opts.shaders_dir.clone(),
- enable_aa: opts.enable_text_antialiasing,
- debug_flags: debug_flags,
- recorder: recorder,
- precache_shaders: opts.precache_shaders,
- enable_scrollbars: opts.output_file.is_none(),
- renderer_kind: renderer_kind,
- enable_subpixel_aa: opts.enable_subpixel_text_antialiasing,
- ..Default::default()
- }).expect("Unable to initialize webrender!")
+ webrender::Renderer::new(
+ window.gl(),
+ render_notifier,
+ webrender::RendererOptions {
+ device_pixel_ratio: coordinates.hidpi_factor.get(),
+ resource_override_path: opts.shaders_dir.clone(),
+ enable_aa: opts.enable_text_antialiasing,
+ debug_flags: debug_flags,
+ recorder: recorder,
+ precache_shaders: opts.precache_shaders,
+ enable_scrollbars: opts.output_file.is_none(),
+ renderer_kind: renderer_kind,
+ enable_subpixel_aa: opts.enable_subpixel_text_antialiasing,
+ ..Default::default()
+ },
+ ).expect("Unable to initialize webrender!")
};
let webrender_api = webrender_api_sender.create_api();
let wr_document_layer = 0; //TODO
- let webrender_document = webrender_api.add_document(coordinates.framebuffer, wr_document_layer);
+ let webrender_document =
+ webrender_api.add_document(coordinates.framebuffer, wr_document_layer);
// Important that this call is done in a single-threaded fashion, we
// can't defer it after `create_constellation` has started.
@@ -205,19 +211,21 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static {
// Create the constellation, which maintains the engine
// pipelines, including the script and layout threads, as well
// as the navigation context.
- let (constellation_chan, sw_senders) = create_constellation(opts.user_agent.clone(),
- opts.config_dir.clone(),
- embedder_proxy.clone(),
- compositor_proxy.clone(),
- time_profiler_chan.clone(),
- mem_profiler_chan.clone(),
- debugger_chan,
- devtools_chan,
- supports_clipboard,
- &mut webrender,
- webrender_document,
- webrender_api_sender,
- window.gl());
+ let (constellation_chan, sw_senders) = create_constellation(
+ opts.user_agent.clone(),
+ opts.config_dir.clone(),
+ embedder_proxy.clone(),
+ compositor_proxy.clone(),
+ time_profiler_chan.clone(),
+ mem_profiler_chan.clone(),
+ debugger_chan,
+ devtools_chan,
+ supports_clipboard,
+ &mut webrender,
+ webrender_document,
+ webrender_api_sender,
+ window.gl(),
+ );
// Send the constellation's swmanager sender to service worker manager thread
script::init_service_workers(sw_senders);
@@ -230,16 +238,19 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static {
// The compositor coordinates with the client window to create the final
// rendered page and display it somewhere.
- let compositor = IOCompositor::create(window, InitialCompositorState {
- sender: compositor_proxy,
- receiver: compositor_receiver,
- constellation_chan: constellation_chan.clone(),
- time_profiler_chan: time_profiler_chan,
- mem_profiler_chan: mem_profiler_chan,
- webrender,
- webrender_document,
- webrender_api,
- });
+ let compositor = IOCompositor::create(
+ window,
+ InitialCompositorState {
+ sender: compositor_proxy,
+ receiver: compositor_receiver,
+ constellation_chan: constellation_chan.clone(),
+ time_profiler_chan: time_profiler_chan,
+ mem_profiler_chan: mem_profiler_chan,
+ webrender,
+ webrender_document,
+ webrender_api,
+ },
+ );
Servo {
compositor: compositor,
@@ -251,127 +262,147 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static {
fn handle_window_event(&mut self, event: WindowEvent) {
match event {
- WindowEvent::Idle => {
- }
+ WindowEvent::Idle => {},
WindowEvent::Refresh => {
self.compositor.composite();
- }
+ },
WindowEvent::Resize => {
self.compositor.on_resize_window_event();
- }
+ },
WindowEvent::LoadUrl(top_level_browsing_context_id, url) => {
let msg = ConstellationMsg::LoadUrl(top_level_browsing_context_id, url);
if let Err(e) = self.constellation_chan.send(msg) {
warn!("Sending load url to constellation failed ({}).", e);
}
- }
+ },
WindowEvent::MouseWindowEventClass(mouse_window_event) => {
- self.compositor.on_mouse_window_event_class(mouse_window_event);
- }
+ self.compositor
+ .on_mouse_window_event_class(mouse_window_event);
+ },
WindowEvent::MouseWindowMoveEventClass(cursor) => {
self.compositor.on_mouse_window_move_event_class(cursor);
- }
+ },
WindowEvent::Touch(event_type, identifier, location) => {
- self.compositor.on_touch_event(event_type, identifier, location);
- }
+ self.compositor
+ .on_touch_event(event_type, identifier, location);
+ },
WindowEvent::Scroll(delta, cursor, phase) => {
self.compositor.on_scroll_event(delta, cursor, phase);
- }
+ },
WindowEvent::Zoom(magnification) => {
self.compositor.on_zoom_window_event(magnification);
- }
+ },
WindowEvent::ResetZoom => {
self.compositor.on_zoom_reset_window_event();
- }
+ },
WindowEvent::PinchZoom(magnification) => {
self.compositor.on_pinch_zoom_window_event(magnification);
- }
+ },
WindowEvent::Navigation(top_level_browsing_context_id, direction) => {
- let msg = ConstellationMsg::TraverseHistory(top_level_browsing_context_id, direction);
+ let msg =
+ ConstellationMsg::TraverseHistory(top_level_browsing_context_id, direction);
if let Err(e) = self.constellation_chan.send(msg) {
warn!("Sending navigation to constellation failed ({}).", e);
}
- }
+ },
WindowEvent::KeyEvent(ch, key, state, modifiers) => {
let msg = ConstellationMsg::KeyEvent(ch, key, state, modifiers);
if let Err(e) = self.constellation_chan.send(msg) {
warn!("Sending key event to constellation failed ({}).", e);
}
- }
+ },
WindowEvent::Quit => {
self.compositor.maybe_start_shutting_down();
- }
+ },
WindowEvent::Reload(top_level_browsing_context_id) => {
let msg = ConstellationMsg::Reload(top_level_browsing_context_id);
if let Err(e) = self.constellation_chan.send(msg) {
warn!("Sending reload to constellation failed ({}).", e);
}
- }
+ },
WindowEvent::ToggleWebRenderDebug(option) => {
self.compositor.toggle_webrender_debug(option);
- }
+ },
WindowEvent::CaptureWebRender => {
self.compositor.capture_webrender();
- }
+ },
WindowEvent::NewBrowser(url, browser_id) => {
let msg = ConstellationMsg::NewBrowser(url, browser_id);
if let Err(e) = self.constellation_chan.send(msg) {
- warn!("Sending NewBrowser message to constellation failed ({}).", e);
+ warn!(
+ "Sending NewBrowser message to constellation failed ({}).",
+ e
+ );
}
- }
+ },
WindowEvent::SelectBrowser(ctx) => {
let msg = ConstellationMsg::SelectBrowser(ctx);
if let Err(e) = self.constellation_chan.send(msg) {
- warn!("Sending SelectBrowser message to constellation failed ({}).", e);
+ warn!(
+ "Sending SelectBrowser message to constellation failed ({}).",
+ e
+ );
}
- }
+ },
WindowEvent::CloseBrowser(ctx) => {
let msg = ConstellationMsg::CloseBrowser(ctx);
if let Err(e) = self.constellation_chan.send(msg) {
- warn!("Sending CloseBrowser message to constellation failed ({}).", e);
+ warn!(
+ "Sending CloseBrowser message to constellation failed ({}).",
+ e
+ );
}
- }
+ },
WindowEvent::SendError(ctx, e) => {
let msg = ConstellationMsg::SendError(ctx, e);
if let Err(e) = self.constellation_chan.send(msg) {
warn!("Sending SendError message to constellation failed ({}).", e);
}
- }
+ },
}
}
fn receive_messages(&mut self) {
- while let Some((top_level_browsing_context, msg)) = self.embedder_receiver.try_recv_embedder_msg() {
+ while let Some((top_level_browsing_context, msg)) =
+ self.embedder_receiver.try_recv_embedder_msg()
+ {
match (msg, self.compositor.shutdown_state) {
(_, ShutdownState::FinishedShuttingDown) => {
- error!("embedder shouldn't be handling messages after compositor has shut down");
+ error!(
+ "embedder shouldn't be handling messages after compositor has shut down"
+ );
},
(_, ShutdownState::ShuttingDown) => {},
- (EmbedderMsg::KeyEvent(ch, key, state, modified),
- ShutdownState::NotShuttingDown) => {
- let event = (top_level_browsing_context, EmbedderMsg::KeyEvent(ch, key, state, modified));
+ (
+ EmbedderMsg::KeyEvent(ch, key, state, modified),
+ ShutdownState::NotShuttingDown,
+ ) => {
+ let event = (
+ top_level_browsing_context,
+ EmbedderMsg::KeyEvent(ch, key, state, modified),
+ );
self.embedder_events.push(event);
},
@@ -426,55 +457,62 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static {
}
}
-fn create_embedder_channel(event_loop_waker: Box<EventLoopWaker>)
- -> (EmbedderProxy, EmbedderReceiver) {
+fn create_embedder_channel(
+ event_loop_waker: Box<EventLoopWaker>,
+) -> (EmbedderProxy, EmbedderReceiver) {
let (sender, receiver) = channel();
- (EmbedderProxy {
- sender: sender,
- event_loop_waker: event_loop_waker,
- },
- EmbedderReceiver {
- receiver: receiver
- })
+ (
+ EmbedderProxy {
+ sender: sender,
+ event_loop_waker: event_loop_waker,
+ },
+ EmbedderReceiver { receiver: receiver },
+ )
}
-fn create_compositor_channel(event_loop_waker: Box<EventLoopWaker>)
- -> (CompositorProxy, CompositorReceiver) {
+fn create_compositor_channel(
+ event_loop_waker: Box<EventLoopWaker>,
+) -> (CompositorProxy, CompositorReceiver) {
let (sender, receiver) = channel();
- (CompositorProxy {
- sender: sender,
- event_loop_waker: event_loop_waker,
- },
- CompositorReceiver {
- receiver: receiver
- })
+ (
+ CompositorProxy {
+ sender: sender,
+ event_loop_waker: event_loop_waker,
+ },
+ CompositorReceiver { receiver: receiver },
+ )
}
-fn create_constellation(user_agent: Cow<'static, str>,
- config_dir: Option<PathBuf>,
- embedder_proxy: EmbedderProxy,
- compositor_proxy: CompositorProxy,
- time_profiler_chan: time::ProfilerChan,
- mem_profiler_chan: mem::ProfilerChan,
- debugger_chan: Option<debugger::Sender>,
- devtools_chan: Option<Sender<devtools_traits::DevtoolsControlMsg>>,
- supports_clipboard: bool,
- webrender: &mut webrender::Renderer,
- webrender_document: webrender_api::DocumentId,
- webrender_api_sender: webrender_api::RenderApiSender,
- window_gl: Rc<gl::Gl>)
- -> (Sender<ConstellationMsg>, SWManagerSenders) {
- let bluetooth_thread: IpcSender<BluetoothRequest> = BluetoothThreadFactory::new(embedder_proxy.clone());
-
- let (public_resource_threads, private_resource_threads) =
- new_resource_threads(user_agent,
- devtools_chan.clone(),
- time_profiler_chan.clone(),
- mem_profiler_chan.clone(),
- embedder_proxy.clone(),
- config_dir);
- let font_cache_thread = FontCacheThread::new(public_resource_threads.sender(),
- webrender_api_sender.create_api());
+fn create_constellation(
+ user_agent: Cow<'static, str>,
+ config_dir: Option<PathBuf>,
+ embedder_proxy: EmbedderProxy,
+ compositor_proxy: CompositorProxy,
+ time_profiler_chan: time::ProfilerChan,
+ mem_profiler_chan: mem::ProfilerChan,
+ debugger_chan: Option<debugger::Sender>,
+ devtools_chan: Option<Sender<devtools_traits::DevtoolsControlMsg>>,
+ supports_clipboard: bool,
+ webrender: &mut webrender::Renderer,
+ webrender_document: webrender_api::DocumentId,
+ webrender_api_sender: webrender_api::RenderApiSender,
+ window_gl: Rc<gl::Gl>,
+) -> (Sender<ConstellationMsg>, SWManagerSenders) {
+ let bluetooth_thread: IpcSender<BluetoothRequest> =
+ BluetoothThreadFactory::new(embedder_proxy.clone());
+
+ let (public_resource_threads, private_resource_threads) = new_resource_threads(
+ user_agent,
+ devtools_chan.clone(),
+ time_profiler_chan.clone(),
+ mem_profiler_chan.clone(),
+ embedder_proxy.clone(),
+ config_dir,
+ );
+ let font_cache_thread = FontCacheThread::new(
+ public_resource_threads.sender(),
+ webrender_api_sender.create_api(),
+ );
let resource_sender = public_resource_threads.sender();
@@ -483,7 +521,11 @@ fn create_constellation(user_agent: Cow<'static, str>,
let (mut handler, sender) = WebVRCompositorHandler::new();
let (webvr_thread, constellation_sender) = WebVRThread::spawn(sender);
handler.set_webvr_thread_sender(webvr_thread.clone());
- (Some(webvr_thread), Some(constellation_sender), Some(handler))
+ (
+ Some(webvr_thread),
+ Some(constellation_sender),
+ Some(handler),
+ )
} else {
(None, None, None)
};
@@ -497,13 +539,12 @@ fn create_constellation(user_agent: Cow<'static, str>,
// Initialize WebGL Thread entry point.
let webgl_threads = gl_factory.map(|factory| {
- let (webgl_threads, image_handler, output_handler) =
- WebGLThreads::new(
- factory,
- window_gl,
- webrender_api_sender.clone(),
- webvr_compositor.map(|c| c as Box<_>),
- );
+ let (webgl_threads, image_handler, output_handler) = WebGLThreads::new(
+ factory,
+ window_gl,
+ webrender_api_sender.clone(),
+ webvr_compositor.map(|c| c as Box<_>),
+ );
// Set webrender external image handler for WebGL textures
webrender.set_external_image_handler(image_handler);
@@ -533,20 +574,23 @@ fn create_constellation(user_agent: Cow<'static, str>,
webgl_threads,
webvr_chan,
};
- let (constellation_chan, from_swmanager_sender) =
- Constellation::<script_layout_interface::message::Msg,
- layout_thread::LayoutThread,
- script::script_thread::ScriptThread>::start(initial_state);
+ let (constellation_chan, from_swmanager_sender) = Constellation::<
+ script_layout_interface::message::Msg,
+ layout_thread::LayoutThread,
+ script::script_thread::ScriptThread,
+ >::start(initial_state);
if let Some(webvr_constellation_sender) = webvr_constellation_sender {
// Set constellation channel used by WebVR thread to broadcast events
- webvr_constellation_sender.send(constellation_chan.clone()).unwrap();
+ webvr_constellation_sender
+ .send(constellation_chan.clone())
+ .unwrap();
}
// channels to communicate with Service Worker Manager
let sw_senders = SWManagerSenders {
swmanager_sender: from_swmanager_sender,
- resource_sender: resource_sender
+ resource_sender: resource_sender,
};
(constellation_chan, sw_senders)
@@ -556,7 +600,11 @@ fn create_constellation(user_agent: Cow<'static, str>,
// This should probably be in the log crate.
struct BothLogger<Log1, Log2>(Log1, Log2);
-impl<Log1, Log2> Log for BothLogger<Log1, Log2> where Log1: Log, Log2: Log {
+impl<Log1, Log2> Log for BothLogger<Log1, Log2>
+where
+ Log1: Log,
+ Log2: Log,
+{
fn enabled(&self, metadata: &Metadata) -> bool {
self.0.enabled(metadata) || self.1.enabled(metadata)
}
@@ -590,7 +638,9 @@ pub fn run_content_process(token: String) {
ipc::channel::<UnprivilegedPipelineContent>().unwrap();
let connection_bootstrap: IpcSender<IpcSender<UnprivilegedPipelineContent>> =
IpcSender::connect(token).unwrap();
- connection_bootstrap.send(unprivileged_content_sender).unwrap();
+ connection_bootstrap
+ .send(unprivileged_content_sender)
+ .unwrap();
let unprivileged_content = unprivileged_content_receiver.recv().unwrap();
opts::set_defaults(unprivileged_content.opts());
@@ -599,7 +649,7 @@ pub fn run_content_process(token: String) {
// Enter the sandbox if necessary.
if opts::get().sandbox {
- create_sandbox();
+ create_sandbox();
}
// send the required channels to the service worker manager
@@ -614,7 +664,8 @@ pub fn run_content_process(token: String) {
#[cfg(all(not(target_os = "windows"), not(target_os = "ios")))]
fn create_sandbox() {
- ChildSandbox::new(content_process_sandbox_profile()).activate()
+ ChildSandbox::new(content_process_sandbox_profile())
+ .activate()
.expect("Failed to activate sandbox!");
}
diff --git a/components/size_of_test/lib.rs b/components/size_of_test/lib.rs
index fdd2cd62ec9..f190c24599d 100644
--- a/components/size_of_test/lib.rs
+++ b/components/size_of_test/lib.rs
@@ -13,16 +13,22 @@ macro_rules! size_of_test {
panic!(
"Your changes have decreased the stack size of {} from {} to {}. \
Good work! Please update the expected size in {}.",
- stringify!($t), old, new, file!()
+ stringify!($t),
+ old,
+ new,
+ file!()
)
} else if new > old {
panic!(
"Your changes have increased the stack size of {} from {} to {}. \
Please consider choosing a design which avoids this increase. \
If you feel that the increase is necessary, update the size in {}.",
- stringify!($t), old, new, file!()
+ stringify!($t),
+ old,
+ new,
+ file!()
)
}
}
- }
+ };
}
diff --git a/ports/libsimpleservo/build.rs b/ports/libsimpleservo/build.rs
index c684cc36554..8f7df1926d1 100644
--- a/ports/libsimpleservo/build.rs
+++ b/ports/libsimpleservo/build.rs
@@ -20,7 +20,8 @@ fn main() {
fn android_main() {
// Get the NDK path from NDK_HOME env.
- let ndk_path = env::var_os("ANDROID_NDK").expect("Please set the ANDROID_NDK environment variable");
+ let ndk_path =
+ env::var_os("ANDROID_NDK").expect("Please set the ANDROID_NDK environment variable");
let ndk_path = Path::new(&ndk_path);
let target = env::var("TARGET").unwrap();
@@ -43,7 +44,11 @@ fn android_main() {
};
// compiling android_native_app_glue.c
- let c_file = ndk_path.join("sources").join("android").join("native_app_glue").join("android_native_app_glue.c");
+ let c_file = ndk_path
+ .join("sources")
+ .join("android")
+ .join("native_app_glue")
+ .join("android_native_app_glue.c");
let sysroot = ndk_path.join("platforms").join(platform).join(arch);
cc::Build::new()
.file(c_file)
@@ -53,13 +58,13 @@ fn android_main() {
.compile("android_native_app_glue");
// Get the output directory.
- let out_dir = env::var("OUT_DIR").expect("Cargo should have set the OUT_DIR environment variable");
+ let out_dir =
+ env::var("OUT_DIR").expect("Cargo should have set the OUT_DIR environment variable");
println!("cargo:rustc-link-lib=static=android_native_app_glue");
println!("cargo:rustc-link-search=native={}", out_dir);
println!("cargo:rustc-link-lib=log");
println!("cargo:rustc-link-lib=android");
-
}
fn generate_gl_bindings(target: &str) {
diff --git a/servo-tidy.toml b/servo-tidy.toml
index 01a43ffd9c0..46f4fa505c5 100644
--- a/servo-tidy.toml
+++ b/servo-tidy.toml
@@ -14,18 +14,15 @@ lint-scripts = [
# which are packages allowed to use the blocked package.
[blocked-packages]
rand = [
- "deque",
+ "crossbeam-channel",
"gaol",
"hashglobe", # only uses in tests
"ipc-channel",
- "num-bigint",
"parking_lot_core",
"phf_generator",
"rayon",
"rayon-core",
"servo_rand",
- "servo-websocket",
- "tempdir",
"tempfile",
"uuid",
"ws",
@@ -39,6 +36,10 @@ num = [
# Ignored packages with duplicated versions
packages = [
"bitflags",
+ "crossbeam-epoch",
+ "crossbeam-utils",
+ #TODO: remove ipc-channel when #21325 lands
+ "ipc-channel",
"log",
"rand",
"winapi",
diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-one-sample-loop.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-one-sample-loop.html.ini
index 24a3ddacde6..7072e3007b3 100644
--- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-one-sample-loop.html.ini
+++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-one-sample-loop.html.ini
@@ -8,3 +8,6 @@
[< [one-sample-loop\] 1 out of 1 assertions were failed.]
expected: FAIL
+ [X Rendered data: Expected 1 for all values but found 999 unexpected values: \n\tIndex\tActual\n\t[1\]\t0\n\t[2\]\t0\n\t[3\]\t0\n\t[4\]\t0\n\t...and 995 more errors.]
+ expected: FAIL
+
diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-time-limits.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-time-limits.html.ini
index 3ff170d3677..b5313c149bd 100644
--- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-time-limits.html.ini
+++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiosource-time-limits.html.ini
@@ -14,3 +14,6 @@
[X Output from AudioBufferSource.stop(1e+300): Expected 1 for all values but found 999 unexpected values: \n\tIndex\tActual\n\t[0\]\t0\n\t[1\]\t0\n\t[2\]\t0\n\t[3\]\t0\n\t...and 995 more errors.]
expected: FAIL
+ [X Output from AudioBufferSource.stop(1e+300): Expected 1 for all values but found 1000 unexpected values: \n\tIndex\tActual\n\t[0\]\t0\n\t[1\]\t0\n\t[2\]\t0\n\t[3\]\t0\n\t...and 996 more errors.]
+ expected: FAIL
+
diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/buffer-resampling.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/buffer-resampling.html.ini
index 331dfa600d8..1ec6a000047 100644
--- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/buffer-resampling.html.ini
+++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/buffer-resampling.html.ini
@@ -11,3 +11,6 @@
[X Interpolated sine wave does not equal [0,0.05756402388215065,0.11493714898824692,0.17192909121513367,0.22835086286067963,0.28401535749435425,0.3387379050254822,0.3923371136188507,0.44463518261909485,0.4954586327075958,0.5446390509605408,0.5920131802558899,0.6374239921569824,0.680720865726471,0.7217602133750916,0.760405957698822...\] with an element-wise tolerance of {"absoluteThreshold":0.090348,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[2\]\t0.0000000000000000e+0\t1.1493714898824692e-1\t1.1493714898824692e-1\t1.0000000000000000e+0\t9.0347999999999998e-2\n\t[3\]\t0.0000000000000000e+0\t1.7192909121513367e-1\t1.7192909121513367e-1\t1.0000000000000000e+0\t9.0347999999999998e-2\n\t[4\]\t0.0000000000000000e+0\t2.2835086286067963e-1\t2.2835086286067963e-1\t1.0000000000000000e+0\t9.0347999999999998e-2\n\t[5\]\t0.0000000000000000e+0\t2.8401535749435425e-1\t2.8401535749435425e-1\t1.0000000000000000e+0\t9.0347999999999998e-2\n\t[6\]\t0.0000000000000000e+0\t3.3873790502548218e-1\t3.3873790502548218e-1\t1.0000000000000000e+0\t9.0347999999999998e-2\n\t...and 476 more errors.\n\tMax AbsError of 1.0000000000000000e+0 at index of 300.\n\t[300\]\t0.0000000000000000e+0\t-1.0000000000000000e+0\t1.0000000000000000e+0\t1.0000000000000000e+0\t9.0347999999999998e-2\n\tMax RelError of 1.0000000000000000e+0 at index of 2.\n]
expected: FAIL
+ [X Interpolated sine wave does not equal [0,0.05756402388215065,0.11493714898824692,0.17192909121513367,0.22835086286067963,0.28401535749435425,0.3387379050254822,0.3923371136188507,0.44463518261909485,0.4954586327075958,0.5446390509605408,0.5920131802558899,0.6374239921569824,0.680720865726471,0.7217602133750916,0.760405957698822...\] with an element-wise tolerance of {"absoluteThreshold":0.090348,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[2\]\t0.0000000000000000e+0\t1.1493714898824692e-1\t1.1493714898824692e-1\t1.0000000000000000e+0\t9.0347999999999998e-2\n\t[3\]\t0.0000000000000000e+0\t1.7192909121513367e-1\t1.7192909121513367e-1\t1.0000000000000000e+0\t9.0347999999999998e-2\n\t[4\]\t0.0000000000000000e+0\t2.2835086286067963e-1\t2.2835086286067963e-1\t1.0000000000000000e+0\t9.0347999999999998e-2\n\t[5\]\t0.0000000000000000e+0\t2.8401535749435425e-1\t2.8401535749435425e-1\t1.0000000000000000e+0\t9.0347999999999998e-2\n\t[6\]\t0.0000000000000000e+0\t3.3873790502548218e-1\t3.3873790502548218e-1\t1.0000000000000000e+0\t9.0347999999999998e-2\n\t...and 477 more errors.\n\tMax AbsError of 1.0000000000000000e+0 at index of 300.\n\t[300\]\t0.0000000000000000e+0\t-1.0000000000000000e+0\t1.0000000000000000e+0\t1.0000000000000000e+0\t9.0347999999999998e-2\n\tMax RelError of 1.0000000000000000e+0 at index of 2.\n]
+ expected: FAIL
+
diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sample-accurate-scheduling.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sample-accurate-scheduling.html.ini
index 6f744db6f5b..3a1b725b3bc 100644
--- a/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sample-accurate-scheduling.html.ini
+++ b/tests/wpt/metadata/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sample-accurate-scheduling.html.ini
@@ -11,3 +11,9 @@
[< [test\] 2 out of 4 assertions were failed.]
expected: FAIL
+ [< [test\] 1 out of 3 assertions were failed.]
+ expected: FAIL
+
+ [X Number of impulses found is not equal to 9. Got 1.]
+ expected: FAIL
+
diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-oscillatornode-interface/detune-limiting.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-oscillatornode-interface/detune-limiting.html.ini
index f4a1da814f3..7386e31980e 100644
--- a/tests/wpt/metadata/webaudio/the-audio-api/the-oscillatornode-interface/detune-limiting.html.ini
+++ b/tests/wpt/metadata/webaudio/the-audio-api/the-oscillatornode-interface/detune-limiting.html.ini
@@ -17,3 +17,12 @@
[X Osc(freq: 44100.00390625) output: Expected 0 for all values but found 5510 unexpected values: \n\tIndex\tActual\n\t[1\]\t5.565462970480439e-7\n\t[2\]\t0.0000011130925940960879\n\t[3\]\t0.0000016696390048309695\n\t[4\]\t0.0000022261851881921757\n\t...and 5506 more errors.]
expected: FAIL
+ [X osc[5:\]: Expected 0 for all values but found 5507 unexpected values: \n\tIndex\tActual\n\t[0\]\t0.0007123792311176658\n\t[1\]\t0.0008548550540581346\n\t[2\]\t0.0009973308769986033\n\t[3\]\t0.0011398065835237503\n\t...and 5503 more errors.]
+ expected: FAIL
+
+ [X Osc(freq: 1, detune: 18514.189453125) output does not equal [0,5.565462970480439e-7,0.0000011130925940960879,0.0000016696390048309695,0.0000022261851881921757,0.0000027827315989270573,0.000003339278009661939,0.000003895824193023145,0.000004452370376384351,0.0000050089170144929085,0.000005565463197854115,0.000006122009381215321,0.000006678556019323878,0.000007235102202685084,0.00000779164838604629,0.000008348194569407497...\] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[1\]\t1.4247585204429924e-4\t5.5654629704804393e-7\t1.4191930574725120e-4\t2.5500000000000000e+2\t0.0000000000000000e+0\n\t[2\]\t2.8495170408859849e-4\t1.1130925940960879e-6\t2.8383861149450240e-4\t2.5500000000000000e+2\t0.0000000000000000e+0\n\t[3\]\t4.2742758523672819e-4\t1.6696390048309695e-6\t4.2575794623189722e-4\t2.5500000000000000e+2\t0.0000000000000000e+0\n\t[4\]\t5.6990334996953607e-4\t2.2261851881921757e-6\t5.6767716478134389e-4\t2.5499997385318113e+2\t0.0000000000000000e+0\n\t[5\]\t7.1237923111766577e-4\t2.7827315989270573e-6\t7.0959649951873871e-4\t2.5499997908254574e+2\t0.0000000000000000e+0\n\t...and 5506 more errors.\n\tMax AbsError of 7.0388854946941137e-1 at index of 5511.\n\t[5511\]\t7.0695567131042480e-1\t3.0671218410134315e-3\t7.0388854946941137e-1\t2.2949481173425900e+2\t0.0000000000000000e+0\n\tMax RelError of 2.5500000000000000e+2 at index of 1.\n]
+ expected: FAIL
+
+ [X Osc(freq: 44100.00390625) output: Expected 0 for all values but found 5511 unexpected values: \n\tIndex\tActual\n\t[1\]\t5.565462970480439e-7\n\t[2\]\t0.0000011130925940960879\n\t[3\]\t0.0000016696390048309695\n\t[4\]\t0.0000022261851881921757\n\t...and 5507 more errors.]
+ expected: FAIL
+