470 Commits

Author SHA1 Message Date
art-snake
405f673f7d fix use_of_uninitialized_value in message_loop_task_queues.cc (flutter/engine#55520)
This issue was found with memory sanitizer.

    Commit 988c4ffb83398bf8511122d73f0f85010e0edeea introduced a change that leads to use-after-free condition.

    In function MessageLoopTaskQueues::GetNextTaskToRun:

        1) Call is made to PeekNextTaskUnlocked(queue_id);. Returned value contains a reference to to an object of const DelayedTask& taken from an std::queue container as returned by primary_task_queue_.top().
        2) Variable TaskSource::TopTask top now contains a reference to this object.
        3) Function queue_entries_.at(top.task_queue_id)->task_source->PopTask(...) which in turn calls pop() method on std::queue.
        4) Object of type DelayedTask on top of the queue gets deleted.
        5) top.task.GetTaskSourceGrade() is called later with top.task refering to an already deleted object.

*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

*List which issues are fixed by this PR. You must list at least one issue.*

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-09-30 18:17:05 +00:00
John McDole
14caa2fe19 Disallow time traveling frame times (flutter/engine#55310)
Address bad developer experience in
https://github.com/flutter/flutter/issues/106277

Leave as an error log and hope for more repro reports


```mermaid
sequenceDiagram
  Animator ->> Animator: AwaitVSync
  Animator ->> VsyncWaiter: AsyncWaitForVsync(callback)
  VsyncWaiter -> VsyncWaiterAndroid: AwaitVSync
  note over VsyncWaiterAndroid: GetUITaskRunner
  VsyncWaiterAndroid -> Choreographer: PostFrameCallback
  Choreographer -> NDK: AChoreographer_postFrameCallback64
  note over Choreographer,NDK: The time that the frame is being<br/>rendered as nanoseconds in the <br/>CLOCK_MONOTONIC time base
  NDK --> Choreographer: callback(nanos)
  Choreographer -> VsyncWaiterAndroid: callback
  note over VsyncWaiterAndroid: // Rollback suspicion<br/>if (frame_time > now) frame_time = now;
  VsyncWaiterAndroid -> VsyncWaiterAndroid: OnVsyncFromNDK(frame_nanos)
  VsyncWaiterAndroid -> VsyncWaiter: FireCallback(\n  frame_start_time,\n  target_time)
  VsyncWaiter -> Animator: callback(frame_timings_recorder)

  Animator -> Animator: BeginFrame(frame_timings_recorder)
  Animator -> Shell: OnAnimatorBeginFrame
  Shell -> Engine: BeginFrame(frame_time, frame_number)
  Engine -> RuntimeController: BeginFrame(frame_time, frame_number)
  RuntimeController -> PlatformConfiguration: BeginFrame(frame_time, frame_number)
  PlatformConfiguration -> hooks.dart: begin_frame_
```
2024-09-24 15:33:45 -07:00
Jason Simmons
2b0b252f06 Add missing include to fml/hex_codec.h (flutter/engine#55034) 2024-09-09 23:55:14 +00:00
Jonah Williams
248dfb2334 [engine] reland weaken affinity of raster/ui to non-e core instead of only fast core (flutter/engine#54616)
Some android devices have only a single fast core. We set the threading affinity for UI/Raster to the fast core, which can lead to the UI/Raster being serialized on this thread. Instead, we should weaken /invert the affinity to "Not slow cores".

FIxes https://github.com/flutter/flutter/issues/153690

Customer money will see some benchmark regressions but they can deal.
2024-08-21 16:31:55 +00:00
Chinmay Garde
c2992b3273 Remove shared mutex from FML and use the C++17 variants. (flutter/engine#54482)
We used to require this only on iOS because the standard library till iOS 9 didn't have support for this. We have moved past that version. No change on other platforms.
2024-08-09 22:59:58 +00:00
Chinmay Garde
f60c0e325a Remove fml::size. (flutter/engine#54476)
std::size because standard in C++17.
2024-08-09 20:01:28 +00:00
Chinmay Garde
e83e23a6c5 Delete //flutter/fml/compiler_specific.h (flutter/engine#54330)
There were two macros for doing identical things and you can do the thing using standard C++17.
2024-08-03 01:47:49 +00:00
John O'Neil
e76e0548bc Fix #150515 Provide required headers for build with Clang-16 and GCC … (flutter/engine#53479)
Fixes Impeller engine build with `clang-16` and GCC 14 C++Stdlib does not implicitly include `<algorithm>`.

Fixes issue: #150515 

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-27 20:07:19 +00:00
Jonah Williams
d86d6c541d Revert "Widen CPU affinity set." (flutter/engine#53274)
Reverts flutter/engine#53136

b/345642546 shows some massive performance regressions on this patch. i'll rework it so the conditions are only loosened on phones with one fast core.
2024-06-07 15:55:08 +00:00
Jonah Williams
34fba02f1d Widen CPU affinity set. (flutter/engine#53136)
For devices with 1 fast core, the current affinity set is less idea because it forces UI and raster on the same thread. Widen this to exclude slow cores instead of including only the fast core.
2024-06-03 21:41:21 +00:00
Chinmay Garde
6b36f0f40b Cleanup propagation of codecvt warning suppression in FML. (flutter/engine#52966)
Previously, because the suppression was local, every user of the the header had to manually add the flag. Now the flag will be propagated to the targets automatically. This linked issue still needs to be fixed but the fix can now be more isolated.
2024-05-23 21:03:52 +00:00
auto-submit[bot]
ea811b97ba Reverts "Manual roll of Clang from 725656bdd885 to 145176dc0c93 (#52823)" (flutter/engine#52890)
Reverts: flutter/engine#52823
Initiated by: zanderso
Reason for reverting: Engine crashes on framework CI following this roll https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_android%20flutter_gallery__transition_perf_with_semantics/12126/overview
Original PR Author: jason-simmons

Reviewed By: {zanderso}

This change reverts the following previous change:
See https://github.com/flutter/flutter/issues/143178
2024-05-16 22:01:38 +00:00
Jason Simmons
31d7cb2870 Manual roll of Clang from 725656bdd885 to 145176dc0c93 (flutter/engine#52823)
See https://github.com/flutter/flutter/issues/143178
2024-05-16 17:16:21 +00:00
Chinmay Garde
6115e5ac3a [Impeller] Wire up hardware buffer backed swapchains on Android. (flutter/engine#52087)
This wires up Android Hardware Buffer backed swapchains on platform that support
it (Android >= 29) with a KHR swapchain fallback (which can be removed later to
save on some binary size if needed).

Some salient features of these swapchains and their differences with the KHR
variant:

* All swapchain images are guaranteed to R8G8B8A8. This could potentially allow
  for earlier creation of the context and the PSO libraries.
* All swapchain allocations are lazy. This should greatly reduce the time it
  takes to create and resize a swapchain. However, swapchain image acquisition
  may take longer for the first few frame where there is no pre-pooled image
  available. Resizes should be similarly faster since the swapchain images for
  the intermediate sizes are never created.
* Swapchain transients allocations (the attachments for the root render target)
  are also lazily allocated.
* Swapchain images are pool and reused. The size of the pool is user specified
  (currently 2). If an image in the pool ages past a user supplied value
  (currently 1 second), it is collected as well. Applications that don't render
  frames for a long period of time should see less memory use because of
  swapchain image allocations.
* The present mode of AHB swapchains behave similar to KHR swapchains but with
  VK_PRESENT_MODE_MAILBOX_KHR. In cases where there is no application managed
  frame pipelining, this might cause images to never be presented if a newer
  image is available. This wasted work can only be avoided by application
  provided pipelining.
* There are no client side waits during image presentation. Instead, a new type
  of fence is wired up that exports its state as a sync file descriptor. The
  fence signal operation is enqueued on the client side and the buffer is set on
  the surface control. The presentation engine then performs the wait.
* On Qualcomm devices, Chromium seems to be setting vendor specified flags for
  opting the hardware buffers into using UBWC. AFAICT, this is similar to AFBC
  (and NOT AFRC) on ARM Mali. This has not been wired up since I don't have a
  Qualcomm device at the moment and cant verify bandwidth use using GPU
  counters. I would also like to verify that UBWC is safe to use to images that
  can be used as input attachments.
2024-05-01 19:54:13 +00:00
gaaclarke
97c434c662 [Impeller] Cleanup PipelineVK::Create (flutter/engine#52278)
`PipelineVK::Create` was one giant function. Now its 3 smaller functions
and one less giant but still big function.

This is groundwork for trying to batch calls.

I tried to split out the creation of the
`vk::GraphicsPipelineCreateInfo` but it holds pointers to things on the
stack so it's hard to do.

test exempt: refactor, no new functionality

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2024-04-23 11:05:46 -07:00
Chinmay Garde
695a720ded Re-land "[Impeller] A toolkit for managed handles to Android NDK vended objects." (flutter/engine#51460)
This reverts commit 037aa6b4caa6a3a726e67e519324b2c0a1ec274a.

The original cause of the revert was a flake introduced because the unit-test could request a frame from the Choreographer if it ran long enough. The availability checks in the choreographer were inaccurate after we intentionally backed out of using the Callback32 variant on 32 bit platforms.

The new tests didn't catch it because of an unrelated issue. In the first version of the patch for review, the proc table was only supposed to run on API levels 29 and above. When @dnfield requested we also get rid of the NDK helpers, the choreographer and additional utilities were added. But the API level gate in the new test harness wasn't removed. This made the tests be skipped. That gate has been removed entirely now. The error that cause the revert because of flakiness will now be a reliable failure.
2024-03-16 00:15:07 +00:00
auto-submit[bot]
037aa6b4ca Reverts "[Impeller] A toolkit for managed handles to Android NDK vended objects. (#51334)" (flutter/engine#51457)
Reverts: flutter/engine#51334
Initiated by: matanlurey
Reason for reverting: Broke engine post-submit, see https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8753367119442265873/+/u/test:_Android_Unit_Tests__API_28_/stdout.
Original PR Author: chinmaygarde

Reviewed By: {dnfield}

This change reverts the following previous change:
Only available on Android device API levels >= 29. Proc table is setup has versioning checks. All handles are type safe. Collection of handles takes into account cleanup tasks (like reparenting surface controls). The proc table contains code duplicated in ndk_helpers and I will remove that in favor of this in a subsequent patch.

Part of https://github.com/flutter/engine/pull/51213 being chopped up.
2024-03-15 21:35:37 +00:00
Chinmay Garde
38ec9b7328 [Impeller] A toolkit for managed handles to Android NDK vended objects. (flutter/engine#51334)
Only available on Android device API levels >= 29. Proc table is setup has versioning checks. All handles are type safe. Collection of handles takes into account cleanup tasks (like reparenting surface controls). The proc table contains code duplicated in ndk_helpers and I will remove that in favor of this in a subsequent patch.

Part of https://github.com/flutter/engine/pull/51213 being chopped up.
2024-03-15 20:45:15 +00:00
zijiehe@
fb4d1819e7 [Fuchsia] Remove the use of //build/ in fuchsia (flutter/engine#51072)
### Motivation of the change:

Both dart and flutter are using fairly outdated gn-sdk without properly maintained. Currently @hjfreyer is working on version'ed IDK / SDK libs which requires changes in gn-sdk to use the right version of the libs in fuchsia/sdk/obj/{arch}-api-{level} rather than the one in the fuchsia/sdk/arch. But current implementation does not support choosing the right version.

### Blocking issue:

The new gn-sdk (in flutter/tools/fuchsia/gn-sdk) generates multiple BUILD.gn files rather than a large BUILD.gn the previous version created. So most of the build rules need to switch from the old `fidl:{api}` build rule to `fidl/{api}` rule. The same change will happen in the dart/sdk, i.e. http://go/dart-reviews/356924. But since the two repos cannot have one single atomic change, changing either side first will cause flutter to break. E.g. the linkage error caused by duplicated symbols will happen if we change the dart/sdk first, since in flutter, it will still refer to the old build rules in the middle.

### Solutions:

Ideally we can create redirect rules in the current `build/fuchsia` buildroot tree to redirect the old rules into the new one, so we can make the change in the flutter first then dart/sdk. But creating the rules is not trivial and will only be used once.

So an alternative solution is

- pause the dart/sdk -> flutter roll
- submit dart/sdk change (http://go/dart-reviews/356924)
- update this change to manually bring the dart/sdk change, namely the `dart_revision` in the DEPS file and signatures in the ci/licences.
- resume the dart/sdk -> flutter roll.

But it requires this change itself to be reviewed first, and I'd like to know your opinion before moving forward.

See corresponding dart/sdk change at http://go/dart-reviews/356924.

### //build/fuchsia/ from buildroot should be removed after this change.

Bug: [b/40935282](https://issues.chromium.org/issues/40935282?pli=1&authuser=0)

FYI: @hjfreyer 

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-03-15 02:52:21 +00:00
Chris Bracken
0e6d56bc1c Move Abseil from src to flutter third_party dir (flutter/engine#51245)
In combination with:
* https://flutter-review.googlesource.com/c/third_party/abseil-cpp/+/55848
* https://github.com/flutter/buildroot/pull/831

this updates Flutter's references to Abseil from
//third_party/abseil-cpp to //flutter/third_party/abseil-cpp.

Issue: https://github.com/flutter/flutter/issues/144201
Part of: https://github.com/flutter/flutter/issues/67373

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-03-07 01:19:17 +00:00
Jason Simmons
652c0e071c Support gtest-parallel when running Impeller unit tests (flutter/engine#51079)
ImpellerC tests that use a temporary directory will append the current process ID to the directory name to avoid collisions.

The temporary directory will also be deleted after each test case completes.

See https://github.com/flutter/flutter/issues/143379
2024-03-04 20:17:07 +00:00
Zachary Anderson
9f1ed38ee0 Shift //third_party/icu to //flutter/third_party (flutter/engine#50924)
For https://github.com/flutter/flutter/issues/67373
2024-02-23 23:23:27 +00:00
Zachary Anderson
e6d9dca1b7 Shift some deps to //flutter/third_party (flutter/engine#50830)
Part of https://github.com/flutter/flutter/issues/67373
2024-02-21 23:51:16 +00:00
Zachary Anderson
f6629ffe5c Use 'et format' in CI. Check formatting of all files in CI (flutter/engine#50810)
This PR changes the format check on CI to use the command added in
https://github.com/flutter/engine/pull/50747.

Additionally, while making this change, I noticed that the CI check was
not checking the formatting of all files, and that as a result, files
were present in the repo with incorrect formatting. I have fixed the
formatting and fixed the check to always check all files.
2024-02-21 09:38:08 -08:00
Chinmay Garde
6c17d7bf9d Use a GN variable (dart_src) to reference the location of the Dart checkout. (flutter/engine#50624)
Towards https://github.com/flutter/flutter/issues/143335
2024-02-14 21:12:23 -08:00
Dan Field
e83d4c3a30 Do not use AChoreographer on 32 bit devices (flutter/engine#50586)
This is a fix forward alternative to the revert here: https://github.com/flutter/engine/pull/50581

If the revert lands first I'll rebase into this. I'm working on verifying this locally against the devicelab tests.
2024-02-13 17:32:16 +00:00
Dan Field
2f964dfe37 Refactor NDK helpers some more, add methods for SurfaceControl/Transaction, tests (flutter/engine#50540)
Adds more dynamic method lookups in service of https://github.com/flutter/flutter/issues/143105

Moves the TU out to FML so that Impeller can more easily use it.

Adds checking on `AHardwareBuffer_getId` so that it checks the return value before returning what is potentially garbage.

Adds some smoke tests to make sure these things actually work/look up meaningful symbols. Test is in the shell because we have testing infra for this kind of thing there.
2024-02-12 17:12:06 +00:00
Dan Field
9f9ab34867 [Impeller] Log non-default graphics backend usages, use IMPORTANT rather than ERROR (flutter/engine#50448)
Fixes https://github.com/flutter/flutter/issues/142488

- Only logs on iOS if Skia is used instead of Impeller.
- Logs on other platforms if Impeller is used instead of Skia.
- Uses "IMPORTANT" rather than "ERROR" for these logs. This will show up by default since flutter_tools sets ERROR and above as logs to show.
- Adds some tests.
- Makes INFO log print file paths the same as other verbosities.
2024-02-07 21:29:12 +00:00
Chinmay Garde
8ac86e0177 Delete fml::ThreadLocalUniquePtr. (flutter/engine#50310)
Fixes https://github.com/flutter/flutter/issues/141127
2024-02-04 03:04:07 +00:00
Tong Mu
be6209e136 Remove number of arguments from defining Dart FFI (flutter/engine#50153)
The number of arguments are not used. 

And also, even if we need it in the future, they can be derived at compile time:

```cpp
template <typename T>
struct function_traits;

template <typename Ret, typename... Args>
struct function_traits<Ret(Args...)>
{
    using params = std::tuple<Args...>;
};

template <typename T>
constexpr std::size_t get_parameter_count() {
    return std::tuple_size<typename function_traits<T>::params>::value;
}

template <typename T>
struct member_function_traits;

template <typename C, typename Ret, typename... Args>
struct member_function_traits<Ret(C::*)(Args...)>
{
    using params = std::tuple<Args...>;
};

template <typename T>
constexpr std::size_t get_member_function_parameter_count() {
    return std::tuple_size<typename member_function_traits<T>::params>::value;
}

```

(I got the code above with ChatGPT but I verified that they work)

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-02-01 23:58:31 +00:00
Martin Kustermann
891ac4e5bd More correctly name methods regarding event loop that are currently named microtask (flutter/engine#50138)
Flutter implements the UI isolates message via posting to a UI task queue. That task queue has a primary and a secondary queue. The

* primary is used for running tasks resulated to framework (e.g. draw frame)
* secondary is used to run Dart event loop messages (e.g. received data on a socket)

The Dart semantics requires running microtasks before processing the next event loop message.

The way flutter implements by attaching an observer to the secondary queue. Every time a task from the queue is run, all observers are run and one of them is going to run pending microtasks.

In some situations the engine pauses the dart event loop. The terminology used in the code is "microtask" when in reality what it means is "event loop".

=> This PR changes this terminology to reflect what actually happens.
2024-01-31 04:41:28 +00:00
Michael Brase
c4608bbfd1 Use structured logging on Fuchsia (flutter/engine#49918)
This change migrates off of the old fuchsia logging apis to use the
structured logging apis. The initial FIDL connection is made during
global initialization (before main()) and the initial minimum log level
is queried from the system. Later on, once the main loop is initialized,
we setup an async task to listen for additional log interest changes
from the system. The advantage of doing this on the main loop is that we
avoid spawning an additional background thread in the process (the
legacy logging apis use the background thread approach).

One added benefit of this change is it reduces the size of the
dart/flutter runner far packages by about 250kb in release mode, because
libsyslog.so and libbackend_fuchsia_globals.so are no longer needed.

flutter/flutter#141924

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2024-01-29 22:26:47 -06:00
Jason Simmons
33ff97be32 Truncate thread names on Linux to the maximum allowed length (flutter/engine#49781)
Also update some Impeller thread names to fit within that limit.
2024-01-16 17:02:34 +00:00
Chinmay Garde
c6b8349d0a Remove pthread based thread local support. (flutter/engine#49297)
The thread_local storage class was not available pre-C++11. Even when C++11 was available, the C++ runtime in versions of iOS <= 9.0 was not capable of supporting this storage class. So we ended up using pthread directly in that case. The unique pointer support was added later. Now that the storage class has been supported on all Flutter platforms for a while, we can remove the fallback and remove a bunch of code. The ThreadLocalUniquePtr can be removed too but that can be attempted in a separate migration.
2024-01-13 21:28:26 +00:00
Matej Knopp
6818b23a15 Enforce consistent stack size for Flutter threads (flutter/engine#49111)
Fixes https://github.com/flutter/flutter/issues/72156

*If you had to change anything in the [flutter/tests] repo, include a
link to the migration guide as per the [breaking change policy].*

## Pre-launch Checklist

- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [X] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [X] I signed the [CLA].
- [X] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2024-01-08 10:31:02 +01:00
Michael Brase
7c5452d3ae [fuchsia] Remove LoggingSocketTest.UseSyslogOnFuchsia test (flutter/engine#49524)
This test reads back logged messages on Fuchsia to verify that FML
logging has the log sink setup correctly. However, it relies on internal
implementation details of the Fuchsia log packet format, which recently
changed (to support structured logging) and it broke this test. Since
there isn't a supported way to parse structured log packets outside of
the Fuchsia repository, I'm removing this test to unblock the SDK roll.

flutter/flutter#140950
b/315973146

## Pre-launch Checklist

- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [X] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [X] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2024-01-04 00:30:03 -08:00
Matan Lurey
3aae0411b7 Automatically fix header guards in the rest of the flutter/engine repo. (flutter/engine#49059) 2023-12-15 04:11:06 +00:00
Dan Field
28fbba2098 Delete unused/test only code from FML (flutter/engine#48327)
This is more-or-less a revert of https://github.com/flutter/engine/pull/14011

This code never ended up being used outside of tests, and it's not how we handle asset loading at this point anyway.

I was hopeful we could kill off all runtime dependencies on Dart in `FML` when looking at this, but it looks like trace_event.h still wants to import dart_api_tools.h for some Dart enum types. This may or may not matter if we ever want to build FML for web/wasm. /cc @eyebrowsoffire. If we really need to do that, we can refactor the trace event stuff so that it has a web and Dart implementation that's selected at build time.
2023-11-22 20:49:56 +00:00
Matan Lurey
b1a29657a9 Make {flow|fml|impeller}/... compatible with .clang_tidy. (flutter/engine#48241)
Another few stragglers.
2023-11-21 18:53:06 +00:00
Matan Lurey
aa07289b98 Make fml/... compatible with .clang-tidy. (flutter/engine#48150) 2023-11-17 22:14:38 +00:00
Matan Lurey
6f19a763ec Actually make status_or.h compatible with .clang-tidy. (flutter/engine#48151)
I needed to actually convince the checker I wasn't causing a value read
on a non-value. I think this is right?
2023-11-17 09:07:05 -08:00
Matan Lurey
0371968293 Make fml/status_or.h compatible with .clang_tidy. (flutter/engine#48002)
Work towards https://github.com/flutter/flutter/issues/134969.
2023-11-15 18:08:56 -08:00
Matan Lurey
da57416cbe Re-land "Make fml/... compatible with .clang_tidy (flutter/engine#48030)
Reverts flutter/engine#48004
2023-11-16 00:09:24 +00:00
Chris Yang
c07e3193e7 [ios] introduce weak_nsobject (flutter/engine#47947)
Introduce weak_nsobject from chromium. 

There are some usages of weak_ptr wrapping Objective-C ids, weak_ptr is not really designed for ids and such usages are blocking the arc migration. 

This PR mostly copies the weak_nsobject from chromium, at the same hash that we copied the ARC/MRC compatible scoped_nsobject: fd625125b8

To match how we used weak_ptr for those ids, I made some changes to the weak_nsobject:
- WeakNSObjects needs to be generated by a WeakNSObjectFactory. The WeakNSObjectFactory is owned by the objc class and acts as the generator of the WeakNSObjects. All the WeakNSObjects' derefing thread should be the same of the WeakNSObjectFactory's creation thread.
- chromuim's WeakNSObjects can be detached from the thread and re-attached to a new thread. To match our weak_ptr behavior, I changed WeakNSObjects to be only accessed from a single thread, the same as weak_ptr

This PR also moves the FlutterEngine to use WeakNSObject and updated related classes.

part of https://github.com/flutter/flutter/issues/137801

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-15 23:43:24 +00:00
auto-submit[bot]
a934a9bcd8 Reverts "Make fml/... compatible with .clang_tidy." (flutter/engine#48004)
Reverts flutter/engine#47992
Initiated by: bdero
This change reverts the following previous change:
Original Description:
Work towards https://github.com/flutter/flutter/issues/134969.

All changes were made automatically (i.e. with `--fix`).
2023-11-14 00:17:26 +00:00
Matan Lurey
e47c5864ef Make fml/... compatible with .clang_tidy. (flutter/engine#47992)
Work towards https://github.com/flutter/flutter/issues/134969.

All changes were made automatically (i.e. with `--fix`).
2023-11-13 22:52:51 +00:00
gaaclarke
002ab77448 Expanded the performance lints (flutter/engine#47868)
fixes https://github.com/flutter/flutter/issues/137372

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-09 23:54:01 +00:00
Chris Yang
5c12a78db9 [ios] making objective-C smart pointers support ARC (flutter/engine#47612)
Moving the implementation from https://codereview.chromium.org/1855483004 into the code base, including:

- scoped_nsobject, scoped_nsprotocol, scoped_block will support both mrc and arc
- Added parent class scoped_typeref for shared code between scoped_block and scoped_nsobject
- moving OwnershipPolicy to its own file

The implementation of the smart pointers are almost identical to https://codereview.chromium.org/1855483004 besides some syntax preference differences between chromium and flutter.

This PR also migrated [VsyncWaiterIosTest.mm](https://github.com/flutter/engine/pull/47612/files#diff-c98ce1a2aca65c29bbc444523b66921a53ecce5ff39a420b4eda7dbfe8ca1cc7) to ARC with scoped_nsobject

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

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-07 19:25:45 +00:00
John O'Neil
58bb0adf2c Fix for undefined uint8_t seen on Clang-15+GCC13 (flutter/engine#47288)
This PR is to address an issue we're seeing compiling flutter+impeller in certain configurations. Specifically:

1. Compiling with `clang-15`
2. using the GCC 13 backend to provide headers and cstdlib.

Via the `clang-15` version flag:

```
clang-15 -v
Debian clang version 15.0.7
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/13
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/13
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
```

We were building using the gcc 12 backend for a while, but picked up an update that forced us to 13, and then saw this issue.

The issue is seen as `uint8_t` being undefined as in the following partial messages:

```
hex_codec.cc:18:5: error: unknown type name 'uint8_t'
base32.cc:29:32: error: unknown type name 'uint8_t'
```

I'm not sure this is the cleanest fix, or if it might be better handled by adding some compile time switches, but I wanted to provide this to start conversation.

I'm also hoping to get a better idea of tests run against a PR. If there's any I should run manually we can discuss that here.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-10-26 21:10:04 +00:00
Jonah Williams
792bf6d2e2 [Impeller] Allocate exact descriptor count, populate in one go. (flutter/engine#47200)
Rather than doing a guess and check, since we have all of our cmds already stored we can add up the binding counts and allocate the exact descriptor size and populate them in one call.

Also makes render_pass and compute_pass share more (though not all) code.
2023-10-24 19:22:38 +00:00