Auto merge of #8355 - Ms2ger:Exit, r=nox

Cleanup exit messages and related code.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8355)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-11-07 22:34:45 +05:30
commit 9a465c5842
8 changed files with 46 additions and 54 deletions

View file

@ -25,7 +25,7 @@ use msg::compositor_msg::Epoch;
use msg::constellation_msg::AnimationState;
use msg::constellation_msg::Msg as ConstellationMsg;
use msg::constellation_msg::WebDriverCommandMsg;
use msg::constellation_msg::{FrameId, PipelineExitType, PipelineId};
use msg::constellation_msg::{FrameId, PipelineId};
use msg::constellation_msg::{IframeLoadInfo, IFrameSandboxState, MozBrowserEvent, NavigationDirection};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId};
@ -565,7 +565,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
fn handle_exit(&mut self) {
for (_id, ref pipeline) in &self.pipelines {
pipeline.exit(PipelineExitType::Complete);
pipeline.exit();
}
self.image_cache_task.exit();
self.resource_task.send(net_traits::ControlMsg::Exit).unwrap();
@ -1356,7 +1356,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
// Inform script, compositor that this pipeline has exited.
match exit_mode {
ExitPipelineMode::Normal => pipeline.exit(PipelineExitType::PipelineOnly),
ExitPipelineMode::Normal => pipeline.exit(),
ExitPipelineMode::Force => pipeline.force_exit(),
}
}

View file

@ -15,7 +15,7 @@ use ipc_channel::router::ROUTER;
use layers::geometry::DevicePixel;
use layout_traits::{LayoutControlChan, LayoutTaskFactory};
use msg::constellation_msg::{ConstellationChan, Failure, FrameId, PipelineId, SubpageId};
use msg::constellation_msg::{LoadData, MozBrowserEvent, PipelineExitType, WindowSizeData};
use msg::constellation_msg::{LoadData, MozBrowserEvent, WindowSizeData};
use msg::constellation_msg::{PipelineNamespaceId};
use net_traits::ResourceTask;
use net_traits::image_cache_task::ImageCacheTask;
@ -248,13 +248,13 @@ impl Pipeline {
let _ = self.chrome_to_paint_chan.send(ChromeToPaintMsg::PaintPermissionRevoked);
}
pub fn exit(&self, exit_type: PipelineExitType) {
pub fn exit(&self) {
debug!("pipeline {:?} exiting", self.id);
// Script task handles shutting down layout, and layout handles shutting down the painter.
// For now, if the script task has failed, we give up on clean shutdown.
if self.script_chan
.send(ConstellationControlMsg::ExitPipeline(self.id, exit_type))
.send(ConstellationControlMsg::ExitPipeline(self.id))
.is_ok() {
// Wait until all slave tasks have terminated and run destructors
// NOTE: We don't wait for script task as we don't always own it
@ -275,15 +275,10 @@ impl Pipeline {
}
pub fn force_exit(&self) {
let _ = self.script_chan.send(
ConstellationControlMsg::ExitPipeline(self.id,
PipelineExitType::PipelineOnly)).unwrap();
let _ = self.chrome_to_paint_chan.send(ChromeToPaintMsg::Exit(
None,
PipelineExitType::PipelineOnly));
let _ = self.script_chan.send(ConstellationControlMsg::ExitPipeline(self.id)).unwrap();
let _ = self.chrome_to_paint_chan.send(ChromeToPaintMsg::Exit);
let LayoutControlChan(ref layout_channel) = self.layout_chan;
let _ = layout_channel.send(
LayoutControlMsg::ExitNow(PipelineExitType::PipelineOnly)).unwrap();
let _ = layout_channel.send(LayoutControlMsg::ExitNow).unwrap();
}
pub fn to_sendable(&self) -> CompositionPipeline {