aboutsummaryrefslogtreecommitdiffstats
path: root/components/background_hang_monitor
diff options
context:
space:
mode:
authorSamson <16504129+sagudev@users.noreply.github.com>2023-09-11 21:16:54 +0200
committerGitHub <noreply@github.com>2023-09-11 19:16:54 +0000
commitaad2dccc9c9f6b89922c07933cfa7087a8cd1ec4 (patch)
tree68dec1a9d53f4ed564843a9580fba70bf90dbef1 /components/background_hang_monitor
parent413da4ca69d3013528c09bbaf38629a72384372d (diff)
downloadservo-aad2dccc9c9f6b89922c07933cfa7087a8cd1ec4.tar.gz
servo-aad2dccc9c9f6b89922c07933cfa7087a8cd1ec4.zip
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting * Reformat all imports
Diffstat (limited to 'components/background_hang_monitor')
-rw-r--r--components/background_hang_monitor/background_hang_monitor.rs23
-rw-r--r--components/background_hang_monitor/sampler.rs3
-rw-r--r--components/background_hang_monitor/sampler_linux.rs14
-rw-r--r--components/background_hang_monitor/sampler_mac.rs8
-rw-r--r--components/background_hang_monitor/tests/hang_monitor_tests.rs16
5 files changed, 30 insertions, 34 deletions
diff --git a/components/background_hang_monitor/background_hang_monitor.rs b/components/background_hang_monitor/background_hang_monitor.rs
index fab2b406ce2..c438541af7b 100644
--- a/components/background_hang_monitor/background_hang_monitor.rs
+++ b/components/background_hang_monitor/background_hang_monitor.rs
@@ -2,24 +2,23 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::sampler::{NativeStack, Sampler};
+use std::cell::Cell;
+use std::collections::{HashMap, VecDeque};
+use std::sync::{Arc, Weak};
+use std::thread;
+use std::time::{Duration, Instant};
+
use crossbeam_channel::{after, never, select, unbounded, Receiver, Sender};
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use log::warn;
-use msg::constellation_msg::MonitoredComponentId;
-use msg::constellation_msg::{
- BackgroundHangMonitor, BackgroundHangMonitorClone, BackgroundHangMonitorExitSignal,
- BackgroundHangMonitorRegister,
-};
use msg::constellation_msg::{
- BackgroundHangMonitorControlMsg, HangAlert, HangAnnotation, HangMonitorAlert,
+ BackgroundHangMonitor, BackgroundHangMonitorClone, BackgroundHangMonitorControlMsg,
+ BackgroundHangMonitorExitSignal, BackgroundHangMonitorRegister, HangAlert, HangAnnotation,
+ HangMonitorAlert, MonitoredComponentId,
};
-use std::cell::Cell;
-use std::collections::{HashMap, VecDeque};
-use std::sync::{Arc, Weak};
-use std::thread;
-use std::time::{Duration, Instant};
+
+use crate::sampler::{NativeStack, Sampler};
#[derive(Clone)]
pub struct HangMonitorRegister {
diff --git a/components/background_hang_monitor/sampler.rs b/components/background_hang_monitor/sampler.rs
index 3945bd1ccc8..593401a08a5 100644
--- a/components/background_hang_monitor/sampler.rs
+++ b/components/background_hang_monitor/sampler.rs
@@ -2,9 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::ptr;
+
use backtrace;
use msg::constellation_msg::{HangProfile, HangProfileSymbol};
-use std::ptr;
const MAX_NATIVE_FRAMES: usize = 1024;
diff --git a/components/background_hang_monitor/sampler_linux.rs b/components/background_hang_monitor/sampler_linux.rs
index b0561c743d6..10fdc447ca9 100644
--- a/components/background_hang_monitor/sampler_linux.rs
+++ b/components/background_hang_monitor/sampler_linux.rs
@@ -4,20 +4,18 @@
#![allow(unsafe_code)]
-use crate::sampler::{NativeStack, Sampler};
-use libc;
-use nix::sys::signal::{sigaction, SaFlags, SigAction, SigHandler, SigSet, Signal};
use std::cell::UnsafeCell;
-use std::io;
-use std::mem;
-use std::process;
-use std::ptr;
use std::sync::atomic::{AtomicPtr, Ordering};
-use std::thread;
+use std::{io, mem, process, ptr, thread};
+
+use libc;
+use nix::sys::signal::{sigaction, SaFlags, SigAction, SigHandler, SigSet, Signal};
use unwind_sys::{
unw_cursor_t, unw_get_reg, unw_init_local, unw_step, UNW_ESUCCESS, UNW_REG_IP, UNW_REG_SP,
};
+use crate::sampler::{NativeStack, Sampler};
+
// Hack to workaround broken libunwind pkg-config contents for <1.1-3ubuntu.1.
// https://bugs.launchpad.net/ubuntu/+source/libunwind/+bug/1336912
#[link(name = "lzma")]
diff --git a/components/background_hang_monitor/sampler_mac.rs b/components/background_hang_monitor/sampler_mac.rs
index e5a575ca3f3..8121865db7f 100644
--- a/components/background_hang_monitor/sampler_mac.rs
+++ b/components/background_hang_monitor/sampler_mac.rs
@@ -2,11 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use std::{panic, process};
+
+use {libc, mach};
+
use crate::sampler::{Address, NativeStack, Registers, Sampler};
-use libc;
-use mach;
-use std::panic;
-use std::process;
type MonitoredThreadId = mach::mach_types::thread_act_t;
diff --git a/components/background_hang_monitor/tests/hang_monitor_tests.rs b/components/background_hang_monitor/tests/hang_monitor_tests.rs
index 31ac269a8c1..f98978fea02 100644
--- a/components/background_hang_monitor/tests/hang_monitor_tests.rs
+++ b/components/background_hang_monitor/tests/hang_monitor_tests.rs
@@ -4,20 +4,18 @@
#![allow(unused_imports)]
+use std::sync::atomic::{AtomicBool, Ordering};
+use std::sync::{Arc, Mutex};
+use std::thread;
+use std::time::Duration;
+
use background_hang_monitor::HangMonitorRegister;
use ipc_channel::ipc;
-use msg::constellation_msg::ScriptHangAnnotation;
-use msg::constellation_msg::TEST_PIPELINE_ID;
use msg::constellation_msg::{
BackgroundHangMonitorControlMsg, BackgroundHangMonitorExitSignal, HangAlert, HangAnnotation,
- HangMonitorAlert,
+ HangMonitorAlert, MonitoredComponentId, MonitoredComponentType, ScriptHangAnnotation,
+ TEST_PIPELINE_ID,
};
-use msg::constellation_msg::{MonitoredComponentId, MonitoredComponentType};
-use std::sync::atomic::{AtomicBool, Ordering};
-use std::sync::Arc;
-use std::sync::Mutex;
-use std::thread;
-use std::time::Duration;
lazy_static::lazy_static! {
static ref SERIAL: Mutex<()> = Mutex::new(());