diff options
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/bindings/global.rs | 10 | ||||
-rw-r--r-- | components/script/dom/dedicatedworkerglobalscope.rs | 12 | ||||
-rw-r--r-- | components/script/dom/htmliframeelement.rs | 4 | ||||
-rw-r--r-- | components/script/dom/window.rs | 11 | ||||
-rw-r--r-- | components/script/dom/workerglobalscope.rs | 11 | ||||
-rw-r--r-- | components/script/script_thread.rs | 18 |
6 files changed, 18 insertions, 48 deletions
diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs index 5adcbb67818..fe81b8a14de 100644 --- a/components/script/dom/bindings/global.rs +++ b/components/script/dom/bindings/global.rs @@ -18,7 +18,7 @@ use ipc_channel::ipc::IpcSender; use js::jsapi::{CurrentGlobalOrNull, GetGlobalForObjectCrossCompartment}; use js::jsapi::{JSContext, JSObject, JS_GetClass, MutableHandleValue}; use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL}; -use msg::constellation_msg::{PipelineId, PanicMsg}; +use msg::constellation_msg::PipelineId; use net_traits::filemanager_thread::FileManagerThreadMsg; use net_traits::{ResourceThreads, CoreResourceThread, IpcSend}; use profile_traits::{mem, time}; @@ -283,14 +283,6 @@ impl<'a> GlobalRef<'a> { } } - /// Returns an `IpcSender` to report panics on. - pub fn panic_chan(&self) -> &IpcSender<PanicMsg> { - match *self { - GlobalRef::Window(ref window) => window.panic_chan(), - GlobalRef::Worker(ref worker) => worker.panic_chan(), - } - } - /// Returns a wrapper for runnables to ensure they are cancelled if the global /// is being destroyed. pub fn get_runnable_wrapper(&self) -> RunnableWrapper { diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index cf5537676e0..b65fd72ab62 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -38,8 +38,8 @@ use std::sync::atomic::AtomicBool; use std::sync::mpsc::{Receiver, RecvError, Select, Sender, channel}; use std::sync::{Arc, Mutex}; use url::Url; -use util::thread::spawn_named_with_send_on_panic; -use util::thread_state::{IN_WORKER, SCRIPT}; +use util::thread::spawn_named; +use util::thread_state; /// Set the `worker` field of a related DedicatedWorkerGlobalScope object to a particular /// value for the duration of this object's lifetime. This ensures that the related Worker @@ -161,8 +161,10 @@ impl DedicatedWorkerGlobalScope { closing: Arc<AtomicBool>) { let serialized_worker_url = worker_url.to_string(); let name = format!("WebWorker for {}", serialized_worker_url); - let panic_chan = init.panic_chan.clone(); - spawn_named_with_send_on_panic(name, SCRIPT | IN_WORKER, move || { + spawn_named(name, move || { + thread_state::initialize(thread_state::SCRIPT | thread_state::IN_WORKER); + PipelineId::install(id); + let roots = RootCollection::new(); let _stack_roots_tls = StackRootTLS::new(&roots); let (url, source) = match load_whole_resource(LoadContext::Script, @@ -225,7 +227,7 @@ impl DedicatedWorkerGlobalScope { global.handle_event(event); } }, reporter_name, parent_sender, CommonScriptMsg::CollectReports); - }, Some(id.clone()), panic_chan); + }); } pub fn script_chan(&self) -> Box<ScriptChan + Send> { diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 1b2001c08df..efd33eecf54 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -353,8 +353,8 @@ unsafe fn build_mozbrowser_event_detail(event: MozBrowserEvent, MozBrowserEvent::Error(error_type, description, report) => { BrowserElementErrorEventDetail { type_: Some(DOMString::from(error_type.name())), - description: description.map(DOMString::from), - report: report.map(DOMString::from), + description: Some(DOMString::from(description)), + report: Some(DOMString::from(report)), version: Some(DOMString::from_string(servo_version().into())), }.to_jsval(cx, rval); }, diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 07509a92e4a..b4984bb2a4a 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -45,7 +45,7 @@ use js::jsapi::{JS_GetRuntime, JS_GC, MutableHandleValue, SetWindowProxy}; use js::rust::CompileOptionsWrapper; use js::rust::Runtime; use libc; -use msg::constellation_msg::{FrameType, LoadData, PanicMsg, PipelineId, SubpageId, WindowSizeType}; +use msg::constellation_msg::{FrameType, LoadData, PipelineId, SubpageId, WindowSizeType}; use net_traits::ResourceThreads; use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread}; @@ -266,9 +266,6 @@ pub struct Window { /// A list of scroll offsets for each scrollable element. scroll_offsets: DOMRefCell<HashMap<UntrustedNodeAddress, Point2D<f32>>>, - - #[ignore_heap_size_of = "Defined in ipc-channel"] - panic_chan: IpcSender<PanicMsg>, } impl Window { @@ -1424,10 +1421,6 @@ impl Window { &self.scheduler_chan } - pub fn panic_chan(&self) -> &IpcSender<PanicMsg> { - &self.panic_chan - } - pub fn schedule_callback(&self, callback: OneshotTimerCallback, duration: MsDuration) -> OneshotTimerHandle { self.timers.schedule_callback(callback, duration, @@ -1623,7 +1616,6 @@ impl Window { constellation_chan: IpcSender<ConstellationMsg>, control_chan: IpcSender<ConstellationControlMsg>, scheduler_chan: IpcSender<TimerEventRequest>, - panic_chan: IpcSender<PanicMsg>, timer_event_chan: IpcSender<TimerEvent>, layout_chan: Sender<Msg>, id: PipelineId, @@ -1693,7 +1685,6 @@ impl Window { ignore_further_async_events: Arc::new(AtomicBool::new(false)), error_reporter: error_reporter, scroll_offsets: DOMRefCell::new(HashMap::new()), - panic_chan: panic_chan, }; WindowBinding::Wrap(runtime.cx(), win) diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index cd8476b49d6..154705fe145 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -23,7 +23,7 @@ use ipc_channel::ipc::IpcSender; use js::jsapi::{HandleValue, JSContext, JSRuntime}; use js::jsval::UndefinedValue; use js::rust::Runtime; -use msg::constellation_msg::{PipelineId, ReferrerPolicy, PanicMsg}; +use msg::constellation_msg::{PipelineId, ReferrerPolicy}; use net_traits::{LoadContext, ResourceThreads, load_whole_resource}; use net_traits::{LoadOrigin, IpcSend}; use profile_traits::{mem, time}; @@ -58,7 +58,6 @@ pub fn prepare_workerscope_init(global: GlobalRef, time_profiler_chan: global.time_profiler_chan().clone(), from_devtools_sender: devtools_sender, constellation_chan: global.constellation_chan().clone(), - panic_chan: global.panic_chan().clone(), scheduler_chan: global.scheduler_chan().clone(), worker_id: worker_id }; @@ -110,9 +109,6 @@ pub struct WorkerGlobalScope { #[ignore_heap_size_of = "Defined in std"] scheduler_chan: IpcSender<TimerEventRequest>, - - #[ignore_heap_size_of = "Defined in ipc-channel"] - panic_chan: IpcSender<PanicMsg>, } impl WorkerGlobalScope { @@ -144,7 +140,6 @@ impl WorkerGlobalScope { devtools_wants_updates: Cell::new(false), constellation_chan: init.constellation_chan, scheduler_chan: init.scheduler_chan, - panic_chan: init.panic_chan, } } @@ -221,10 +216,6 @@ impl WorkerGlobalScope { worker_id } - pub fn panic_chan(&self) -> &IpcSender<PanicMsg> { - &self.panic_chan - } - pub fn get_runnable_wrapper(&self) -> RunnableWrapper { RunnableWrapper { cancelled: self.closing.clone().unwrap(), diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 1a32477b999..cf0cebf5a65 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -64,7 +64,7 @@ use js::jsapi::{JSTracer, SetWindowProxyClass}; use js::jsval::UndefinedValue; use js::rust::Runtime; use mem::heap_size_of_self_and_children; -use msg::constellation_msg::{FrameType, LoadData, PanicMsg, PipelineId, PipelineNamespace}; +use msg::constellation_msg::{FrameType, LoadData, PipelineId, PipelineNamespace}; use msg::constellation_msg::{SubpageId, WindowSizeType, ReferrerPolicy}; use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCacheThread}; @@ -393,8 +393,6 @@ pub struct ScriptThread { timer_event_port: Receiver<TimerEvent>, content_process_shutdown_chan: IpcSender<()>, - - panic_chan: IpcSender<PanicMsg>, } /// In the event of thread panic, all data on the stack runs its destructor. However, there @@ -441,15 +439,15 @@ impl ScriptThreadFactory for ScriptThread { fn create(state: InitialScriptState, load_data: LoadData) -> (Sender<message::Msg>, Receiver<message::Msg>) { - let panic_chan = state.panic_chan.clone(); let (script_chan, script_port) = channel(); let (sender, receiver) = channel(); let layout_chan = sender.clone(); let pipeline_id = state.id; - thread::spawn_named_with_send_on_panic(format!("ScriptThread {:?}", state.id), - thread_state::SCRIPT, - move || { + thread::spawn_named(format!("ScriptThread {:?}", state.id), + move || { + thread_state::initialize(thread_state::SCRIPT); + PipelineId::install(pipeline_id); PipelineNamespace::install(state.pipeline_namespace_id); let roots = RootCollection::new(); let _stack_roots_tls = StackRootTLS::new(&roots); @@ -479,7 +477,7 @@ impl ScriptThreadFactory for ScriptThread { // This must always be the very last operation performed before the thread completes failsafe.neuter(); - }, Some(pipeline_id), panic_chan); + }); (sender, receiver) } @@ -592,7 +590,6 @@ impl ScriptThread { constellation_chan: state.constellation_chan, time_profiler_chan: state.time_profiler_chan, mem_profiler_chan: state.mem_profiler_chan, - panic_chan: state.panic_chan, devtools_chan: state.devtools_chan, devtools_port: devtools_port, @@ -1142,7 +1139,6 @@ impl ScriptThread { frame_type, load_data, paint_chan, - panic_chan, pipeline_port, layout_to_constellation_chan, content_process_shutdown_chan, @@ -1158,7 +1154,6 @@ impl ScriptThread { layout_pair: layout_pair, pipeline_port: pipeline_port, constellation_chan: layout_to_constellation_chan, - panic_chan: panic_chan, paint_chan: paint_chan, script_chan: self.control_chan.clone(), image_cache_thread: self.image_cache_thread.clone(), @@ -1603,7 +1598,6 @@ impl ScriptThread { self.constellation_chan.clone(), self.control_chan.clone(), self.scheduler_chan.clone(), - self.panic_chan.clone(), ipc_timer_event_chan, incomplete.layout_chan, incomplete.pipeline_id, |