Auto merge of #342 - pcwalton:listener-lifetime, r=pcwalton

Don't restrict render command listeners to the static lifetime
This commit is contained in:
bors-servo 2020-05-16 14:05:57 -04:00 committed by GitHub
commit 0f35009215
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -43,7 +43,7 @@ pub(crate) struct SceneBuilder<'a, 'b> {
scene: &'a mut Scene, scene: &'a mut Scene,
built_options: &'b PreparedBuildOptions, built_options: &'b PreparedBuildOptions,
next_alpha_tile_indices: [AtomicUsize; ALPHA_TILE_LEVEL_COUNT], next_alpha_tile_indices: [AtomicUsize; ALPHA_TILE_LEVEL_COUNT],
pub(crate) listener: Box<dyn RenderCommandListener>, pub(crate) listener: Box<dyn RenderCommandListener + 'a>,
} }
#[derive(Debug)] #[derive(Debug)]
@ -102,8 +102,9 @@ impl<'a, 'b> SceneBuilder<'a, 'b> {
pub(crate) fn new( pub(crate) fn new(
scene: &'a mut Scene, scene: &'a mut Scene,
built_options: &'b PreparedBuildOptions, built_options: &'b PreparedBuildOptions,
listener: Box<dyn RenderCommandListener>, listener: Box<dyn RenderCommandListener + 'a>,
) -> SceneBuilder<'a, 'b> { ) -> SceneBuilder<'a, 'b> {
let effective_view_box = scene.effective_view_box(built_options);
SceneBuilder { SceneBuilder {
scene, scene,
built_options, built_options,

View File

@ -238,9 +238,9 @@ impl Scene {
} }
#[inline] #[inline]
pub fn build<E>(&mut self, pub fn build<'a, E>(&mut self,
options: BuildOptions, options: BuildOptions,
listener: Box<dyn RenderCommandListener>, listener: Box<dyn RenderCommandListener + 'a>,
executor: &E) executor: &E)
where E: Executor { where E: Executor {
let prepared_options = options.prepare(self.bounds); let prepared_options = options.prepare(self.bounds);