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

Don't panic in canvas thread if webrender isn't reachable #26854

Merged
merged 1 commit into from Jun 11, 2020
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -982,7 +982,10 @@ impl<'a> CanvasData<'a> {
updates.push(ImageUpdate::Update(image_key, descriptor, data));
},
None => {
let key = self.webrender_api.generate_key();
let key = match self.webrender_api.generate_key() {
Ok(key) => key,
Err(()) => return,
};
updates.push(ImageUpdate::Add(key, descriptor, data));
self.image_key = Some(key);
debug!("New image {:?}.", self.image_key);
@@ -26,7 +26,7 @@ pub enum ImageUpdate {
}

pub trait WebrenderApi {
fn generate_key(&self) -> webrender_api::ImageKey;
fn generate_key(&self) -> Result<webrender_api::ImageKey, ()>;
fn update_images(&self, updates: Vec<ImageUpdate>);
fn clone(&self) -> Box<dyn WebrenderApi>;
}
@@ -949,12 +949,12 @@ impl gfx_traits::WebrenderApi for FontCacheWR {
struct CanvasWebrenderApi(CompositorProxy);

impl canvas_paint_thread::WebrenderApi for CanvasWebrenderApi {
fn generate_key(&self) -> webrender_api::ImageKey {
fn generate_key(&self) -> Result<webrender_api::ImageKey, ()> {
let (sender, receiver) = unbounded();
let _ = self.0.send(Msg::Webrender(WebrenderMsg::Canvas(
WebrenderCanvasMsg::GenerateKey(sender),
)));
receiver.recv().unwrap()
receiver.recv().map_err(|_| ())
}
fn update_images(&self, updates: Vec<canvas_paint_thread::ImageUpdate>) {
let _ = self.0.send(Msg::Webrender(WebrenderMsg::Canvas(
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.