mirror of
https://github.com/servo/servo.git
synced 2025-07-25 16:20:36 +01:00
Auto merge of #10902 - asajeffrey:remove-explicit-panic-from-compositor, r=aneeshusa
Remove panic! from the compositor Fixes #10864, and adds a check to `/etc/ci/check_no_unwrap.sh`. r? @aneeshusa <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10902) <!-- Reviewable:end -->
This commit is contained in:
commit
f75fa5283e
3 changed files with 14 additions and 7 deletions
|
@ -504,8 +504,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
|
||||
fn handle_browser_message(&mut self, msg: Msg) -> bool {
|
||||
match (msg, self.shutdown_state) {
|
||||
(_, ShutdownState::FinishedShuttingDown) =>
|
||||
panic!("compositor shouldn't be handling messages after shutting down"),
|
||||
(_, ShutdownState::FinishedShuttingDown) => {
|
||||
error!("compositor shouldn't be handling messages after shutting down");
|
||||
return false
|
||||
}
|
||||
|
||||
(Msg::Exit(channel), _) => {
|
||||
self.start_shutting_down();
|
||||
|
@ -780,7 +782,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
pub fn pipeline(&self, pipeline_id: PipelineId) -> Option<&CompositionPipeline> {
|
||||
match self.pipeline_details.get(&pipeline_id) {
|
||||
Some(ref details) => details.pipeline.as_ref(),
|
||||
None => panic!("Compositor layer has an unknown pipeline ({:?}).", pipeline_id),
|
||||
None => {
|
||||
warn!("Compositor layer has an unknown pipeline ({:?}).", pipeline_id);
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -881,7 +886,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
fn find_pipeline_root_layer(&self, pipeline_id: PipelineId)
|
||||
-> Option<Rc<Layer<CompositorData>>> {
|
||||
if !self.pipeline_details.contains_key(&pipeline_id) {
|
||||
panic!("Tried to create or update layer for unknown pipeline")
|
||||
warn!("Tried to create or update layer for unknown pipeline");
|
||||
return None;
|
||||
}
|
||||
self.find_layer_with_pipeline_and_layer_id(pipeline_id, LayerId::null())
|
||||
}
|
||||
|
@ -1119,7 +1125,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
layer_id: LayerId) {
|
||||
if let Some(point) = self.fragment_point.take() {
|
||||
if !self.move_layer(pipeline_id, layer_id, Point2D::from_untyped(&point)) {
|
||||
panic!("Compositor: Tried to scroll to fragment with unknown layer.");
|
||||
return warn!("Compositor: Tried to scroll to fragment with unknown layer.");
|
||||
}
|
||||
|
||||
self.perform_updates_after_scroll();
|
||||
|
|
|
@ -505,7 +505,8 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
|
||||
#[cfg(target_os = "windows")]
|
||||
fn spawn_multiprocess(&mut self, _: PipelineId, _: UnprivilegedPipelineContent) {
|
||||
panic!("Multiprocess is not supported on Windows.");
|
||||
error!("Multiprocess is not supported on Windows.");
|
||||
process::exit(1);
|
||||
}
|
||||
|
||||
// Push a new (loading) pipeline to the list of pending frame changes
|
||||
|
|
|
@ -12,4 +12,4 @@ FILES=("components/compositing/compositor.rs"
|
|||
"components/compositing/pipeline.rs"
|
||||
"components/compositing/constellation.rs")
|
||||
|
||||
! grep -n "unwrap(" "${FILES[@]}"
|
||||
! grep -n "unwrap(\|panic!(" "${FILES[@]}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue