Skip to content

Commit

Permalink
# This is a combination of 5 commits.
Browse files Browse the repository at this point in the history
# 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
  • Loading branch information
pmocher committed Mar 30, 2018
1 parent b30a8d2 commit f572f8f
Show file tree
Hide file tree
Showing 37 changed files with 230 additions and 93 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Servo.app
.config.mk.last
/glfw
capture_webrender/
/components/compositing/webrender_revision.rs

# Editors

Expand Down
6 changes: 4 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions components/canvas/canvas_paint_thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ impl<'a> CanvasPaintThread<'a> {
format: webrender_api::ImageFormat::BGRA8,
offset: 0,
is_opaque: false,
allow_mipmaps: false,
};
let data = webrender_api::ImageData::Raw(Arc::new(element.into()));

Expand Down
1 change: 1 addition & 0 deletions components/canvas/webgl_thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ impl<VR: WebVRRenderHandler + 'static, OB: WebGLThreadObserver> WebGLThread<VR,
format: webrender_api::ImageFormat::BGRA8,
offset: 0,
is_opaque: !alpha,
allow_mipmaps: false,
}
}

Expand Down
9 changes: 0 additions & 9 deletions components/config/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,6 @@ pub struct Opts {
/// True to show webrender profiling stats on screen.
pub webrender_stats: bool,

/// True to show webrender debug on screen.
pub webrender_debug: bool,

/// True if webrender recording should be enabled.
pub webrender_record: bool,

Expand Down Expand Up @@ -312,9 +309,6 @@ pub struct DebugOptions {
/// Show webrender profiling stats on screen.
pub webrender_stats: bool,

/// Show webrender debug on screen.
pub webrender_debug: bool,

/// Enable webrender recording.
pub webrender_record: bool,

Expand Down Expand Up @@ -366,7 +360,6 @@ impl DebugOptions {
"load-webfonts-synchronously" => self.load_webfonts_synchronously = true,
"disable-vsync" => self.disable_vsync = true,
"wr-stats" => self.webrender_stats = true,
"wr-debug" => self.webrender_debug = true,
"wr-record" => self.webrender_record = true,
"wr-no-batch" => self.webrender_disable_batch = true,
"msaa" => self.use_msaa = true,
Expand Down Expand Up @@ -549,7 +542,6 @@ pub fn default_opts() -> Opts {
config_dir: None,
full_backtraces: false,
is_printing_version: false,
webrender_debug: false,
webrender_record: false,
webrender_batch: true,
precache_shaders: false,
Expand Down Expand Up @@ -850,7 +842,6 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
config_dir: opt_match.opt_str("config-dir").map(Into::into),
full_backtraces: debug_options.full_backtraces,
is_printing_version: is_printing_version,
webrender_debug: debug_options.webrender_debug,
webrender_record: debug_options.webrender_record,
webrender_batch: !debug_options.webrender_disable_batch,
precache_shaders: debug_options.precache_shaders,
Expand Down
6 changes: 3 additions & 3 deletions components/layout/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@ impl LineBreaker {
}

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

/// Reflows fragments for the given inline flow.
Expand Down
1 change: 1 addition & 0 deletions components/net/image_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ fn set_webrender_image_key(webrender_api: &webrender_api::RenderApi, image: &mut
format: webrender_api::ImageFormat::BGRA8,
offset: 0,
is_opaque,
allow_mipmaps: true,
};
let data = webrender_api::ImageData::new(bytes);
let image_key = webrender_api.generate_image_key();
Expand Down
10 changes: 9 additions & 1 deletion components/profile/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use influent::create_client;
use influent::measurement::{Measurement, Value};
use ipc_channel::ipc::{self, IpcReceiver};
use profile_traits::energy::{energy_interval_ms, read_energy_uj};
use profile_traits::time::{ProfilerCategory, ProfilerChan, ProfilerMsg, TimerMetadata};
use profile_traits::time::{ProfilerCategory, ProfilerChan, ProfilerMsg, ProfilerData, TimerMetadata};
use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType};
use servo_config::opts::OutputOptions;
use std::{f64, thread, u32, u64};
Expand Down Expand Up @@ -158,6 +158,7 @@ impl Formattable for ProfilerCategory {
ProfilerCategory::TimeToFirstPaint => "Time To First Paint",
ProfilerCategory::TimeToFirstContentfulPaint => "Time To First Contentful Paint",
ProfilerCategory::TimeToInteractive => "Time to Interactive",
ProfilerCategory::IpcReceiver => "Blocked at IPC Receive",
ProfilerCategory::ApplicationHeartbeat => "Application Heartbeat",
};
format!("{}{}", padding, name)
Expand Down Expand Up @@ -316,6 +317,13 @@ impl Profiler {
// only print if more data has arrived since the last printout
self.print_buckets();
},
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(),
None => sender.send(ProfilerData::NoRecords).unwrap(),
};
},
ProfilerMsg::Exit(chan) => {
heartbeats::cleanup();
self.print_buckets();
Expand Down
1 change: 1 addition & 0 deletions components/profile_traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ path = "lib.rs"
energy-profiling = ["energymon", "energy-monitor"]

[dependencies]
bincode = "1"
energy-monitor = {version = "0.2.0", optional = true}
energymon = {git = "https://github.com/energymon/energymon-rust.git", optional = true}
ipc-channel = "0.10"
Expand Down
45 changes: 45 additions & 0 deletions components/profile_traits/ipc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */

use bincode;
use ipc_channel::ipc;
use serde::{Deserialize, Serialize};
use std::io::Error;
use time;
use time::ProfilerCategory;
use time::ProfilerChan;

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 {
pub fn recv(&self) -> Result<T, bincode::Error> {
time::profile(
ProfilerCategory::IpcReceiver,
None,
self.time_profile_chan.clone(),
move || self.ipc_receiver.recv(),
)
}

pub fn try_recv(&self) -> Result<T, bincode::Error> {
self.ipc_receiver.try_recv()
}

pub fn to_opaque(self) -> ipc::OpaqueIpcReceiver {
self.ipc_receiver.to_opaque()
}
}

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,
time_profile_chan,
};
Ok((ipc_sender, profiled_ipc_receiver))
}
2 changes: 2 additions & 0 deletions components/profile_traits/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#![deny(unsafe_code)]

