`UnMergeNowIfLastOne` is called during shell destruction. When there are other shells with threads unmerged and the current destroying shell with thread merged. `UnMergeNowIfLastOne` should unmerge the threads.
This PR Make `UnMergeNowIfLastOne` not only unmerge if the current merger is the last merger, but also unmerge if the current merger is the last merger that is merged.
Fixes https://github.com/flutter/flutter/issues/127168
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
If the wake happens while thread_ids_mutex is still held, then the test function may exit and destroy thread_ids_mutex before the pool thread task releases it.
Fixes https://github.com/flutter/flutter/issues/130344
Fixes https://github.com/flutter/flutter/issues/130036
Also fixes a potential issue where the shell wasn't getting destroyed at the end of the test.
Since no log is actually printed ont he second go, the destructor of `LogMessage` never clears the static pointer, and the next test that tries to print a log tries to print to that pointer which is now garbage.
We'd like to (or already are) using the concurrent message loop for high priority rendering tasks like PSO construction and render pass encoding. The default priority level for the engine managed concurrent message loop is 2, which is a significantly lower priority than the raster thread at -5. This is almost certainly causing priority inversion.
We must move back to dedicated runners so we can adjust thread priorities.
Fixes https://github.com/flutter/flutter/issues/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.
I ran into this while trying to get some printing going for places where we're creating thread local keys.
Supposedly, just including `<iostream>` should statically initialize `std::cout/cerr`, but it gets really hard to reason about whether your statically initialized code is going to be initialized before or after that happens. I tried making sure that the TU for `fml/logging.cc` did that initialization statically, but that also failed in the verison of the test included here (it passed in some other iterations that modified run_all_unittests.cc). We _could_ make sure it happens each and every time we touch `std::cerr` but ... we could also just use `fprintf(stderr, ...)` and it works just fine.
/cc @flar who ran into problems around this a little while back and was asking about it.
These keep turning up, so I did a little bash-fu to find them all.
```bash
grep -lL "#pragma once" $(grep -lL "#ifndef .*_H_" $(find . | grep "\.h$")) | cut -c 3-
```
This adds a gn flag (--backtrace, --no-backtrace) that defaults to
enabling backtraces, which drives a gn variable `enable_backtrace` which
is defaulted true for debug builds.
Backtrace collection is supported on Windows, and on POSIX-like
operating systems via execinfo.h. execinfo support exists in Android,
macOS/iOS, and in glibc and uclibc on Linux. musl libc notably does not
include execinfo support, so this provides an escape hatch to build with
backtrace_stub.cc for situations in which compile time support doesn't
exist.
Proposed as an alternative to
https://github.com/flutter/engine/pull/40958 by @selfisekai.
Issue: https://github.com/flutter/flutter/issues/124285
* Extract WideToUTF16String/UTF16StringToWide to FML
In third_party/accessibility, for string conversion, we use a mix of:
* FML
* third_party/accessibility base string utility functions
* static functions local to the translation unit itself
This moves all conversions between UTF16 and wide strings to FML. Note
that this implementation is only safe on platforms where:
* the size of wchar_t and char16_t are the same
* the encoding of wchar_t and char16_t are both UTF-16
which is the case for Windows, hence why these functions are implemented
in a Windows-specific translation unit (wstring_conversion).
Issue: https://github.com/flutter/flutter/issues/118811
* Migrate UTF16ToWide as well
There are additional instance extensions that need to be enabled for
this. Having any one of them is sufficient on each of these platforms.
There were also some `VALIDATION_LOG`s that would fail in the process of
picking a valid physical device, this would incorrectly exit early when
there were multiple devices and a latter device is valid.
Also improves logging for playground when glfw fails to get a surface.
This is a convenience script for running unit tests locally.
To make this script work, I had to move several test exclusions
from test_suites.yaml (which controls running tests on CQ)
to the tests themselves. I think this is for the best because
it makes running the tests locally with behavior that matches
CQ easier.
Also added fuchsia_tests to build_and_copy_to_fuchsia.sh
so it builds the unit tests .far packages by default.
Tested: Ran `run_unit_tests.sh`, all tests pass. Ran
`build_and_copy_to_fuchsia.sh`, it still builds.
This updates local variable names to use clang `lower_case` style in the
fml directory. This is one of several patches to update our variable
names to a consistent style before enabling enforcement in our
clang-tidy rules.
This is a formatting-only change with no intended semantic change.
Merges most (but not all) of the impeller .clang-tidy rules into the
main .clang-tidy config. Merges:
readability-identifier-naming.PrivateMemberSuffix (_)
readability-identifier-naming.EnumConstantPrefix (k)
modernize-use-default-member-init.UseAssignment
Does not merge:
readability-identifier-naming.PublicMethodCase (CamelCase)
readability-identifier-naming.PrivateMethodCase (CamelCase)
These last two are not merged due to the non-trivial number of existing
field accessors that use field_name() methods to directly return
field_name_. While these are permitted by the C++ style guide, we may
want to move to a single, simple rule and name everything in CamelCase.
These can be enabled in a followup patch.
No new tests added, since this change is style-only.