Resolves https://github.com/flutter/flutter/issues/157336
`DartByteData` gets raw pointers into the Dart heap via `Dart_TypedDataAcquireData`. So it must be destructed before `AssociateWithDartWrapper` is called, which mutates the heap.
Re-enables failing test for Linux unopt.
I suspect not flushing is related to occassionaly timeouts on flutter tester --enable impelller. because the flutter_tester never actually pumps a frame, it won't naturally flush these resources.
It shouldn't be harmful to otherwise flush.
Now that we don't have the entity pass structure, clips can be treated as a kind of structured data and not a generic entity. Doing so lets us simplify some of the clip management and remove some usage of raw pointers. This change also removes the ClipRestoreContents, which are only ever created and then immediately rendered - we can instead replace this with a function.
The ClipCoverageStack now has explicit Clip/Restore methods that internally apply the same logic, but without involving the entity object.
Redo of https://github.com/flutter/engine/pull/55784
I believe I got the entire API other than the enum values. Though most a straightforward, some could use some clarification.
The typography stuff should now be easier to use. The README describes the object model and reference counting conventions.
Fixes https://github.com/flutter/flutter/issues/157112
We currently track the number of backdrop filters in a frame. When the end of the frame is reached, we do a blit from the offscreen texture to the onscreen texture. Howeever, this extra blit is unecessary once we know we've rendered the last backdrop - and we can instead start the last render pass with the onscreen. This cuts out a fairly expensive blit.
this can only be done on iOS physical devices, vulkan, and some GLES - as emulated blends also use the backdrop.
## Before
Shader time is lower but timeline claims about 2.8ms and about ~800ms of blit pass.

## After
Timeline is ~2.1 ms with no blit pass. Tracks with numbers above.

Redo: https://github.com/flutter/engine/pull/55832
See the diff of diffs,
```
diff <(curl -s '1cd59a0c06.diff') <(curl -s 'ccea3b80cc.diff')
```
Or
```
48c48
< index 5258466145387..83aebdaacd9b6 100755
---
> index 5258466145387..3f74d19640d0f 100755
141,142c141,142
< + far_file = '%s_%s%s_runner-0.far' % (runner_type, mode, '_product' if product else '')
< + CopyPath('%s/%s' % (source_root, far_file), '%s/%s' % (destination, far_file))
---
> + far_file = '%s_%s%s_runner' % (runner_type, mode, '_product' if product else '')
> + CopyPath('%s/%s-0.far' % (source_root, far_file), '%s/%s.far' % (destination, far_file))
```
This change restores the files' -0 suffix which was wrongly removed in the last iteration.
=== Description of the original change:
This change removes the in-house built pm-based build rules in favor of the high level fuchsia_component / fuchsia_package in the gn-sdk.
Also the use of pm in build_fuchsia_artifacts.py is removed as the placements of the binaries changed.
https://github.com/flutter/engine/pull/55445 was a previous attempt and it generates [a malformatted cipd](https://chrome-infra-packages.appspot.com/p/flutter/fuchsia/+/vU1Op26qgO5XYs9S8AqQMvBwgITD9hq3-2dIu2H5-iwC).
Bug: http://b/353729557, http://b/368608542
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
The engine API for Android's Scribe stylus handwriting input. Just bare bones handwriting itself, does not support special gestures, which will come in subsequent PR(s).
This is a re-land of the reverted PR, flutter/engine#55916 (it depended
on a dart roll that was reverted, and has subsequently been re-landed).
From the original PR:
> The SoT repository for `package:file` has changed from
google/file.dart to dart-lang/tools; this PR updates the DEPS file and
the hard-coded paths in the two pubspec.yaml files (see
https://github.com/dart-lang/tools/issues/674).
ImageReaderSurfaceProducer will request a frame when an image is enqueued. But there is no guarantee that each request will produce an additional frame.
Multiple requests happening within one vsync interval could be merged into one frame. If no other frame is scheduled, then some images will remain in the queue and the image shown on screen will not be the latest image.
With this change, ImageReaderSurfaceProducer will continue requesting frames after consuming an image if the queue is not empty.
Fixes https://github.com/flutter/flutter/issues/156903
Fixes https://github.com/flutter/flutter/issues/155787
Impeller geometry class analogous to SkRRect - soon to be the standard round rectangle class throughout most of the engine that doesn't talk directly to Skia.
More unit tests are being written, but this PR will enable developers to look at the API of the new class and comment as well as test its effect on any goldens (there should be none).
Coming back to this from the previous attempt: https://github.com/flutter/engine/pull/50139
* Even if its slower sometimes, its also way faster on more complex scenes
* The adreno bugs seem limited to older devices.
Conservatively, only enable batching for Mali and newer Adreno
On non vulkan backend we immediately submit.
Ideally the tests would mock gdk_keymap_lookup_key, but I wasn't able to get it working so I've added fl_keyboard_manager_set_lookup_key_handler for now.
Previously, we dispatched a task to a background thread to wait for the first frame to be ready. In the background task, we then throw a task on the main thread that invokes that user-provided callback to notify them that the first frame is ready.
During ARC migration, we ensured that self was strongly-captured in the task that runs on the main thread, in order to prevent the possibility that the last remaining reference to the FlutterEngine instance be the one on the background thread.
However, with the previous code, it's possible that the callback is dispatched to the main thread, executes, and completes before the block on the background thread finishes. In that case, the last remaining FlutterEngine reference may *still* be the one on the background thread.
In order to prevent this scenario, we use `dispatch_group_notify` to ensure that the tasks are executed sequentially, and that the callback task is not dispatched to the main thread until the background task has completed. Further, we capture FlutterEngine strongly in the second task to ensure that *it* is the last remaining task.
Why do we need to capture self strongly in the task fired to the main queue? Imagine the following:
* We queue up the first task on the background thread.
* We queue up the callback task on the main thread to be executed only after the background task completes.
* The task on the background thread starts running.
* That task captures weakSelf strongly and checks it -- it's not nil, yay.
* That task now makes the blocking first frame call. Time passes. While that time passes all other strong references to self go away. That second block only captured self weakly, so the background task now has the only remaining strong reference. Uh oh!
* We hit the end of the background task block and since we have the last remaining strong reference, we dealloc FlutterEngine... on the background thread.
* KABOOM.
No changes to tests since this is a fix to a race condition that doesn't affect app semantics, isn't testable as written, and adding shims to improve testability will likely make some already subtle/difficult-to-reason-about code even more complex and difficult to reason about.
Issue: https://github.com/flutter/flutter/issues/156177
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
When run repeatedly, some of the iOS unit tests can relatively easily
blow their test timeouts. Since we're testing behaviour and not
performance in these tests there's no need to enforce a particular
timeout.
The bots will fail if the tests timeout, regardless.
Otherwise with backdrop filters we create and throw away a single fullscreen texture every frame. Very wasteful!
Does not impact iOS because it has the read from resolve option. Removed some unused parts of the inline_pass_context that were only used in the entity pass days.
Fixes https://github.com/flutter/flutter/issues/156361
cc @lyceel. A bit of miscommunication on the priority of this one. I
thought the default font factories were sufficient for the next release.
But it turns out that was not true on the board which is a custom
platform.
In any case, this should unblock custom font registrations. See the
`CanCreateParagraphsWithCustomFont` case for an example. If you don't
provide the family name alias for the custom font, the name will be read
from the font data. This example uses the custom "WhatTheFlutter" custom
font family in "wtf.otf".
<img width="1136" alt="Screenshot 2024-10-17 at 1 26 36 PM"
src="https://github.com/user-attachments/assets/dbbef2fd-f854-4330-8c82-fc8378489769">
This reverts commit 0a9ed4763365f84be6f92f23abf13c778593715c.
This relands commit 530a9f896c3547fd5e27539e9049fae392d61e73.
That commit was a reland of a2ac734e10115547d8c8ef34610ea6172e3cc98b.
Migrates `FlutterEngine` from manual reference counting to ARC. Migrates properties from `retain` to strong and `assign` to `weak` (where referencing an Obj-C object).
This has the following change from the previous patch:
* startProfiler was updated to eliminate the self-capture in https://github.com/flutter/engine/pull/55957 which prevents the possibility of dealloc on the profiling thread.
No semantic changes, therefore no changes to tests.
Issue: https://github.com/flutter/flutter/issues/137801
Issue: https://github.com/flutter/flutter/issues/156177
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style