Skip to content

Commit d1e1976

Browse files
committed
Address review comments
1 parent 89ab2e3 commit d1e1976

File tree

4 files changed

+6
-29
lines changed

4 files changed

+6
-29
lines changed

webrender/src/frame_builder.rs

-2
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,9 @@ impl FrameBuilder {
193193
pub fn destroy(
194194
self,
195195
retained_tiles: &mut FastHashMap<TileDescriptor, TextureCacheHandle>,
196-
resource_cache: &ResourceCache,
197196
) {
198197
self.prim_store.destroy(
199198
retained_tiles,
200-
resource_cache,
201199
);
202200
}
203201

webrender/src/picture.rs

+6-22
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,8 @@ impl Tile {
191191

192192
/// Destroy a tile, optionally returning a handle and cache descriptor,
193193
/// if this surface was valid and may be useful on the next scene.
194-
fn destroy(
195-
self,
196-
resource_cache: &ResourceCache,
197-
) -> Option<(TileDescriptor, TextureCacheHandle)> {
198-
if self.is_valid && resource_cache.texture_cache.is_allocated(&self.handle) {
194+
fn destroy(self) -> Option<(TileDescriptor, TextureCacheHandle)> {
195+
if self.is_valid {
199196
Some((self.descriptor, self.handle))
200197
} else {
201198
None
@@ -424,12 +421,6 @@ impl TileCache {
424421
// coordinate system (which is the common case!) then we are effectively drawing
425422
// in a local space anyway, so don't care about that transform for the purposes
426423
// of validating the surface cache contents.
427-
let raster_spatial_node = &frame_context
428-
.clip_scroll_tree
429-
.spatial_nodes[raster_spatial_node_index.0];
430-
let surface_spatial_node = &frame_context
431-
.clip_scroll_tree
432-
.spatial_nodes[surface_spatial_node_index.0];
433424

434425
let mut key = CoordinateSpaceMapping::<LayoutPixel, PicturePixel>::new(
435426
raster_spatial_node_index,
@@ -438,10 +429,8 @@ impl TileCache {
438429
).expect("bug: unable to get coord mapping").into();
439430

440431
if let TransformKey::ScaleOffset(ref mut key) = key {
441-
if raster_spatial_node.coordinate_system_id == surface_spatial_node.coordinate_system_id {
442-
key.offset_x = 0.0;
443-
key.offset_y = 0.0;
444-
}
432+
key.offset_x = 0.0;
433+
key.offset_y = 0.0;
445434
}
446435

447436
key
@@ -873,9 +862,7 @@ impl TileCache {
873862
// TODO(gw): Maybe it's worth keeping them around for a bit longer in
874863
// some cases?
875864
for (_, handle) in retained_tiles.drain() {
876-
if resource_cache.texture_cache.is_allocated(&handle) {
877-
resource_cache.texture_cache.mark_unused(&handle);
878-
}
865+
resource_cache.texture_cache.mark_unused(&handle);
879866
}
880867

881868
self.dirty_region = if dirty_rect.is_empty() {
@@ -1387,14 +1374,11 @@ impl PicturePrimitive {
13871374
pub fn destroy(
13881375
mut self,
13891376
retained_tiles: &mut FastHashMap<TileDescriptor, TextureCacheHandle>,
1390-
resource_cache: &ResourceCache,
13911377
) {
13921378
if let Some(tile_cache) = self.tile_cache.take() {
13931379
debug_assert!(tile_cache.old_tiles.is_empty());
13941380
for tile in tile_cache.tiles {
1395-
if let Some((descriptor, texture_handle)) = tile.destroy(resource_cache) {
1396-
retained_tiles.insert(descriptor, texture_handle);
1397-
}
1381+
retained_tiles.extend(tile.destroy());
13981382
}
13991383
}
14001384
}

webrender/src/prim_store.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2618,12 +2618,10 @@ impl PrimitiveStore {
26182618
pub fn destroy(
26192619
self,
26202620
retained_tiles: &mut FastHashMap<TileDescriptor, TextureCacheHandle>,
2621-
resource_cache: &ResourceCache,
26222621
) {
26232622
for pic in self.pictures {
26242623
pic.destroy(
26252624
retained_tiles,
2626-
resource_cache,
26272625
);
26282626
}
26292627
}

webrender/src/render_backend.rs

-3
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@ impl Document {
506506
pub fn new_async_scene_ready(
507507
&mut self,
508508
mut built_scene: BuiltScene,
509-
resource_cache: &ResourceCache,
510509
) {
511510
self.scene = built_scene.scene;
512511
self.frame_is_valid = false;
@@ -519,7 +518,6 @@ impl Document {
519518
if let Some(frame_builder) = self.frame_builder.take() {
520519
frame_builder.destroy(
521520
&mut retained_tiles,
522-
resource_cache,
523521
);
524522
}
525523

@@ -763,7 +761,6 @@ impl RenderBackend {
763761
if let Some(mut built_scene) = txn.built_scene.take() {
764762
doc.new_async_scene_ready(
765763
built_scene,
766-
&self.resource_cache,
767764
);
768765
}
769766

0 commit comments

Comments
 (0)