Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the select macro on the paint thread. #9493

Merged
merged 1 commit into from Feb 3, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Use the select macro on the paint thread.

  • Loading branch information
Ms2ger committed Feb 1, 2016
commit 2fd53c266e3a550a10fffc163caf98dee779e19d
@@ -30,7 +30,7 @@ use std::borrow::ToOwned;
use std::collections::HashMap;
use std::mem as std_mem;
use std::sync::Arc;
use std::sync::mpsc::{Receiver, Select, Sender, channel};
use std::sync::mpsc::{Receiver, Sender, channel};
use url::Url;
use util::geometry::{ExpandToPixelBoundaries};
use util::opts;
@@ -301,20 +301,13 @@ impl<C> PaintThread<C> where C: PaintListener + Send + 'static {

loop {
let message = {
let select = Select::new();
let mut layout_to_paint_handle = select.handle(&self.layout_to_paint_port);
let mut chrome_to_paint_handle = select.handle(&self.chrome_to_paint_port);
unsafe {
layout_to_paint_handle.add();
chrome_to_paint_handle.add();
}
let result = select.wait();
if result == layout_to_paint_handle.id() {
Msg::FromLayout(self.layout_to_paint_port.recv().unwrap())
} else if result == chrome_to_paint_handle.id() {
Msg::FromChrome(self.chrome_to_paint_port.recv().unwrap())
} else {
panic!("unexpected select result")
let layout_to_paint = &self.layout_to_paint_port;
let chrome_to_paint = &self.chrome_to_paint_port;
select! {
msg = layout_to_paint.recv() =>
Msg::FromLayout(msg.unwrap()),
msg = chrome_to_paint.recv() =>
Msg::FromChrome(msg.unwrap())
}
};

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.