137 Commits

Author SHA1 Message Date
Matan Lurey
792830c13f Make a variety of low-impact Clang tidy fixes. (flutter/engine#46114)
Work towards https://github.com/flutter/flutter/issues/134969.

These are all self-contained, so I bundled them all together.

All fixes are generated by `clang-tidy --fix`, and manual search/replace if that wasn't sufficient.
2023-09-20 19:52:03 +00:00
Jonah Williams
dc05767b39 [Impeller] Affinity adjustments for Vulkan backend. (flutter/engine#46063)
Runs the waiter threads with efficiency affinity and the worker thread with "not performance" affinity.
2023-09-19 23:34:11 +00:00
Jonah Williams
88e963e0fd [Android] Add support for setting thread affinity based on core speed. (flutter/engine#45673)
https://github.com/flutter/flutter/issues/134452

This patch parses the speed of all CPU data out of /proc and constructs a table that allows us to request high level CPU affinities: performance, efficiency, and not performance. These affinties are applied where appropriate during Android thread construction.
2023-09-19 03:50:05 +00:00
Jason Simmons
75f91264d1 Do not log exceptions from JNI lookups of APIs that are known to be unavailable on older devices (flutter/engine#44357)
These exceptions are benign but were being logged every time an app is launched on a device with an Android API level below 26.
2023-08-07 14:35:05 +00: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
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
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
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
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
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
Jason Simmons
462cb1c9ad Convert the executable directory path to UTF-8 on Windows (flutter/engine#36908) 2022-10-21 00:28:20 +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
Brandon DeRosier
b029ab4f73 [Impeller] Header fixes to make fml/impeller buildable against libstdc++ (flutter/engine#36240) 2022-09-19 05:49:26 -07:00
Dan Field
08312a825e Lint and fix bugprone-use-after-move violations (flutter/engine#35978) 2022-09-09 02:41:03 +00: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
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
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
Chris Bracken
09285aac02 Use empty in place of size checks vs 0 (flutter/engine#33151) 2022-05-06 13:09:04 -07:00
Zachary Anderson
ac2c30006a [fml] Pass OPEN_ALWAYS for create_if_necessary (flutter/engine#33033) 2022-04-30 21:06:17 -07:00
Zachary Anderson
511245230b [fml] Handle absolute paths on Windows (flutter/engine#33029) 2022-04-30 10:39:07 -07:00
Chris Bracken
0a84242538 WinUWP: Remove WinUWP sources, targets (flutter/engine#33019)
This removes:
* The Windows UWP emebedder sources and targets
* UWP-specific build targets
* UWP-specific code behind WINUWP #ifdefs
* UWP-specific TODOs.
* uwptool.exe sources and targets used for installing, uninstalling, and
  launching UWP apps.

This is a straight removal patch, and does not land any refactorings
made possible by removal of UWP support. Those patches will land in
followup refactorings.

Tool support was removed in:
https://github.com/flutter/flutter/pull/102174

The CI target was removed in:
https://github.com/flutter/engine/pull/33012

The Recipe was removed in:
https://flutter-review.googlesource.com/c/recipes/+/29500

GN build support was removed in:
https://github.com/flutter/engine/pull/33016

Issue: https://github.com/flutter/flutter/issues/102172
2022-04-29 18:39:36 -07:00
Jonah Williams
2b39f38143 fix impellerc on windows (flutter/engine#33003) 2022-04-29 14:39:02 -07:00
Jonah Williams
75f0c30722 [win32] support high frame rates (flutter/engine#28927) 2022-03-03 12:06:06 -08:00
Jason Simmons
da146d247c Revert "Reland "Listen for Vsync callback on the UI thread directly"" (flutter/engine#31750) 2022-03-01 15:06:11 -08:00
ColdPaleLight
1a179ecff2 Reland "Listen for Vsync callback on the UI thread directly" (flutter/engine#31494) 2022-02-24 09:51:05 -08:00
Chris Bracken
8d99a8bc53 [fml] Use common FML string encoding utils (flutter/engine#31378)
General UTF8/UTF16 string conversion utility functions were recently
added to FML. This migrates calls in the Android JNI utils to the common
implementations.

No additional tests added since we're just dropping one implementation
of UTF8/UTF16 functions and making use of an equivalent set that already
has unit tests of its own. The rest of the Android-related code is
already covered by existing unit tests.

Issue: https://github.com/flutter/flutter/issues/98061
Related PR: https://github.com/flutter/engine/pull/31334
2022-02-10 14:13:59 -08:00
Chris Bracken
3e6137c8ec Migrate string encoding conversions to FML (flutter/engine#31334)
We've implemented UTF-8/UTF-16 string encoding conversions in multiple
places, from FML to //flutter/shell/platform/common, to the individual
embedders. This migrates these conversions to FML and adds tests.

Windows APIs use wchar_t-based strings and as a result, we continue to
keep Windows-specific functions in fml/platform/win/wstring_conversion.h.

We break out string_conversions into its own source set since FML brings
with it some Dart dependencies (e.g. dart_timestamp_provider.cc) that
are unused by some targets such as uwptool.exe in the Windows UWP
embedding.

Issue: https://github.com/flutter/flutter/issues/98061
2022-02-09 22:59:48 -08:00
Zachary Anderson
eca60c0b90 Add clang-analyzer-* and clang-diagnostic-* to .clang-tidy (flutter/engine#31291) 2022-02-09 12:26:34 -08:00
Gary Qian
9e1a29d21c Revert "Listen for Vsync callback on the UI thread directly" (flutter/engine#29923) 2021-11-24 12:33:02 -08:00
Fei Zhang
c45a9152a8 Listen for Vsync callback on the UI thread directly (flutter/engine#29889) 2021-11-24 04:23:01 -08:00
Chris Bracken
42605fc145 Windows: Clean up FML file debug messages (flutter/engine#29824) 2021-11-23 13:47:32 -08:00
Jenn Magder
c08aa6c73d Add 'explicit' to darwin embedder constructors (flutter/engine#29827) 2021-11-19 10:54:29 -08:00
Jenn Magder
b39436f7e5 Fix darwin namespace-comments and brace lint issues (flutter/engine#29828) 2021-11-18 21:06:56 -08:00
Jenn Magder
5291ff4193 Add 'explicit' to Android embedder constructors (flutter/engine#29830) 2021-11-18 21:06:44 -08:00
ColdPaleLight
9ecd4c1899 Make FlutterEngineGroup support dart entrypoint args (flutter/engine#29096) 2021-11-18 18:08:03 -08:00
Zachary Anderson
78d9e276e2 Fix some clang-tidy lints for Linux host_debug (flutter/engine#29734) 2021-11-18 13:08:01 -08:00
Jenn Magder
dbe42683b9 Fix 'google-readability-braces-around-statements' analyzer warning in macOS and iOS (flutter/engine#29723) 2021-11-12 18:42:29 -08:00
Ryan Macnak
1dfe28a310 Inform the Dart VM when snapshots are safe to use with madvise(DONTNEED). (flutter/engine#29320)
Bug: https://github.com/dart-lang/sdk/issues/44019
Bug: https://github.com/flutter/flutter/issues/92120
2021-10-28 16:53:41 -07:00
Callum Moffat
cd18e95d73 [iOS] Fix duplicated keys when typing quickly on HW keyboard (flutter/engine#29113)
* [iOS] Fix duplicated keys when typing quickly on HW keyboard

* Address review (refactor constant)

* Change message loop constant name

* Apply suggestions from code review

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2021-10-19 14:57:11 -07:00
Dan Field
293ef51fc6 Reland Android systrace (flutter/engine#29080)
* Reland "Use the systrace recorder if systracing is enabled at startup, and enable systracing in release mode on Android (#28903)" (#29071)"

This reverts commit a7660964b41f64991369341364a43c93317a4a51.

* More logcat

* more logs

* Remove wait

* Avoid plugin registrar exception

* DEFAULT instead of LAUNCHER

* use am instead of monkey

* Update android_systrace_test.py
2021-10-08 15:55:50 -07:00
Zachary Anderson
a7660964b4 Revert "Use the systrace recorder if systracing is enabled at startup, and enable systracing in release mode on Android (#28903)" (flutter/engine#29071)
This reverts commit 79063b3c6105c3cf8be757ed6d31dd9a055060d9.
2021-10-07 22:08:10 -07:00
Dan Field
79063b3c61 Use the systrace recorder if systracing is enabled at startup, and enable systracing in release mode on Android (flutter/engine#28903) 2021-10-07 15:59:46 -07:00
David Worsham
6bee1e7989 fuchsia: Implement WakeUp using zx::timer (flutter/engine#29019) 2021-10-06 00:18:44 -07:00
gaaclarke
fdc01be73e added log statement to timerfd_settime failure (flutter/engine#27974) 2021-08-16 14:43:34 -07:00
Brandon DeRosier
e2c58529b5 Add native Android image decoder supported by API 28+ (flutter/engine#26746) 2021-07-21 13:52:29 -07:00
zouquan741
23e6afbec0 Fix leak in CFRef's move assignment operator. (flutter/engine#27441) 2021-07-15 13:36:02 -07:00
Hunter Freyer
34b8a2b930 Replace flutter_runner::Thread with fml::Thread (flutter/engine#26783)
* Move task_observers.{cc,h} into fml.

This is a preparatory CL. The next CL will cause task_observers.h to
be included from both shell/platform/fuchsia _and_
fml/platform/fuchsia. I imagine it might be gauche for a single file
to be used from both those directories, but it seems way worse for fml
to depend on shell, rather than the other way around.

* Replace flutter_runner::Thread with fml::Thread.

This CL makes the treading logic in Fuchsia's flutter_runner more
consistent with fml expectations, but it still has quirks. Notably:

- Not all async work get posted to a fml::TaskRunner. Some work done
  by Fuchsia libraries gets posted directly to
  async_get_default_dispatcher(). This work doesn't trigger the
  fml::MessageLoop's task observers. As a result, we continue to have
  Fuchsia-specific task observers which fire for all async work,
  regardless of which way it was posted.

- There's awkwardness when trying to run Fuchsia code on a specific
  fml::TaskRunner if that fuchsia code accepts an
  async_dispatcher_t. Since you can no longer get an
  async_dispatcher_t for a given thread, you instead must post a
  closure to the fml::TaskRunner that calls
  async_get_default_dispatcher(), and then calls the fuchsia library
  with the default dispatcher.

- Some tests still use task_runner_adapter.h because async::Loop
  offers more control in unit tests than fml::MessageLoop does.

- If this successfully lands, there will be some cosmetic follow-up
  changes to make, like using ThreadHost instead of an array of
  fml::Threads.

* Increase stack size in flutter runner.

The previous change removes our custom 1MiB limit on the stack of
newly created threads, so these threads revert to the Fuchsia
default. google-internal tests were failing (without any particular
error in the logs) after this change, so here we just set the default
stack size to 1MiB.

Co-authored-by: Hunter Freyer <hjfreyer@google.com>
2021-07-06 10:04:08 -07:00