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

Conversation

@simonla
Copy link
Contributor

@simonla simonla commented Aug 11, 2022

Choreographer.FrameCallback will be called each frame

We should avoid create new object here

There is no need to consider thread safety, it is guaranteed here and here

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
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@simonla
Copy link
Contributor Author

simonla commented Aug 11, 2022

It looks like we will only have one request at same time

So we can hold one FrameCallback instance safely

animator.cc:

  if (!pending_frame_semaphore_.TryWait()) {
    // Multiple calls to Animator::RequestFrame will still result in a
    // single request to the VsyncWaiter.
    return;
  }

@simonla simonla changed the title Avoid create a new object during each frame Avoid object creation during each frame Aug 11, 2022
Copy link
Member

@jason-simmons jason-simmons left a comment

Choose a reason for hiding this comment

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

Is this causing a significant performance issue?

If the cost of these allocations is noticeable, then one option would be using a collection such as Android's SparseLongArray to hold the pending cookies.

@simonla simonla requested a review from jason-simmons August 17, 2022 06:24
@jason-simmons jason-simmons added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 17, 2022
@auto-submit
Copy link
Contributor

auto-submit bot commented Aug 17, 2022

  • Please get at least one approved review if you are already a member or two member reviews if you are not a member before re-applying this label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@auto-submit
Copy link
Contributor

auto-submit bot commented Aug 17, 2022

Validations Fail.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 17, 2022
@simonla
Copy link
Contributor Author

simonla commented Aug 18, 2022

Validations Fail.

@jason-simmons help~ 👀

@dnfield
Copy link
Contributor

dnfield commented Aug 18, 2022

@simonla this needed a second reviewer, I've approved. Asking for a NTE from @Hixie

@Hixie
Copy link
Contributor

Hixie commented Aug 18, 2022

test-exempt: code refactor with no semantic change

@simonla
Copy link
Contributor Author

simonla commented Aug 18, 2022

@jason-simmons Got test-exempt and two approver. Would you mind helping me add the autosubmit tag again?

@jason-simmons jason-simmons added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 18, 2022
@auto-submit auto-submit bot merged commit e14d885 into flutter:main Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App needs tests platform-android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants