Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@harryterkelsen
Copy link
Contributor

Releases overlays back to the cache at the end of the frame so they can be used by platform views in the next frame.

Fixes flutter/flutter#87245

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added the platform-web Code specifically for the web engine label Aug 9, 2021
@google-cla google-cla bot added the cla: yes label Aug 9, 2021
@harryterkelsen harryterkelsen requested a review from yjbanov August 9, 2021 23:26

// Returns [true] if this [surface] is in the DOM.
static bool _isInDom(Surface surface) {
return surface.htmlElement.parent != null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's any better but there's also the isConnected: https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected

I'm also getting a feeling that the fact that we're reading back from the DOM indicates a design issue somewhere. I feel like we should know whether the surface is in use or not without the readback 🤔 Can't think of any specific harm in this; just a feeling.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only included it so that I could quickly remove all overlays from the DOM before recreating the scene. A quick check shows that calling remove on an Element that isn't in the DOM is fine, so I'll just get rid of this check.

@harryterkelsen
Copy link
Contributor Author

PTAL

@harryterkelsen harryterkelsen requested a review from yjbanov August 10, 2021 20:33
Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

/// engine to release the surfaces at the end of the frame so they are ready
/// to be used in the next frame, but still used for painting in the current
/// frame.
void releaseSurfaces() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: how about call it releaseUnusedSurfaces?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes platform-web Code specifically for the web engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Web][Canvaskit]: Rendering breaks when several links are on the page

2 participants