Skip to content

Commit f572f8f

Browse files
author
pmocher
committed
# This is a combination of 5 commits.
# This is the 1st commit message: resolved merge conflict # This is the commit message servo#2: getRandomValues uses ArrayBufferView now # This is the commit message servo#3: Workaround servo#20149 - presumed rustc bug on android. # This is the commit message servo#4: Update WR (accelerated webgl fix on mac, line decoration optimizations). # This is the commit message servo#5: build(mach): generate webrender revision via cargo lockfile
1 parent b30a8d2 commit f572f8f

37 files changed

+230
-93
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Servo.app
2323
.config.mk.last
2424
/glfw
2525
capture_webrender/
26+
/components/compositing/webrender_revision.rs
2627

2728
# Editors
2829

Cargo.lock

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/canvas/canvas_paint_thread.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ impl<'a> CanvasPaintThread<'a> {
609609
format: webrender_api::ImageFormat::BGRA8,
610610
offset: 0,
611611
is_opaque: false,
612+
allow_mipmaps: false,
612613
};
613614
let data = webrender_api::ImageData::Raw(Arc::new(element.into()));
614615

components/canvas/webgl_thread.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ impl<VR: WebVRRenderHandler + 'static, OB: WebGLThreadObserver> WebGLThread<VR,
494494
format: webrender_api::ImageFormat::BGRA8,
495495
offset: 0,
496496
is_opaque: !alpha,
497+
allow_mipmaps: false,
497498
}
498499
}
499500

