Auto merge of #11373 - servo:threadfactory, r=larsbergstrom

Use associated types to improve LayoutThreadFactory and ScriptThreadFactory.

Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data:
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy --faster` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

Either:
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because refactoring

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.

<!-- 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/11373)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-05-25 04:25:50 -05:00
commit 586c0702a0
8 changed files with 47 additions and 78 deletions

View file

@ -407,13 +407,11 @@ pub struct UnprivilegedPipelineContent {
}
impl UnprivilegedPipelineContent {
pub fn start_all<LTF, STF>(mut self, wait_for_completion: bool)
where LTF: LayoutThreadFactory,
STF: ScriptThreadFactory
pub fn start_all<Message, LTF, STF>(mut self, wait_for_completion: bool)
where LTF: LayoutThreadFactory<Message=Message>,
STF: ScriptThreadFactory<Message=Message>
{
let layout_pair = STF::create_layout_channel();
STF::create(InitialScriptState {
let layout_pair = STF::create(InitialScriptState {
id: self.id,
parent_info: self.parent_info,
compositor: self.script_to_compositor_chan,
@ -432,7 +430,7 @@ impl UnprivilegedPipelineContent {
window_size: self.window_size,
pipeline_namespace_id: self.pipeline_namespace_id,
content_process_shutdown_chan: self.script_content_process_shutdown_chan.clone(),
}, &layout_pair, self.load_data.clone());
}, self.load_data.clone());
LTF::create(self.id,
self.load_data.url.clone(),