402 Commits

Author SHA1 Message Date
Derek Xu
dedec555f2 Handle deprecation of Dart_TimelineEvent Embedder API (flutter/engine#42497)
This PR changes usages of `Dart_TimelineEvent` to
`Dart_RecordTimelineEvent` as `Dart_TimelineEvent` was deprecated in
https://dart-review.googlesource.com/c/sdk/+/308721.
2023-08-02 16:09:31 -04:00
Jia Hao
409cd83cb4 Revert "Log dlopen errors in opt builds (#41477)" (flutter/engine#43677)
This reverts commit 2b0b0a0e7882a7af5efa843b598a4d42b49b47b4.

This didn't seem to help with debugging b/276657840. Fixes https://github.com/flutter/flutter/issues/125523.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-07-18 04:52:48 +00:00
Chris Yang
4e696fc84d Unmerge threads if the current merger is the only one that's merged. (flutter/engine#43652)
`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
2023-07-13 22:17:21 +00:00
Jason Simmons
2b231a05fd Release the mutex in the CanCreateConcurrentMessageLoop test before waking the latch (flutter/engine#43574)
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
2023-07-11 23:18:48 +00:00
Dan Field
f7ba78c7b0 Release log capture at end of test (flutter/engine#43429)
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.
2023-07-06 15:05:01 +00:00
Jonah Williams
ac3ce651f3 [Impeller] Give Impeller a dedicated raster priority level worker loop. (flutter/engine#43166)
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.
2023-06-27 18:08:49 +00:00
Dan Field
b6fa0a20a5 Print a warning when a message channel is used on the wrong thread. (flutter/engine#42928)
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.
2023-06-22 18:16:40 +00:00
Jason Simmons
ea621b65bb Wrap concurrent message loop tasks in an autorelease pool on iOS/Mac platforms (flutter/engine#42459)
See https://github.com/flutter/flutter/issues/127482
2023-06-02 19:58:43 +00:00
Zachary Anderson
9022cac6f8 Enables bugprone-unchecked-optional-access for some files (flutter/engine#42428) 2023-05-30 16:52:58 -07:00
Zachary Anderson
5633d0d833 Enable bugprone-unchecked-optional-access, disable in files with warnings (flutter/engine#42359)
First part of https://github.com/flutter/flutter/issues/127701
2023-05-26 21:58:46 +00:00
Jason Simmons
4c29368376 [Impeller] Create an autorelease pool for Impeller tests running on macOS. (flutter/engine#42265)
See https://github.com/flutter/flutter/issues/127358
2023-05-24 19:16:13 +00:00
gaaclarke
9258309eed Turned back on debug unit tests (flutter/engine#42261)
I refactored the `EXPECT_EXIT` tests since they are unsafe to execute in a process with multiple threads.

This leaves `flutter_desktop_darwin_unittests` disabled since it has existing issues.

fixes https://github.com/flutter/flutter/issues/103757

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-05-23 23:13:35 +00:00
Dan Field
ccd8afabde Make FML_LOG safe from static initialization (flutter/engine#42219)
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.
2023-05-23 00:02:17 +00:00
Jia Hao
2b0b0a0e78 Log dlopen errors in opt builds (flutter/engine#41477)
As the Engine uses `dlopen` to find the `libapp.so`, https://github.com/flutter/flutter/issues/59834 can happen which will prevent `dlopen` from finding the binary. In theory this should be mitigated by https://github.com/flutter/engine/pull/9762, but an internal customer observed errors that could be related. 

The additional logging here can help to rule out that hypothesis. For Googlers, see b/276657840 for more details.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-04-26 08:16:05 +00:00
Brandon DeRosier
b4271c24de Add missing header guards (flutter/engine#41322)
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-
```
2023-04-19 21:20:21 +00:00
Chris Bracken
3bf49d72e4 Support disabling backtrace support (flutter/engine#40980)
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
2023-04-06 17:21:34 -07:00
Chris Bracken
1404722d05 Add doc comment to Pipeline (flutter/engine#40388)
Add doc comment to Pipeline
2023-03-17 20:38:55 +00:00
Jonah Williams
726df65356 Reland: Move asset opening to background thread, fix dart persistent value destruction (flutter/engine#40183)
Reland: Move asset opening to background thread, fix dart persistent value destruction
2023-03-09 22:58:04 +00:00
Zachary Anderson
44947b8822 Revert "[engine] move asset mapping copy to background thread (#39918)" (flutter/engine#40147)
Revert "[engine] move asset mapping copy to background thread"
2023-03-08 19:30:27 +00:00
Jonah Williams
aa6c168e5f [Impeller] Replace FML_OS_PHYSICAL_IOS compile check with runtime capabilties check based on metal GPU family. (flutter/engine#40124)
[Impeller] Replace FML_OS_PHYSICAL_IOS compile check with runtime capabilties check based on metal GPU family.
2023-03-08 03:25:08 +00:00
Jonah Williams
9bc89c950c [engine] move asset mapping copy to background thread (flutter/engine#39918)
[engine] move asset mapping copy to background thread
2023-03-08 00:28:34 +00:00
Jonah Williams
0ecfed28d3 [Impeller] read from framebuffer for advanced blends on iOS. (flutter/engine#39567)
* [impeller] read from framebuffer for advanced blends

* ++

* update to contents

* move to separate contents

* ++

* set stencil depth duh

* ++

* ++

* remove debug info

* update licenses

* Add FML_OS_PHYSICAL_IOS

* ++

* ++
2023-02-14 21:27:07 +00:00
Brandon DeRosier
4d586c0346 Add Animated PNG demuxer (flutter/engine#31098) 2023-02-09 22:34:05 -08:00
Chris Bracken
1dd1f02bc4 Extract WideToUTF16String/UTF16StringToWide to FML (flutter/engine#39020) 2023-01-19 22:55:47 -08:00
godofredoc
aa2afcdeb5 Revert "Extract WideToUTF16String/UTF16StringToWide to FML (#39006)" (flutter/engine#39019)
This reverts commit d96d942ddc22af628e00ab958ec9860e338ce17f.
2023-01-20 00:45:58 +00:00
Chris Bracken
d96d942ddc Extract WideToUTF16String/UTF16StringToWide to FML (flutter/engine#39006)
* 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
2023-01-19 23:46:59 +00:00
Jason Simmons
6c1389babe Clarify file sharing flags in FML filesystem APIs on Windows (flutter/engine#38164)
Use shared mode when requesting read access and exclusive mode for write access
2022-12-13 15:22:35 +00:00
fzyzcjy
52668a7252 Reland fix wrong VSYNC event (flutter/engine#37865) 2022-12-07 13:46:06 -05:00
gaaclarke
af036b8857 Turned on performance-unnecessary-value-param everywhere. (flutter/engine#37447)
* Turned on performance-unnecessary-value-param everywhere.

* linux host additions

* ios patch

* reverted bad fix

* revert bad fix

* another ios patch

* removed lint fix printer
2022-11-09 20:55:13 +00:00
Brandon DeRosier
9491b2c39b [Impeller] Remove cached pipelines when RuntimeStage is hot reloaded (flutter/engine#37307) 2022-11-04 17:18:02 -07:00
Jason Simmons
462cb1c9ad Convert the executable directory path to UTF-8 on Windows (flutter/engine#36908) 2022-10-21 00:28:20 +00:00
moko256
1ddb84552e Add Windows support for //flutter/fml/backtrace.h (flutter/engine#36202) 2022-10-20 20:10:25 +00:00
Jason Simmons
71c230958d Change TaskRunnerAffineWeakPtr to no longer be a subclass of WeakPtr (flutter/engine#36818) 2022-10-18 18:53:16 +00:00
Kaushik Iska
53383fbdf7 [Impeller] Add WSI support for Vulkan on Linux and Windows (flutter/engine#36762)
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.
2022-10-17 11:11:40 -05:00
Dan Field
e4d709de85 Avoid using non-UTF-8 encoded argv more often (flutter/engine#36590) 2022-10-05 12:03:20 -07:00
gaaclarke
e41c775200 Removed instances of unnecessary values (flutter/engine#36221) 2022-09-26 21:28:04 +00:00
Jason Simmons
136cbcc67f [Impeller] Convert the ImpellerC command line arguments to UTF-8 on Windows (flutter/engine#36335) 2022-09-22 15:13:09 +00:00
Alexander Biggs
6751734343 [fuchsia] Add run_unit_tests.sh script. (flutter/engine#36308)
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.
2022-09-21 10:40:20 -07:00
Brandon DeRosier
9ce1286f2b Resolve warnings on Windows (flutter/engine#36241) 2022-09-19 05:49:54 -07:00
Brandon DeRosier
b029ab4f73 [Impeller] Header fixes to make fml/impeller buildable against libstdc++ (flutter/engine#36240) 2022-09-19 05:49:26 -07:00
Chris Bracken
b693201c04 [lint] Update local variable names in fml (#36136) (flutter/engine#36147)
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.
2022-09-14 15:47:25 -07:00
Dan Field
08312a825e Lint and fix bugprone-use-after-move violations (flutter/engine#35978) 2022-09-09 02:41:03 +00:00
gaaclarke
7a54d02e79 allows mallocmapping copies of size zero (flutter/engine#35803) 2022-08-30 18:10:25 +00:00
Tamir Duberstein
2aaeab3c9d Remove fx_logger_config_t.console_fd (flutter/engine#35302)
This was deprecated in https://fxrev.dev/708606.
2022-08-11 15:02:22 -07:00
Jason Simmons
23d5f04e7b Retain a reference to the CFRunLoop until MessageLoopDarwin::Terminate exits (flutter/engine#34735) 2022-07-19 16:56:06 +00:00
klaxxi
bec0d79eeb remove lock and use raw ptr for MessageLoopTaskQueues (flutter/engine#34249) 2022-07-18 07:08:04 +00:00
Jason Simmons
722630e73a Disable libcxx deprecation warnings for FML's use of UTF-16 string converters (flutter/engine#34551) 2022-07-08 22:37:04 +00:00
Chris Bracken
53a9648da9 [lint] Merge impeller .clang-tidy into main config (flutter/engine#33692)
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.
2022-06-21 11:52:42 -07:00
ColdPaleLight
412e090f98 Remove duplicate 'FML_DCHECK' in 'MessageLoopImpl::PostTask' (flutter/engine#34061) 2022-06-16 00:33:06 -07:00
Jonah Williams
b30f87212c Use std::filesystem to compute output paths in blobcat and impellerc (flutter/engine#33939) 2022-06-09 15:48:05 -07:00