extern crate bincode;
extern crate ipc_channel;
#[macro_use]
extern crate log;
Expand All @@ -17,5 +18,6 @@ extern crate signpost;

#[allow(unsafe_code)]
pub mod energy;
pub mod ipc;
pub mod mem;
pub mod time;
9 changes: 9 additions & 0 deletions components/profile_traits/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,18 @@ impl ProfilerChan {
}
}

#[derive(Clone, Deserialize, Serialize)]
pub enum ProfilerData {
NoRecords,
Record(Vec<f64>),
}

#[derive(Clone, Deserialize, Serialize)]
pub enum ProfilerMsg {
/// Normal message used for reporting time
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>),
/// Message used to force print the profiling metrics
Print,
/// Tells the profiler to shut down.
Expand Down Expand Up @@ -94,6 +102,7 @@ pub enum ProfilerCategory {
TimeToFirstPaint = 0x80,
TimeToFirstContentfulPaint = 0x81,
TimeToInteractive = 0x82,
IpcReceiver = 0x83,
ApplicationHeartbeat = 0x90,
}

Expand Down
12 changes: 6 additions & 6 deletions components/script/dom/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ use dom::bindings::root::{Dom, DomRoot};
use dom::bindings::str::DOMString;
use dom::globalscope::GlobalScope;
use dom_struct::dom_struct;
use ipc_channel::ipc;
use net_traits::{CoreResourceMsg, IpcSend};
use net_traits::blob_url_store::{BlobBuf, get_blob_origin};
use net_traits::filemanager_thread::{FileManagerThreadMsg, ReadFileProgress, RelativePos};
use profile_traits::ipc;
use std::mem;
use std::ops::Index;
use std::path::PathBuf;
Expand Down Expand Up @@ -200,7 +200,7 @@ impl Blob {
BlobImpl::File(ref f) => {
if set_valid {
let origin = get_blob_origin(&global_url);
let (tx, rx) = ipc::channel().unwrap();
let (tx, rx) = ipc::channel(self.global().time_profiler_chan().clone()).unwrap();

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

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

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

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

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

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

fn read_file(global: &GlobalScope, id: Uuid) -> Result<Vec<u8>, ()> {
let resource_threads = global.resource_threads();
let (chan, recv) = ipc::channel().map_err(|_|())?;
let (chan, recv) = ipc::channel(global.time_profiler_chan().clone()).map_err(|_|())?;
let origin = get_blob_origin(&global.get_url());
let check_url_validity = false;
let msg = FileManagerThreadMsg::ReadFile(chan, id, check_url_validity, origin);
Expand Down
3 changes: 2 additions & 1 deletion components/script/dom/bluetooth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use ipc_channel::router::ROUTER;
use js::conversions::ConversionResult;
use js::jsapi::{JSContext, JSObject};
use js::jsval::{ObjectValue, UndefinedValue};
use profile_traits::ipc as ProfiledIpc;
use std::cell::Ref;
use std::collections::HashMap;
use std::rc::Rc;
Expand Down Expand Up @@ -613,7 +614,7 @@ impl PermissionAlgorithm for Bluetooth {
// Step 6.2.2.
// Instead of creating an internal slot we send an ipc message to the Bluetooth thread
// to check if one of the filters matches.
let (sender, receiver) = ipc::channel().unwrap();
let (sender, receiver) = ProfiledIpc::channel(global.time_profiler_chan().clone()).unwrap();
status.get_bluetooth_thread()
.send(BluetoothRequest::MatchesFilter(device_id.clone(),
BluetoothScanfilterSequence::new(scan_filters),
Expand Down
7 changes: 4 additions & 3 deletions components/script/dom/bluetoothdevice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ use dom::eventtarget::EventTarget;
use dom::globalscope::GlobalScope;
use dom::promise::Promise;
use dom_struct::dom_struct;
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::ipc::IpcSender;
use profile_traits::ipc;
use std::cell::Cell;
use std::collections::HashMap;
use std::rc::Rc;
Expand Down Expand Up @@ -129,7 +130,7 @@ impl BluetoothDevice {
}

pub fn is_represented_device_null(&self) -> bool {
let (sender, receiver) = ipc::channel().unwrap();
let (sender, receiver) = ipc::channel(self.global().time_profiler_chan().clone()).unwrap();
self.get_bluetooth_thread().send(
BluetoothRequest::IsRepresentedDeviceNull(self.Id().to_string(), sender)).unwrap();
receiver.recv().unwrap()
Expand Down Expand Up @@ -204,7 +205,7 @@ impl BluetoothDevice {
}

// Step 3.
let (sender, receiver) = ipc::channel().unwrap();
let (sender, receiver) = ipc::channel(self.global().time_profiler_chan().clone()).unwrap();
self.get_bluetooth_thread().send(
BluetoothRequest::GATTServerDisconnect(String::from(self.Id()), sender)).unwrap();
receiver.recv().unwrap().map_err(Error::from)
Expand Down
Loading

0 comments on commit f572f8f

Please sign in to comment.