aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2016-11-10 09:11:59 -0500
committerJosh Matthews <josh@joshmatthews.net>2016-11-14 13:00:19 -0500
commit25a237c46640aa929d17bf207a19ed076885f383 (patch)
tree00e61dea9871ea374cce57c27811ede087cbb25c
parent89c46369a209462ff38eeb4316ab5fd970c1c5c3 (diff)
downloadservo-25a237c46640aa929d17bf207a19ed076885f383.tar.gz
servo-25a237c46640aa929d17bf207a19ed076885f383.zip
Supress panics for ProfilerChan sends.
-rw-r--r--components/profile_traits/Cargo.toml1
-rw-r--r--components/profile_traits/lib.rs2
-rw-r--r--components/profile_traits/mem.rs10
-rw-r--r--components/profile_traits/time.rs4
-rw-r--r--components/servo/Cargo.lock1
-rw-r--r--ports/cef/Cargo.lock1
6 files changed, 15 insertions, 4 deletions
diff --git a/components/profile_traits/Cargo.toml b/components/profile_traits/Cargo.toml
index dd9cd0a087d..bf765fa45f2 100644
--- a/components/profile_traits/Cargo.toml
+++ b/components/profile_traits/Cargo.toml
@@ -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"
diff --git a/components/profile_traits/lib.rs b/components/profile_traits/lib.rs
index 4a826c1db0d..1a099fb6a32 100644
--- a/components/profile_traits/lib.rs
+++ b/components/profile_traits/lib.rs
@@ -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;
diff --git a/components/profile_traits/mem.rs b/components/profile_traits/mem.rs
index b7da0d3e871..1b4c8243792 100644
--- a/components/profile_traits/mem.rs
+++ b/components/profile_traits/mem.rs
@@ -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.
diff --git a/components/profile_traits/time.rs b/components/profile_traits/time.rs
index 7068a7261e4..c8cf4913f1e 100644
--- a/components/profile_traits/time.rs
+++ b/components/profile_traits/time.rs
@@ -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);
+ }
}
}
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock
index 49c10625db3..aebf1f4ff9a 100644
--- a/components/servo/Cargo.lock
+++ b/components/servo/Cargo.lock
@@ -1972,6 +1972,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)",
diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock
index 8e94b56ce50..212c9fee09f 100644
--- a/ports/cef/Cargo.lock
+++ b/ports/cef/Cargo.lock
@@ -1798,6 +1798,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)",