components/config/opts.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,6 @@ pub struct Opts {
190190
/// True to show webrender profiling stats on screen.
191191
pub webrender_stats: bool,
192192

193-
/// True to show webrender debug on screen.
194-
pub webrender_debug: bool,
195-
196193
/// True if webrender recording should be enabled.
197194
pub webrender_record: bool,
198195

@@ -312,9 +309,6 @@ pub struct DebugOptions {
312309
/// Show webrender profiling stats on screen.
313310
pub webrender_stats: bool,
314311

315-
/// Show webrender debug on screen.
316-
pub webrender_debug: bool,
317-
318312
/// Enable webrender recording.
319313
pub webrender_record: bool,
320314

@@ -366,7 +360,6 @@ impl DebugOptions {
366360
"load-webfonts-synchronously" => self.load_webfonts_synchronously = true,
367361
"disable-vsync" => self.disable_vsync = true,
368362
"wr-stats" => self.webrender_stats = true,
369-
"wr-debug" => self.webrender_debug = true,
370363
"wr-record" => self.webrender_record = true,
371364
"wr-no-batch" => self.webrender_disable_batch = true,
372365
"msaa" => self.use_msaa = true,
@@ -549,7 +542,6 @@ pub fn default_opts() -> Opts {
549542
config_dir: None,
550543
full_backtraces: false,
551544
is_printing_version: false,
552-
webrender_debug: false,
553545
webrender_record: false,
554546
webrender_batch: true,
555547
precache_shaders: false,
@@ -850,7 +842,6 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
850842
config_dir: opt_match.opt_str("config-dir").map(Into::into),
851843
full_backtraces: debug_options.full_backtraces,
852844
is_printing_version: is_printing_version,
853-
webrender_debug: debug_options.webrender_debug,
854845
webrender_record: debug_options.webrender_record,
855846
webrender_batch: !debug_options.webrender_disable_batch,
856847
precache_shaders: debug_options.precache_shaders,

components/layout/inline.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,10 @@ impl LineBreaker {
266266
}
267267

268268
/// Reinitializes the pending line to blank data.
269-
fn reset_line(&mut self) -> Line {
269+
fn reset_line(&mut self) {
270270
self.last_known_line_breaking_opportunity = None;
271-
mem::replace(&mut self.pending_line,
272-
Line::new(self.floats.writing_mode, &self.minimum_metrics))
271+
// https://github.com/rust-lang/rust/issues/49282
272+
self.pending_line = Line::new(self.floats.writing_mode, &self.minimum_metrics);
273273
}
274274

275275
/// Reflows fragments for the given inline flow.

components/net/image_cache.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ fn set_webrender_image_key(webrender_api: &webrender_api::RenderApi, image: &mut
8282
format: webrender_api::ImageFormat::BGRA8,
8383
offset: 0,
8484
is_opaque,
85+
allow_mipmaps: true,
8586
};
8687
let data = webrender_api::ImageData::new(bytes);
8788
let image_key = webrender_api.generate_image_key();

components/profile/time.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use influent::create_client;
1010
use influent::measurement::{Measurement, Value};
1111
use ipc_channel::ipc::{self, IpcReceiver};
1212
use profile_traits::energy::{energy_interval_ms, read_energy_uj};
13-
use profile_traits::time::{ProfilerCategory, ProfilerChan, ProfilerMsg, TimerMetadata};
13+
use profile_traits::time::{ProfilerCategory, ProfilerChan, ProfilerMsg, ProfilerData, TimerMetadata};
1414
use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType};
1515
use servo_config::opts::OutputOptions;
1616
use std::{f64, thread, u32, u64};
@@ -158,6 +158,7 @@ impl Formattable for ProfilerCategory {
158158
ProfilerCategory::TimeToFirstPaint => "Time To First Paint",
159159
ProfilerCategory::TimeToFirstContentfulPaint => "Time To First Contentful Paint",
160160
ProfilerCategory::TimeToInteractive => "Time to Interactive",
161+
ProfilerCategory::IpcReceiver => "Blocked at IPC Receive",
161162
ProfilerCategory::ApplicationHeartbeat => "Application Heartbeat",
162163
};
163164
format!("{}{}", padding, name)
@@ -316,6 +317,13 @@ impl Profiler {
316317
// only print if more data has arrived since the last printout
317318
self.print_buckets();
318319
},
320+
ProfilerMsg::Get(k, sender) => {
321+
let vec_option = self.buckets.get(&k);
322+
match vec_option {
323+
Some(vec_entry) => sender.send(ProfilerData::Record(vec_entry.to_vec())).unwrap(),
324+
None => sender.send(ProfilerData::NoRecords).unwrap(),
325+
};
326+
},
319327
ProfilerMsg::Exit(chan) => {
320328
heartbeats::cleanup();
321329
self.print_buckets();

components/profile_traits/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ path = "lib.rs"
1313
energy-profiling = ["energymon", "energy-monitor"]
1414

1515
[dependencies]
16+
bincode = "1"
1617
energy-monitor = {version = "0.2.0", optional = true}
1718
energymon = {git = "https://github.com/energymon/energymon-rust.git", optional = true}
1819
ipc-channel = "0.10"

components/profile_traits/ipc.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
use bincode;
6+
use ipc_channel::ipc;
7+
use serde::{Deserialize, Serialize};
8+
use std::io::Error;
9+
use time;
10+
use time::ProfilerCategory;
11+
use time::ProfilerChan;
12+
13+
pub struct IpcReceiver<T> where T: for<'de> Deserialize<'de> + Serialize {
14+
ipc_receiver: ipc::IpcReceiver<T>,
15+
time_profile_chan: ProfilerChan,
16+
}
17+
18+
impl<T> IpcReceiver<T> where T: for<'de> Deserialize<'de> + Serialize {
19+
pub fn recv(&self) -> Result<T, bincode::Error> {
20+
time::profile(
21+
ProfilerCategory::IpcReceiver,
22+
None,
23+
self.time_profile_chan.clone(),
24+
move || self.ipc_receiver.recv(),
25+
)
26+
}
27+
28+
pub fn try_recv(&self) -> Result<T, bincode::Error> {
29+
self.ipc_receiver.try_recv()
30+
}
31+
32+
pub fn to_opaque(self) -> ipc::OpaqueIpcReceiver {
33+
self.ipc_receiver.to_opaque()
34+
}
35+
}
36+
37+
pub fn channel<T>(time_profile_chan: ProfilerChan) -> Result<(ipc::IpcSender<T>, IpcReceiver<T>), Error>
38+
where T: for<'de> Deserialize<'de> + Serialize, {
39+
let (ipc_sender, ipc_receiver) = ipc::channel()?;
40+
let profiled_ipc_receiver = IpcReceiver {
41+
ipc_receiver,
42+
time_profile_chan,
43+
};
44+
Ok((ipc_sender, profiled_ipc_receiver))
45+
}

components/profile_traits/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
99
#![deny(unsafe_code)]
1010

11+
extern crate bincode;
1112
extern crate ipc_channel;
1213
#[macro_use]
1314
extern crate log;
@@ -17,5 +18,6 @@ extern crate signpost;
1718

1819
#[allow(unsafe_code)]
1920
pub mod energy;
21+
pub mod ipc;
2022
pub mod mem;
2123
pub mod time;

components/profile_traits/time.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,18 @@ impl ProfilerChan {
2828
}
2929
}
3030

31+
#[derive(Clone, Deserialize, Serialize)]
32+
pub enum ProfilerData {
33+
NoRecords,
34+
Record(Vec<f64>),
35+
}
36+
3137
#[derive(Clone, Deserialize, Serialize)]
3238
pub enum ProfilerMsg {
3339
/// Normal message used for reporting time
3440
Time((ProfilerCategory, Option<TimerMetadata>), (u64, u64), (u64, u64)),
41+
/// Message used to get time spend entries for a particular ProfilerBuckets (in nanoseconds)
42+
Get((ProfilerCategory, Option<TimerMetadata>), IpcSender<ProfilerData>),
3543
/// Message used to force print the profiling metrics
3644
Print,
3745
/// Tells the profiler to shut down.
@@ -94,6 +102,7 @@ pub enum ProfilerCategory {
94102
TimeToFirstPaint = 0x80,
95103
TimeToFirstContentfulPaint = 0x81,
96104
TimeToInteractive = 0x82,
105+
IpcReceiver = 0x83,
97106
ApplicationHeartbeat = 0x90,
98107
}
99108

components/script/dom/blob.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ use dom::bindings::root::{Dom, DomRoot};
1212
use dom::bindings::str::DOMString;
1313
use dom::globalscope::GlobalScope;
1414
use dom_struct::dom_struct;
15-
use ipc_channel::ipc;
1615
use net_traits::{CoreResourceMsg, IpcSend};
1716
use net_traits::blob_url_store::{BlobBuf, get_blob_origin};
1817
use net_traits::filemanager_thread::{FileManagerThreadMsg, ReadFileProgress, RelativePos};
18+
use profile_traits::ipc;
1919
use std::mem;
2020
use std::ops::Index;
2121
use std::path::PathBuf;
@@ -200,7 +200,7 @@ impl Blob {
200200
BlobImpl::File(ref f) => {
201201
if set_valid {
202202
let origin = get_blob_origin(&global_url);
203-
let (tx, rx) = ipc::channel().unwrap();
203+
let (tx, rx) = ipc::channel(self.global().time_profiler_chan().clone()).unwrap();
204204

205205
let msg = FileManagerThreadMsg::ActivateBlobURL(f.id.clone(), tx, origin.clone());
206206
self.send_to_file_manager(msg);
@@ -227,7 +227,7 @@ impl Blob {
227227
bytes: bytes.to_vec(),
228228
};
229229

230-
let (tx, rx) = ipc::channel().unwrap();
230+
let (tx, rx) = ipc::channel(self.global().time_profiler_chan().clone()).unwrap();
231231
let msg = FileManagerThreadMsg::PromoteMemory(blob_buf, set_valid, tx, origin.clone());
232232
self.send_to_file_manager(msg);
233233

@@ -251,7 +251,7 @@ impl Blob {
251251
rel_pos: &RelativePos, parent_len: u64) -> Uuid {
252252
let origin = get_blob_origin(&self.global().get_url());
253253

254-
let (tx, rx) = ipc::channel().unwrap();
254+
let (tx, rx) = ipc::channel(self.global().time_profiler_chan().clone()).unwrap();
255255
let msg = FileManagerThreadMsg::AddSlicedURLEntry(parent_id.clone(),
256256
rel_pos.clone(),
257257
tx, origin.clone());
@@ -280,7 +280,7 @@ impl Blob {
280280
if let BlobImpl::File(ref f) = *self.blob_impl.borrow() {
281281
let origin = get_blob_origin(&self.global().get_url());
282282

283-
let (tx, rx) = ipc::channel().unwrap();
283+
let (tx, rx) = ipc::channel(self.global().time_profiler_chan().clone()).unwrap();
284284

285285
let msg = FileManagerThreadMsg::DecRef(f.id.clone(), origin, tx);
286286
self.send_to_file_manager(msg);
@@ -303,7 +303,7 @@ impl Drop for Blob {
303303

304304
fn read_file(global: &GlobalScope, id: Uuid) -> Result<Vec<u8>, ()> {
305305
let resource_threads = global.resource_threads();
306-
let (chan, recv) = ipc::channel().map_err(|_|())?;
306+
let (chan, recv) = ipc::channel(global.time_profiler_chan().clone()).map_err(|_|())?;
307307
let origin = get_blob_origin(&global.get_url());
308308
let check_url_validity = false;
309309
let msg = FileManagerThreadMsg::ReadFile(chan, id, check_url_validity, origin);

components/script/dom/bluetooth.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use ipc_channel::router::ROUTER;
3434
use js::conversions::ConversionResult;
3535
use js::jsapi::{JSContext, JSObject};
3636
use js::jsval::{ObjectValue, UndefinedValue};
37+
use profile_traits::ipc as ProfiledIpc;
3738
use std::cell::Ref;
3839
use std::collections::HashMap;
3940
use std::rc::Rc;
@@ -613,7 +614,7 @@ impl PermissionAlgorithm for Bluetooth {
613614
// Step 6.2.2.
614615
// Instead of creating an internal slot we send an ipc message to the Bluetooth thread
615616
// to check if one of the filters matches.
616-
let (sender, receiver) = ipc::channel().unwrap();
617+
let (sender, receiver) = ProfiledIpc::channel(global.time_profiler_chan().clone()).unwrap();
617618
status.get_bluetooth_thread()
618619
.send(BluetoothRequest::MatchesFilter(device_id.clone(),
619620
BluetoothScanfilterSequence::new(scan_filters),

components/script/dom/bluetoothdevice.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ use dom::eventtarget::EventTarget;
2424
use dom::globalscope::GlobalScope;
2525
use dom::promise::Promise;
2626
use dom_struct::dom_struct;
27-
use ipc_channel::ipc::{self, IpcSender};
27+
use ipc_channel::ipc::IpcSender;
28+
use profile_traits::ipc;
2829
use std::cell::Cell;
2930
use std::collections::HashMap;
3031
use std::rc::Rc;
@@ -129,7 +130,7 @@ impl BluetoothDevice {
129130
}
130131

131132
pub fn is_represented_device_null(&self) -> bool {
132-
let (sender, receiver) = ipc::channel().unwrap();
133+
let (sender, receiver) = ipc::channel(self.global().time_profiler_chan().clone()).unwrap();
133134
self.get_bluetooth_thread().send(
134135
BluetoothRequest::IsRepresentedDeviceNull(self.Id().to_string(), sender)).unwrap();
135136
receiver.recv().unwrap()
@@ -204,7 +205,7 @@ impl BluetoothDevice {
204205
}
205206

206207
// Step 3.
207-
let (sender, receiver) = ipc::channel().unwrap();
208+
let (sender, receiver) = ipc::channel(self.global().time_profiler_chan().clone()).unwrap();
208209
self.get_bluetooth_thread().send(
209210
BluetoothRequest::GATTServerDisconnect(String::from(self.Id()), sender)).unwrap();
210211
receiver.recv().unwrap().map_err(Error::from)

0 commit comments

Comments
 (0)