servo: Merge #14165 - Supress panics for ProfilerChan sends (from servo:jdm-patch-1); r=nox

This should address #14161.

Source-Repo: https://github.com/servo/servo
Source-Revision: 65dd6d43409228e259153463fe24922c51172bc5
This commit is contained in:
Josh Matthews 2016-11-14 16:12:34 -06:00
Родитель fbd6dc3fd6
Коммит 98f874ab6f
6 изменённых файлов: 15 добавлений и 4 удалений

Просмотреть файл

@ -16,6 +16,7 @@ energy-profiling = ["energymon", "energy-monitor"]
ipc-channel = "0.5"
energymon = {git = "https://github.com/energymon/energymon-rust.git", optional = true}
energy-monitor = {version = "0.2.0", optional = true}
log = "0.3.5"
plugins = {path = "../plugins"}
serde = "0.8"
serde_derive = "0.8"

Просмотреть файл

@ -13,6 +13,8 @@
#![deny(unsafe_code)]
extern crate ipc_channel;
#[macro_use]
extern crate log;
extern crate serde;
#[macro_use]
extern crate serde_derive;

Просмотреть файл

@ -19,7 +19,9 @@ pub trait OpaqueSender<T> {
impl<T> OpaqueSender<T> for Sender<T> {
fn send(&self, message: T) {
let _ = Sender::send(self, message);
if let Err(e) = Sender::send(self, message) {
warn!("Error communicating with the target thread from the profiler: {}", e);
}
}
}
@ -31,9 +33,11 @@ pub struct ProfilerChan(pub IpcSender<ProfilerMsg>);
impl ProfilerChan {
/// Send `msg` on this `IpcSender`.
///
/// Panics if the send fails.
/// Warns if the send fails.
pub fn send(&self, msg: ProfilerMsg) {
self.0.send(msg).unwrap();
if let Err(e) = self.0.send(msg) {
warn!("Error communicating with the memory profiler thread: {}", e);
}
}
/// Runs `f()` with memory profiling.

Просмотреть файл

@ -22,7 +22,9 @@ pub struct ProfilerChan(pub IpcSender<ProfilerMsg>);
impl ProfilerChan {
pub fn send(&self, msg: ProfilerMsg) {
let _ = self.0.send(msg);
if let Err(e) = self.0.send(msg) {
warn!("Error communicating with the time profiler thread: {}", e);
}
}
}

1
servo/components/servo/Cargo.lock сгенерированный
Просмотреть файл

@ -1997,6 +1997,7 @@ dependencies = [
"energy-monitor 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"energymon 0.2.0 (git+https://github.com/energymon/energymon-rust.git)",
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)",

1
servo/ports/cef/Cargo.lock сгенерированный
Просмотреть файл

@ -1823,6 +1823,7 @@ name = "profile_traits"
version = "0.0.1"
dependencies = [
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)",