335 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
Chris Yang
eacae26086 Refactor: fix typo "setup" -> "set up" (flutter/engine#43824)
There are several places in the engine using the word "setup" incorrectly. I have changed them to "set up"

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-07-21 17:06:34 +00:00
Tong Mu
489f9c3d01 Make updating window metrics multi-view (flutter/engine#43366)
This PR adds multi-view support to various methods that updates the window metrics by adding a `view_id` parameter.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-07-08 05:54:16 +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
Zachary Anderson
af94169054 Check more optional accesses (flutter/engine#42528)
Related https://github.com/flutter/flutter/issues/127701
2023-06-05 08:38:32 -07:00
Kevin Lubick
8666e1af8f Register codecs with Skia explicitly (flutter/engine#42320)
In http://review.skia.org/689016, Skia added an option to explicitly
register codecs to use (instead of relying on #defines set by BUILD.gn
rules.

This uses that mechanism to explicitly register all the codecs that
Flutter was currently using from Skia (at least by my read of
[tools/gn](fee0534882/tools/gn (L292)).

I'm not sure if there is another place I need to put this sort of code,
e.g. for Fuchsia things.

To really test this out, we would want to add a define of
SK_DISABLE_LEGACY_INIT_DECODERS when compiling Skia, but I'm not sure
the best place to do this.

## 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].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I added new tests to check the change I am making or feature I am
adding, or Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [ ] 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
[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
2023-05-31 14:15:18 -04: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
Dan Field
83b6fa4ff7 [Impeller] Avoid encoding metal commands while the GPU is unavailable when decoding images. (flutter/engine#42349)
Fixes https://github.com/flutter/flutter/issues/126878

This disables device private upload on iOS when backgrounded, and disables mipmap generation when backgrounded.

We don't have a good way to test the core problem in this repo because it only reproduces on physical iOS hardware - simulators don't really care if you do this stuff in the background.

I'll write a devicelab test in the framework to capture this. In the mean time it can be reviewed.

We could consider making the IOManager a shared_ptr instead of having an fml::WeakPtr and that'd clean up some of the extra arguments to engine construction - or we could consider vending the sync switch from impeller::Context unconditionally, but it's pretty iOS specific...
2023-05-26 18:46:33 +00:00
Dan Field
f9b687885e [Impeller] avoid creating multiple concurrent message loops for Andorid Vulkan (flutter/engine#42146)
Fixes https://github.com/flutter/flutter/issues/127160

We should avoid creating multiple message loops that each have as many threads as processors on the machine.
2023-05-20 03:41:18 +00:00
Dan Field
ea5131772d Add a Display API to dart:ui that reports the physical size, DPR, and refresh rate of the main display (flutter/engine#41685)
Fixes https://github.com/flutter/flutter/issues/123307 - for Android, iOS, and Web, for the main display only (https://github.com/flutter/flutter/issues/125938 tracks supporting multiple displays, https://github.com/flutter/flutter/issues/125939 for desktop).

Desktop will need to be implemented for this, but given priority for a couple of our customers targetting foldable devices on Android I'm inclined to get this in before desktop can be finished.

The main concern for this right now is that on some Android foldable devices, setting a preferred orientation will cause letterboxing and the `MediaQuery` will _never_ get the full screen size when unfolded. This causes apps to think the screen is smaller than it is, as they've mainly been using `MediaQueryData.size` to figure this out. Android's recommendation is to not set a preferred orientation, and if you must to use the new method introduced in `ViewUtil.java` to calculate the maximal window size.
2023-05-06 18:28:22 +00:00
Dan Field
b156f07ddc [Impeller] Allow image rasterization/decoding before/without surface acquisition (flutter/engine#41168)
[Impeller] Allow image rasterization/decoding before/without surface acquisition
2023-04-14 03:02:17 +00:00
Ahmed Ashour
51c0a9ec65 Remove superfluous words from comments (flutter/engine#39068)
* Remove superfluous words.

* Format

* Duplicate in consecutive lines.
2023-01-24 09:54:19 -08:00
Chris Bracken
dc3033d922 Clarify semantics action dispatch id parameter (flutter/engine#38356)
Previously the embedder API documented this as an action ID, but it's
actually the semantics node ID. This fixes the docs and renames the
parameter to clarify its purpose.

This callback is registered in the framework render bindings:
9102f2fe0b/packages/flutter/lib/src/rendering/binding.dart (L43)

Handled by `_handleSemanticsAction`:
9102f2fe0b/packages/flutter/lib/src/rendering/binding.dart (L360-L366)

Which invokes `SemanticsOwner.performAction`, where the node is looked up by ID:
9102f2fe0b/packages/flutter/lib/src/semantics/semantics.dart (L3258-L3277)
2022-12-16 13:40:48 -08:00
Dan Field
020577edbb Make NotifyIdle reject close and past deadlines. (flutter/engine#37737)
This patch also eliminates some extraneous tracing that is happening
every frame. It is possible to get the same trace calls by enabling
the API stream if needed.

Also refactors the NotifyIdle callsites to just always work in
TimeDeltas rather than converting back and forth between them and
TimePoints, which I think reads more clearly.
2022-11-18 18:17:53 +00:00
Siva
7296b2b66d Add call to Dart_NotifyDestroyed when the flutter view is destroyed. (flutter/engine#37539)
* Add calls to Dart_NotifyDestroyed when the flutter view is destroyed.

* Add unit test case.

* Format.

* Ensure the destroy task runs.

* Address code review comments.
2022-11-17 13:11:21 -08:00
Dan Field
181a1728f1 Always use fml::TaskRunnerAffineWeakPtr for SnapshotDelegate (flutter/engine#36772) 2022-10-14 18:09:29 -07:00
gaaclarke
e41c775200 Removed instances of unnecessary values (flutter/engine#36221) 2022-09-26 21:28:04 +00:00
gaaclarke
6b2a14d348 Isolate platform channels for desktop (flutter/engine#35893) 2022-09-20 23:56:04 +00:00
Dan Field
08312a825e Lint and fix bugprone-use-after-move violations (flutter/engine#35978) 2022-09-09 02:41:03 +00:00
gaaclarke
42c469183e Started handling messages from background isolates for iOS (flutter/engine#35174) 2022-09-08 00:03:27 +00:00
yaakovschectman
8e3c8bc88f Engine startup event timed after VM initializes (flutter/engine#35713)
* Engine startup event timed after VM initializes

* Formatting

* Update FlutterEngineMainEnter event comment

* Remove engine_start_time

* Remove unused variable
2022-08-31 10:48:44 -04:00
xiaomiao
d490b4edae Move task running to UI thread for loadDartDefferredLibrary. (flutter/engine#35460) 2022-08-18 16:43:24 +00:00
Dan Field
132ab1a321 Reland toImageSync (flutter/engine#35283) 2022-08-09 22:32:04 +00:00
Dan Field
abbca7b5e4 Revert "Collect textures from toImageSync safely (#35073)" (flutter/engine#35281)
This reverts commit 1f9bb2c26554f53995e7d02afc54a5566ad3310c.
2022-08-09 14:32:32 -07:00
Dan Field
1f9bb2c265 Collect textures from toImageSync safely (flutter/engine#35073) 2022-08-09 13:21:59 -07:00
Jonah Williams
1245043020 Support hot reload of asset fonts (flutter/engine#35213) 2022-08-08 18:06:05 +00:00
Zachary Anderson
ab33453a89 Roll mac clang, ignore spurious lints (flutter/engine#35196) 2022-08-05 15:50:08 -07:00
Jonah Williams
43c54b4b98 Update setAssetDirectory service extension to fail if provided path is invalid (flutter/engine#35178) 2022-08-05 15:47:04 +00:00
ColdPaleLight
e1fe7327b1 Use the correct 'SnapshotDelegate' in 'RuntimeController::Spawn' (flutter/engine#34523) 2022-07-13 01:09:04 +00:00
Chinmay Garde
20def47959 Remove unactionable verbose log about ignored viewport metrics. (flutter/engine#34231) 2022-06-22 12:34:06 -07:00
Jonah Williams
728640769b dont pixel snap raster cache if SUPPORT_FRACTIONAL_TRANSLATION is enabled (flutter/engine#34002) 2022-06-13 16:43:05 -07:00
Kaushik Iska
d5be7dccbc transform bounds to device space before sending to vmservice (flutter/engine#33853) 2022-06-06 14:28:04 -07:00
ColdPaleLight
b1ad898b4e Correct the frame timing in 'Rasterizer::Draw' when pipeline is more available (flutter/engine#32283) 2022-06-03 10:18:06 -07:00
Kaushik Iska
916f9bcab5 Fix layer tree snapshot values (flutter/engine#33753) 2022-06-01 10:18:05 -07:00
Kaushik Iska
796e65f687 Layer snapshots also contain bounds information (flutter/engine#33615) 2022-05-25 11:43:04 -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
ColdPaleLight
e9f78111c6 Clean obsolete 'shared_resource_context' (flutter/engine#32521) 2022-04-14 13:24:05 -07:00
Kaushik Iska
d8e73006e0 Add service protocol method to facilitate getting snapshots (flutter/engine#32628) 2022-04-13 13:39:05 -07:00
ColdPaleLight
31e332ee32 Tuning resource cache max bytes in lightweight engine scenarios (flutter/engine#32156) 2022-03-31 21:11:05 -07:00
Chinmay Garde
351494f717 Add support for images in display lists. (flutter/engine#32268) 2022-03-30 13:31:37 -07:00
Chris Yang
840af99590 Make Get GetVsyncWaiter return weak_ptr to prevent dangling pointer crash (flutter/engine#32121) 2022-03-21 11:05:05 -07:00
ColdPaleLight
05bb17d606 Always update the latest frame target time when the 'Animator::Render' method is called (flutter/engine#31973) 2022-03-21 09:35:02 -07:00
Chinmay Garde
34f3581a3c Switch the renderer to impeller based on the presence of a command line flag. (flutter/engine#31959)
Specifying the `--enable-impeller` flag will switch the renderer to using
Impeller instead of Skia. On platforms where Impeller is not supported, this
flag is ignored.

The notion of the `flutter::SurfaceFrame` has been augmented. Now, in the
absence of a Skia surface to render to, the surface frame will render into a
display list instead.

Impeller variants of the context and surface variants have been added to
`shell/gpu` and `shell/platform`. The variants prepare surface frames that
don’t/can’t specify a Skia surface thus forcing the surface frame to render to a
display list instead. Then, in the submit callback, they forward the display
list ops to the Impeller display list dispatcher.

This scheme has been chosen as it requires the fewest updates to engine
internals which all depend on Skia data structures. Instead of updating all
call-sites to be Skia neutral, the display list interface itself is being made
graphics package agnostic.
2022-03-15 14:12:53 -07:00
ColdPaleLight
043d9d2e39 Add an embedder.h API for scheduling frame (flutter/engine#31304) 2022-02-17 13:24:10 -08:00
Emmanuel Garcia
d1d733c608 Conditionally call FlutterViewDestroyOverlaySurfaces (flutter/engine#31464) 2022-02-17 12:19:02 -08:00
Emmanuel Garcia
9315ec14d1 Reland: Teardown external view embedder prior to unmerging threads (flutter/engine#31122) 2022-02-03 11:55:04 -08:00
ColdPaleLight
58e15e00e3 Don't pause Animator when lifecycle state paused (flutter/engine#30969) 2022-01-27 15:55:07 -08:00
ColdPaleLight
b64598bef6 Refactor type of deadline in the method NotifyIdle to fml::TimePoint (flutter/engine#30737) 2022-01-19 17:25:09 -08:00
gaaclarke
1724b4f192 Reland: iOS Background Platform Channels (#29665) (flutter/engine#30697)
* iOS Background Platform Channels (#29665)

* added test that passes before this change, and fails after it

* started supporting backwards compatible usage of setting handlers
2022-01-12 09:57:29 -08:00
Chris Yang
a50ebf3955 Variable Refresh Rate Display (flutter/engine#30223) 2022-01-11 10:55:10 -08:00