Skip to content

Commit

Permalink
Auto merge of #10534 - asajeffrey:reenable-check-no-unwrap, r=Manishe…
Browse files Browse the repository at this point in the history
…arth

Re-enabled etc/ci/check_no_unwrap

Got `etc/ci/check_no_unwrap.sh` to pass, and re-enabled it.

<!-- 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/10534)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Apr 12, 2016
2 parents ac06293 + d01c312 commit a61fc52
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -14,6 +14,7 @@ matrix:
- ./mach build -d --verbose
- ./mach test-unit
- ./mach test-compiletest
- bash etc/ci/check_no_unwrap.sh
- bash etc/ci/lockfile_changed.sh
- bash etc/ci/manifest_changed.sh
cache:
Expand Down
4 changes: 2 additions & 2 deletions components/compositing/compositor.rs
Expand Up @@ -755,7 +755,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
if !self.pipeline_details.contains_key(&pipeline_id) {
self.pipeline_details.insert(pipeline_id, PipelineDetails::new());
}
self.pipeline_details.get_mut(&pipeline_id).unwrap()
self.pipeline_details.get_mut(&pipeline_id).expect("Insert then get failed!")
}

pub fn pipeline(&self, pipeline_id: PipelineId) -> Option<&CompositionPipeline> {
Expand Down Expand Up @@ -2191,7 +2191,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
let src_slice = &orig_pixels[src_start .. src_start + stride];
(&mut pixels[dst_start .. dst_start + stride]).clone_from_slice(&src_slice[..stride]);
}
RgbImage::from_raw(width as u32, height as u32, pixels).unwrap()
RgbImage::from_raw(width as u32, height as u32, pixels).expect("Flipping image failed!")
}

fn composite_if_necessary(&mut self, reason: CompositingReason) {
Expand Down
38 changes: 23 additions & 15 deletions components/compositing/constellation.rs
Expand Up @@ -461,25 +461,28 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
// avoiding this panic would require a mechanism for dealing
// with low-resource scenarios.
let (server, token) =
IpcOneShotServer::<IpcSender<UnprivilegedPipelineContent>>::new().unwrap();
IpcOneShotServer::<IpcSender<UnprivilegedPipelineContent>>::new()
.expect("Failed to create IPC one-shot server.");

// If there is a sandbox, use the `gaol` API to create the child process.
let child_process = if opts::get().sandbox {
let mut command = sandbox::Command::me().unwrap();
let mut command = sandbox::Command::me().expect("Failed to get current sandbox.");
command.arg("--content-process").arg(token);
let profile = sandboxing::content_process_sandbox_profile();
ChildProcess::Sandboxed(Sandbox::new(profile).start(&mut command).expect(
"Failed to start sandboxed child process!"))
ChildProcess::Sandboxed(Sandbox::new(profile).start(&mut command)
.expect("Failed to start sandboxed child process!"))
} else {
let path_to_self = env::current_exe().unwrap();
let path_to_self = env::current_exe()
.expect("Failed to get current executor.");
let mut child_process = process::Command::new(path_to_self);
child_process.arg("--content-process");
child_process.arg(token);
ChildProcess::Unsandboxed(child_process.spawn().unwrap())
ChildProcess::Unsandboxed(child_process.spawn()
.expect("Failed to start unsandboxed child process!"))
};

self.child_processes.push(child_process);
let (_receiver, sender) = server.accept().unwrap();
let (_receiver, sender) = server.accept().expect("Server failed to accept.");
sender.send(unprivileged_pipeline_content)
.unwrap_or_else(|_| self.handle_send_error(pipeline_id));
}
Expand Down Expand Up @@ -832,7 +835,8 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
// It's quite difficult to make Servo exit cleanly if some threads have failed.
// Hard fail exists for test runners so we crash and that's good enough.
let mut stderr = io::stderr();
stderr.write_all("Pipeline failed in hard-fail mode. Crashing!\n".as_bytes()).unwrap();
stderr.write_all("Pipeline failed in hard-fail mode. Crashing!\n".as_bytes())
.expect("Failed to write to stderr!");
process::exit(1);
}

Expand Down Expand Up @@ -1618,7 +1622,7 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
// before we check whether the document is ready; otherwise,
// there's a race condition where a webfont has finished loading,
// but hasn't yet notified the document.
let (sender, receiver) = ipc::channel().unwrap();
let (sender, receiver) = ipc::channel().expect("Failed to create IPC channel!");
let msg = LayoutControlMsg::GetWebFontLoadState(sender);
pipeline.layout_chan.0.send(msg)
.unwrap_or_else(|e| debug!("Get web font failed ({})", e));
Expand Down Expand Up @@ -1654,12 +1658,16 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
// epoch matches what the compositor has drawn. If they match
// (and script is idle) then this pipeline won't change again
// and can be considered stable.
let (sender, receiver) = ipc::channel().unwrap();
let (sender, receiver) = ipc::channel().expect("Failed to create IPC channel!");
let LayoutControlChan(ref layout_chan) = pipeline.layout_chan;
layout_chan.send(LayoutControlMsg::GetCurrentEpoch(sender)).unwrap();
let layout_thread_epoch = receiver.recv().unwrap();
if layout_thread_epoch != *compositor_epoch {
return ReadyToSave::EpochMismatch;
if let Err(e) = layout_chan.send(LayoutControlMsg::GetCurrentEpoch(sender)) {
warn!("Failed to send GetCurrentEpoch ({}).", e);
}
match receiver.recv() {
Err(e) => warn!("Failed to receive current epoch ({}).", e),
Ok(layout_thread_epoch) => if layout_thread_epoch != *compositor_epoch {
return ReadyToSave::EpochMismatch;
},
}
}
None => {
Expand Down Expand Up @@ -1835,7 +1843,7 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
if let Some(root_frame_id) = self.root_frame_id {
if let Some(frame_tree) = self.frame_to_sendable(root_frame_id) {

let (chan, port) = ipc::channel().unwrap();
let (chan, port) = ipc::channel().expect("Failed to create IPC channel!");
self.compositor_proxy.send(ToCompositorMsg::SetFrameTree(frame_tree,
chan,
self.compositor_sender.clone()));
Expand Down

0 comments on commit a61fc52

Please sign in to comment.