Skip to content

Commit aec65bf

Browse files
Stanca Serbanweb-flow
Stanca Serban
authored andcommitted
Backed out changeset 04d0c38e624d (bug 1903981) for causing multiple build bustages. CLOSED TREE
1 parent 5570a54 commit aec65bf

8 files changed

+29
-249
lines changed

webrender/src/clip.rs

+2-55
Original file line numberDiff line numberDiff line change
@@ -187,20 +187,6 @@ impl ClipTree {
187187
}
188188
}
189189

190-
pub fn reset(&mut self) {
191-
self.nodes.clear();
192-
self.nodes.push(ClipTreeNode {
193-
handle: ClipDataHandle::INVALID,
194-
children: Vec::new(),
195-
parent: ClipNodeId::NONE,
196-
});
197-
198-
self.leaves.clear();
199-
200-
self.clip_root_stack.clear();
201-
self.clip_root_stack.push(ClipNodeId::NONE);
202-
}
203-
204190
/// Add a set of clips to the provided tree node id, reusing existing
205191
/// nodes in the tree where possible
206192
fn add_impl(
@@ -444,24 +430,6 @@ impl ClipTreeBuilder {
444430
}
445431
}
446432

447-
pub fn begin(&mut self) {
448-
self.clip_map.clear();
449-
self.clip_chain_map.clear();
450-
self.clip_chains.clear();
451-
self.clip_stack.clear();
452-
self.clip_stack.push(ClipStackEntry {
453-
clip_node_id: ClipNodeId::NONE,
454-
last_clip_chain_cache: None,
455-
seen_clips: FastHashSet::default(),
456-
});
457-
self.tree.reset();
458-
self.clip_handles_buffer.clear();
459-
}
460-
461-
pub fn recycle_tree(&mut self, tree: ClipTree) {
462-
self.tree = tree;
463-
}
464-
465433
/// Define a new rect clip
466434
pub fn define_rect_clip(
467435
&mut self,
@@ -717,15 +685,8 @@ impl ClipTreeBuilder {
717685
}
718686

719687
/// Finalize building and return the clip-tree
720-
pub fn finalize(&mut self) -> ClipTree {
721-
// Note: After this, the builder's clip tree does not hold allocations and
722-
// is not in valid state. `ClipTreeBuilder::begin()` must be called before
723-
// building can happen again.
724-
std::mem::replace(&mut self.tree, ClipTree {
725-
nodes: Vec::new(),
726-
leaves: Vec::new(),
727-
clip_root_stack: Vec::new(),
728-
})
688+
pub fn finalize(self) -> ClipTree {
689+
self.tree
729690
}
730691

731692
/// Get a clip node by id
@@ -1290,14 +1251,6 @@ impl ClipStore {
12901251
}
12911252
}
12921253

1293-
pub fn reset(&mut self) {
1294-
self.clip_node_instances.clear();
1295-
self.mask_tiles.clear();
1296-
self.active_clip_node_info.clear();
1297-
self.active_local_clip_rect = None;
1298-
self.active_pic_coverage_rect = PictureRect::max_rect();
1299-
}
1300-
13011254
pub fn get_instance_from_range(
13021255
&self,
13031256
node_range: &ClipNodeRange,
@@ -1597,12 +1550,6 @@ impl ClipStore {
15971550
}
15981551
}
15991552

1600-
impl Default for ClipStore {
1601-
fn default() -> Self {
1602-
ClipStore::new()
1603-
}
1604-
}
1605-
16061553
// The ClipItemKey is a hashable representation of the contents
16071554
// of a clip item. It is used during interning to de-duplicate
16081555
// clip nodes between frames and display lists. This allows quick

webrender/src/hit_test.rs

-5
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,6 @@ impl HitTestingScene {
179179
}
180180
}
181181

182-
pub fn reset(&mut self) {
183-
self.clip_nodes.clear();
184-
self.items.clear();
185-
}
186-
187182
/// Get stats about the current scene allocation sizes.
188183
pub fn get_stats(&self) -> HitTestingSceneStats {
189184
HitTestingSceneStats {

webrender/src/picture_graph.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pub struct PictureInfo {
1616
pub parent: Option<PictureIndex>,
1717
}
1818

19-
#[derive(Default)]
2019
/// A graph of picture dependencies, allowing updates to be processed without recursion
2120
/// by building a list of passes.
2221
pub struct PictureGraph {
@@ -27,13 +26,11 @@ pub struct PictureGraph {
2726

2827
impl PictureGraph {
2928
pub fn new() -> Self {
30-
PictureGraph::default()
31-
}
32-
33-
pub fn reset(&mut self) {
34-
self.roots.clear();
35-
self.pic_info.clear();
36-
self.update_passes.clear();
29+
PictureGraph {
30+
roots: Vec::new(),
31+
pic_info: Vec::new(),
32+
update_passes: Vec::new(),
33+
}
3734
}
3835

3936
/// Add a root picture to the graph

webrender/src/prim_store/mod.rs

-14
Original file line numberDiff line numberDiff line change
@@ -1471,14 +1471,6 @@ impl PrimitiveStore {
14711471
}
14721472
}
14731473

1474-
pub fn reset(&mut self) {
1475-
self.pictures.clear();
1476-
self.text_runs.clear();
1477-
self.images.clear();
1478-
self.color_bindings.clear();
1479-
self.linear_gradients.clear();
1480-
}
1481-
14821474
pub fn get_stats(&self) -> PrimitiveStoreStats {
14831475
PrimitiveStoreStats {
14841476
picture_count: self.pictures.len(),
@@ -1497,12 +1489,6 @@ impl PrimitiveStore {
14971489
}
14981490
}
14991491

1500-
impl Default for PrimitiveStore {
1501-
fn default() -> Self {
1502-
PrimitiveStore::new(&PrimitiveStoreStats::empty())
1503-
}
1504-
}
1505-
15061492
/// Trait for primitives that are directly internable.
15071493
/// see SceneBuilder::add_primitive<P>
15081494
pub trait InternablePrimitive: intern::Internable<InternData = ()> + Sized {

webrender/src/render_backend.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -667,10 +667,7 @@ impl Document {
667667
resource_cache,
668668
);
669669

670-
671-
let old_scene = std::mem::replace(&mut self.scene, built_scene);
672-
old_scene.recycle();
673-
670+
self.scene = built_scene;
674671
self.scratch.recycle(recycler);
675672
}
676673
}

webrender/src/scene.rs

+1-17
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
use api::{BuiltDisplayList, DisplayListWithCache, ColorF, DynamicProperties, Epoch, FontRenderMode};
66
use api::{PipelineId, PropertyBinding, PropertyBindingId, PropertyValue, MixBlendMode, StackingContext};
77
use api::units::*;
8-
use api::channel::Sender;
98
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
109
use crate::render_api::MemoryReport;
1110
use crate::composite::CompositorKind;
1211
use crate::clip::{ClipStore, ClipTree};
1312
use crate::spatial_tree::SpatialTree;
14-
use crate::frame_builder::FrameBuilderConfig;
13+
use crate::frame_builder::{FrameBuilderConfig};
1514
use crate::hit_test::{HitTester, HitTestingScene, HitTestingSceneStats};
1615
use crate::internal_types::FastHashMap;
1716
use crate::picture::SurfaceInfo;
@@ -285,12 +284,6 @@ pub struct BuiltScene {
285284
pub prim_instances: Vec<PrimitiveInstance>,
286285
pub surfaces: Vec<SurfaceInfo>,
287286
pub clip_tree: ClipTree,
288-
289-
/// Deallocating memory outside of the thread that allocated it causes lock
290-
/// contention in jemalloc. To avoid this we send the built scene back to
291-
/// the scene builder thread when we don't need it anymore, and in the process,
292-
/// also reuse some allocations.
293-
pub recycler_tx: Option<Sender<BuiltScene>>,
294287
}
295288

296289
impl BuiltScene {
@@ -309,7 +302,6 @@ impl BuiltScene {
309302
prim_instances: Vec::new(),
310303
surfaces: Vec::new(),
311304
clip_tree: ClipTree::new(),
312-
recycler_tx: None,
313305
config: FrameBuilderConfig {
314306
default_font_render_mode: FontRenderMode::Mono,
315307
dual_source_blending_is_supported: false,
@@ -334,14 +326,6 @@ impl BuiltScene {
334326
}
335327
}
336328

337-
/// Send the scene back to the scene builder thread so that recycling/deallocations
338-
/// can happen there.
339-
pub fn recycle(mut self) {
340-
if let Some(tx) = self.recycler_tx.take() {
341-
let _ = tx.send(self);
342-
}
343-
}
344-
345329
/// Get the memory usage statistics to pre-allocate for the next scene.
346330
pub fn get_stats(&self) -> SceneStats {
347331
SceneStats {

webrender/src/scene_builder_thread.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::box_shadow::BoxShadow;
1313
#[cfg(feature = "capture")]
1414
use crate::capture::CaptureConfig;
1515
use crate::frame_builder::FrameBuilderConfig;
16-
use crate::scene_building::{SceneBuilder, SceneRecycler};
16+
use crate::scene_building::SceneBuilder;
1717
use crate::clip::{ClipIntern, PolygonIntern};
1818
use crate::filterdata::FilterDataIntern;
1919
use glyph_rasterizer::SharedFontResources;
@@ -30,7 +30,7 @@ use crate::prim_store::text_run::TextRun;
3030
use crate::profiler::{self, TransactionProfile};
3131
use crate::render_backend::SceneView;
3232
use crate::renderer::{FullFrameStats, PipelineInfo};
33-
use crate::scene::{BuiltScene, Scene, SceneStats};
33+
use crate::scene::{Scene, BuiltScene, SceneStats};
3434
use crate::spatial_tree::{SceneSpatialTree, SpatialTreeUpdates};
3535
use crate::telemetry::Telemetry;
3636
use crate::SceneBuilderHooks;
@@ -243,7 +243,6 @@ pub struct SceneBuilderThread {
243243
#[cfg(feature = "capture")]
244244
capture_config: Option<CaptureConfig>,
245245
debug_flags: DebugFlags,
246-
recycler: SceneRecycler,
247246
}
248247

249248
pub struct SceneBuilderThreadChannels {
@@ -289,7 +288,6 @@ impl SceneBuilderThread {
289288
#[cfg(feature = "capture")]
290289
capture_config: None,
291290
debug_flags: DebugFlags::default(),
292-
recycler: SceneRecycler::new(),
293291
}
294292
}
295293

@@ -328,9 +326,6 @@ impl SceneBuilderThread {
328326
_ => {},
329327
}
330328
self.forward_built_transactions(built_txns);
331-
332-
// Now that we off the critical path, do some memory bookkeeping.
333-
self.recycler.recycle_built_scene();
334329
}
335330
Ok(SceneBuilderRequest::AddDocument(document_id, initial_size)) => {
336331
let old = self.documents.insert(document_id, Document::new(
@@ -610,7 +605,6 @@ impl SceneBuilderThread {
610605
&self.config,
611606
&mut doc.interners,
612607
&mut doc.spatial_tree,
613-
&mut self.recycler,
614608
&doc.stats,
615609
self.debug_flags,
616610
);

0 commit comments

Comments
 (0)