Skip to content

Expose nodes needing layout or paint from PipelineOwner #166147

@emerssso

Description

@emerssso

Use case

I'm working on a "session replay" package, where we periodically scan the render tree, redact images and text, and serialize the approximate appearance so that a user session can be later viewed by a product team (as part of user research or similar).

One optimization I'd like to make is to skip subtrees where nothing has changed since our last scan, and reuse the previous serialization. To do this, I would need to know which render objects have been invalidated (roughly, marked for painting or layout) since my last scan.

My team previously proposed https://flutter.dev/go/ondirtycallbacks to solve this. Discussion on that doc led to a decision that a better solution would be to expose PipelineOwner._nodesNeedingLayout and PipelineOwner._nodesNeedingPaint to subclasses, as this solves the same problem in a more performant manner.

Proposal

Add public @protected getters for the existing PipelineOwner._nodesNeedingLayout and PipelineOwner._nodesNeedingPaint so that subclasses may access these fields and use them as part of feature sets which augment the rendering pipeline.

I'll put together a PR for this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions