mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
report panic to embedder
This commit is contained in:
parent
d09bb477f9
commit
ee25413c0f
5 changed files with 17 additions and 2 deletions
|
@ -146,6 +146,8 @@ pub enum EmbedderMsg {
|
|||
LoadStart(TopLevelBrowsingContextId),
|
||||
/// The load of a page has completed
|
||||
LoadComplete(TopLevelBrowsingContextId),
|
||||
/// A pipeline panicked. First string is the reason, second one is the backtrace.
|
||||
Panic(TopLevelBrowsingContextId, String, Option<String>),
|
||||
}
|
||||
|
||||
/// Messages from the painting thread and the constellation thread to the compositor thread.
|
||||
|
@ -237,6 +239,7 @@ impl Debug for EmbedderMsg {
|
|||
EmbedderMsg::SetFullscreenState(..) => write!(f, "SetFullscreenState"),
|
||||
EmbedderMsg::LoadStart(..) => write!(f, "LoadStart"),
|
||||
EmbedderMsg::LoadComplete(..) => write!(f, "LoadComplete"),
|
||||
EmbedderMsg::Panic(..) => write!(f, "Panic"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,4 +189,7 @@ pub trait WindowMethods {
|
|||
/// will want to avoid blocking on UI events, and just
|
||||
/// run the event loop at the vsync interval.
|
||||
fn set_animation_state(&self, _state: AnimationState) {}
|
||||
|
||||
/// Called when a pipeline panics.
|
||||
fn handle_panic(&self, browser_id: TopLevelBrowsingContextId, reason: String, backtrace: Option<String>);
|
||||
}
|
||||
|
|
|
@ -1482,7 +1482,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
fn handle_panic(&mut self,
|
||||
top_level_browsing_context_id: TopLevelBrowsingContextId,
|
||||
reason: String,
|
||||
_backtrace: Option<String>)
|
||||
backtrace: Option<String>)
|
||||
{
|
||||
if opts::get().hard_fail {
|
||||
// It's quite difficult to make Servo exit cleanly if some threads have failed.
|
||||
|
@ -1495,7 +1495,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
|
||||
let browsing_context_id = BrowsingContextId::from(top_level_browsing_context_id);
|
||||
|
||||
// FIXME: report to embedder: (top_level_browsing_context_id, reason, backtrace);
|
||||
self.embedder_proxy.send(EmbedderMsg::Panic(top_level_browsing_context_id, reason, backtrace));
|
||||
|
||||
let (window_size, pipeline_id) = {
|
||||
let browsing_context = self.browsing_contexts.get(&browsing_context_id);
|
||||
|
|
|
@ -457,6 +457,11 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static {
|
|||
// TODO(pcwalton): Specify which frame's load completed.
|
||||
self.compositor.window.load_end(top_level_browsing_context);
|
||||
},
|
||||
(EmbedderMsg::Panic(top_level_browsing_context, reason, backtrace),
|
||||
ShutdownState::NotShuttingDown) => {
|
||||
self.compositor.window.handle_panic(top_level_browsing_context, reason, backtrace);
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue