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

Conversation

@dnfield
Copy link
Contributor

@dnfield dnfield commented Jun 16, 2023

Fixes flutter/flutter#128746

Prints a warning the first time a platform channel sends a message from the wrong thread with instructions/link to the site about how to fix this.

@dnfield dnfield requested a review from gaaclarke June 16, 2023 17:51
@dnfield
Copy link
Contributor Author

dnfield commented Jun 16, 2023

Most of this change is related to making logging/thread checking testable.

std::unique_ptr<PlatformMessage> message) {
FML_DCHECK(is_setup_);
FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread());
if (!task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The heart of the change.

Previously this was only a DCHECK, which helps engine developers but not plugin developers/users.

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.

This is on the right track. I just want us to be careful and do the threading right. I don't want use to crash in weird ways just so we can get better messaging.

fml/logging.cc Outdated
}

// static
std::shared_ptr<std::ostringstream> LogMessage::test_stream_ = nullptr;
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

This still is doesn't conform to the c++ style guide. Probably the easiest thing to do would be std::optional<std::ostringstream&>. You could technically get a dangling pointer, but it's up do you if you think it's worth having a raii wrapper.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's thread_local now right?

Copy link
Member

Choose a reason for hiding this comment

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

The current state of your code? yea.

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.

LGTM, thanks!

@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 20, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Jun 20, 2023

auto label is removed for flutter/engine, pr: 42928, due to - The status or check suite Windows windows_unopt has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 20, 2023
@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 20, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 20, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Jun 20, 2023

auto label is removed for flutter/engine, pr: 42928, due to - The status or check suite Linux Fuchsia FEMU has failed. Please fix the issues identified (or deflake) before re-applying this label.

@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 22, 2023
@auto-submit auto-submit bot merged commit 3f4c503 into flutter:main Jun 22, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 22, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 22, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jun 22, 2023
…129378)

flutter/engine@703c9a1...ed477de

2023-06-22 [email protected] Roll ANGLE from bbcf54bcb738 to 4ed2d403a329 (7 revisions) (flutter/engine#43105)
2023-06-22 [email protected] Workaround a release blocker after libc++ change (flutter/engine#43091)
2023-06-22 [email protected] Roll Skia from 8168c802c391 to 09b36b8ce0db (1 revision) (flutter/engine#43102)
2023-06-22 [email protected] [Impeller] Reland: Correctly compute UVs in texture fill (flutter/engine#43093)
2023-06-22 [email protected] [Impeller] Add validation forbidding SamplerAddressMode::kDecal on the OpenGLES backend (flutter/engine#43094)
2023-06-22 [email protected] Use minor version, ignore patches for CodeQL (flutter/engine#43088)
2023-06-22 [email protected] Print a warning when a message channel is used on the wrong thread. (flutter/engine#42928)
2023-06-22 [email protected] Roll Skia from 3f3e1da4b7eb to 8168c802c391 (4 revisions) (flutter/engine#43096)
2023-06-22 [email protected] [Impeller] default sample count back to 1 (but configure to 4 in defaults). (flutter/engine#43089)
2023-06-22 [email protected] [web] Don't get break type from v8BreakIterator (flutter/engine#43053)
2023-06-22 [email protected] Roll dart to 3.1.0-239.0.dev (flutter/engine#43083)
2023-06-22 [email protected] Revert "[Impeller] dont use concurrent runner to decode images on Android." (flutter/engine#43061)
2023-06-22 [email protected] [Impeller] Add fence waiter trace event. (flutter/engine#43092)
2023-06-22 [email protected] [Impeller] remove Vulkan pipeline cache mutex. (flutter/engine#43085)
2023-06-22 [email protected] Revert "[Impeller] Correctly compute UVs in texture fill" (flutter/engine#43087)
2023-06-22 [email protected] Roll Fuchsia Linux SDK from 7EZeNE4aGd29VfDly... to tcVndpnH_jzGm5LsJ... (flutter/engine#43081)
2023-06-22 [email protected] Roll Skia from 117f57a53215 to 3f3e1da4b7eb (4 revisions) (flutter/engine#43080)
2023-06-22 [email protected] Roll ANGLE from 7658525166a4 to bbcf54bcb738 (1 revision) (flutter/engine#43079)
2023-06-22 [email protected] Roll Skia from 5013b651f8ec to 117f57a53215 (1 revision) (flutter/engine#43078)
2023-06-22 [email protected] Roll Fuchsia Mac SDK from QtQznuUmHMTyORqxJ... to Ylc35wOk0_j0NLzDv... (flutter/engine#43076)
2023-06-22 [email protected] Roll ANGLE from a2b3f9b64670 to 7658525166a4 (1 revision) (flutter/engine#43075)
2023-06-22 [email protected] Roll ANGLE from ac263582dda4 to a2b3f9b64670 (1 revision) (flutter/engine#43074)
2023-06-22 [email protected] Roll Skia from 71047dca9f77 to 5013b651f8ec (4 revisions) (flutter/engine#43073)
2023-06-22 [email protected] [Impeller] Correctly compute UVs in texture fill (flutter/engine#43028)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from 7EZeNE4aGd29 to tcVndpnH_jzG
  fuchsia/sdk/core/mac-amd64 from QtQznuUmHMTy to Ylc35wOk0_j0

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@dnfield dnfield deleted the pviewthread branch July 5, 2023 20:32
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Platform messages on iOS seem to violate thread safety of using fml::WeakPtr

2 participants