Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent app from accessing the GPU in the background in MultiFrameCodec #28159

Merged
merged 3 commits into from Aug 24, 2021

Conversation

ColdPaleLight
Copy link
Member

@ColdPaleLight ColdPaleLight commented Aug 18, 2021

Fix the issue : flutter/flutter#88353

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.

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

Awesome, high quality PR, thanks. I just have a nit to factor out a helper function (feel free to pass if you are tight on time) also you just have to move the comment back where it was.

Comment on lines +131 to +133
// Defer decoding until time of draw later on the raster thread. Can
// happen when GL operations are currently forbidden such as in the
// background on iOS.
Copy link
Member

Choose a reason for hiding this comment

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

This comment goes with the other MakeFromBitmap call.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Comment on lines +815 to +820
runners.GetIOTaskRunner()->PostTask([&]() {
io_manager.reset();
latch.Signal();
});

latch.Wait();
Copy link
Member

Choose a reason for hiding this comment

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

Nit: This pattern of synchronously executing a task happens multiple times in this test. I'd prefer that you pulled out a helper function so the test is easier to parse/maintain. Here's an example here:

void PostUITaskSync(const std::function<void()>& function) {

Copy link
Member Author

Choose a reason for hiding this comment

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

It's indeed a good idea. I will file a PR to do this later.

Copy link
Member

Choose a reason for hiding this comment

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

FWIW this pattern happens so often in code (especially testing code) that I tried to add it to the TaskRunner API but was met with resistance under the fear that it would be misused. That's why I just made it a local method to the test suite.

Copy link
Member Author

Choose a reason for hiding this comment

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

I filed a PR to do this: #28467

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants