144 Commits

Author SHA1 Message Date
Jonah Williams
aadc2d3094 Add ImmutableBuffer.fromFilePath (flutter/engine#36623) 2022-10-05 22:18:03 +00:00
gaaclarke
e41c775200 Removed instances of unnecessary values (flutter/engine#36221) 2022-09-26 21:28:04 +00:00
Dan Field
63e8e223aa [Impeller] toImageSync for Impeller (flutter/engine#36365) 2022-09-23 20:31:03 +00:00
gaaclarke
42c469183e Started handling messages from background isolates for iOS (flutter/engine#35174) 2022-09-08 00:03:27 +00:00
ColdPaleLight
e1fe7327b1 Use the correct 'SnapshotDelegate' in 'RuntimeController::Spawn' (flutter/engine#34523) 2022-07-13 01:09:04 +00:00
Jonah Williams
8aef5df7b1 Add support for loading asset directly from ImmutableBuffer (flutter/engine#32999) 2022-05-10 19:39:04 -07:00
Dan Field
9e46531319 Remove redundant trace events (flutter/engine#32812) 2022-04-21 13:28:03 -07:00
gaaclarke
eb45cf1c9d Fixed image generator registry usage with spawn. (flutter/engine#31622) 2022-03-17 13:10:11 -07: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
eggfly
6b1d2dcdbc Share the io_manager between parent and spawn engine (flutter/engine#29915) 2021-12-01 10:34:01 -08:00
eggfly
d18f5c8223 Reset viewport_metrics when spawn new Engine (flutter/engine#29876)
Co-authored-by: zsunkun <zsunkun@163.com>
2021-11-24 09:49:08 -08:00
ColdPaleLight
9ecd4c1899 Make FlutterEngineGroup support dart entrypoint args (flutter/engine#29096) 2021-11-18 18:08:03 -08:00
Tong Mu
5183c56533 [Embedder] Send key data through message channel (flutter/engine#29795)
This PR changes how embedder API's SendKeyData sends ui.KeyData to the framework. The packets are now sent over the existing platform messenger, reusing the entirety of its code path and functionalities while keeping the embedder API unchanged
2021-11-18 17:53:28 -08:00
Dan Field
f1dae7ad34 Delay default font manager to run concurrently with isolate setup (flutter/engine#29291)
* Delay default font manager to run concurrently with isolate setup

* test
2021-10-21 16:20:32 -07:00
Jonah Williams
ccae44ffd0 Surface frame number identifier through window (flutter/engine#26785) 2021-06-28 10:16:01 -07:00
Dan Field
3bc015dc10 Remove tech debt related to image disposal and layer GC (flutter/engine#26870)
* remove tech debt

* Fix test
2021-06-25 15:33:08 -07:00
Brandon DeRosier
a83c8ab61d Refactor: Group together externally-managed UIDartState. (flutter/engine#26247)
Group together externally-managed UIDartState.

It's a frequent pattern to enable access to shell resources from the
framework via UIDartState. These handles are passed through several
other objects, where they lay mostly dormant. This refactor just aims
to ease maintenance of this state.

UIDartState is essentially just an easy to extend bus for dropping
off the shell kids in UIDartState, with constructors/operators that
remove the need for providing a full initializer lists in unittests.
2021-05-20 18:01:53 -07:00
Brandon DeRosier
b9982cdec7 Add image generator registry (flutter/engine#25987)
Add image generator protocol and priority registry.

The protocol supports multi-frame images as well as optional
subpixel/downsampled decoding.
2021-05-17 12:12:46 -07:00
gaaclarke
4d98fd9744 Switch PlatformMessages to hold data in Mappings (flutter/engine#25867) 2021-05-13 10:28:25 -07:00
gaaclarke
1734ce7f8a Moved PlatformMessage's to unique_ptrs (flutter/engine#25860) 2021-05-06 20:19:01 -07:00
Chris Bracken
13cf185e1c Correct setup-related typos (flutter/engine#24846)
Corrects uses of setup as a verb to 'set up', leaves noun/noun-phrase
forms of setup as 'setup'. Also settles on 'teardown' as opposed to
tear-down for consistency across the codebase.

A few other minor comment/wording corrections.
2021-03-08 17:31:10 -08:00
gaaclarke
9f222fa212 Fixed plumbing of the spawning isolate for Shell::Spawn. (flutter/engine#24112) 2021-02-01 15:32:15 -08:00
Tong Mu
ee1cc9f5ab Hardware keyboard: Web, embedder, and dart:ui (flutter/engine#23466) 2021-01-28 17:19:02 -08:00
Dan Field
e778949043 Reland path vol tracker (flutter/engine#23840)
This time making sure to deref the native object on GC.
2021-01-21 16:03:43 -08:00
Dan Field
cb57183325 revert path volatility tracker (flutter/engine#23822) 2021-01-21 08:34:02 -08:00
gaaclarke
dbc486213c Plumbing refactor to allow the usage of Dart_CreateIsolateInGroup (flutter/engine#23549)
Did the plumbing refactor that allows us to call Dart_CreateIsolateInGroup when applicable.
2021-01-12 16:43:12 -08:00
Dan Field
dedf9bd1af Reland path volatility tracker, disabling it if deterministic rendering is requested (flutter/engine#23226)
* Reland path volatility tracker (#23063)" (#23220)

This reverts commit b56fc25561417f96e17dacab375e66f474a54c94.

* allow disabling based on whether deterministic rendering is needed
2020-12-22 08:25:20 -08:00
Dan Field
b56fc25561 Revert "Reland path volatility tracker (#23063)" (flutter/engine#23220)
This reverts commit 77c7096efb0b1392acc9793c386561a3c36012ba.
2020-12-21 13:53:18 -08:00
Dan Field
77c7096efb Reland path volatility tracker (flutter/engine#23063)
* Revert "Revert "Set SkPath::setIsVolatile based on whether the path survives at least two frames (#22620)" (#23044)"

This reverts commit feda80cb42f99e2588a9a6b9ab3dd1f812d0f45b.

* Fix tracing
2020-12-14 17:21:55 -08:00
Dan Field
feda80cb42 Revert "Set SkPath::setIsVolatile based on whether the path survives at least two frames (#22620)" (flutter/engine#23044)
This reverts commit 2d52a3c87c97660a050e4bf5559091d0cec262f3.
2020-12-11 15:39:24 -08:00
Dan Field
2d52a3c87c Set SkPath::setIsVolatile based on whether the path survives at least two frames (flutter/engine#22620)
This patch defaults the volatility bit on SkPaths to false, and then flips it to true if the path survives at least two frames.
2020-12-10 13:57:23 -08:00
Gary Qian
19afd06afc Add split AOT loading unit failure/error code path (flutter/engine#22857) 2020-12-08 22:58:01 -08:00
Gary Qian
9352ed557e Split AOT Engine Runtime (flutter/engine#22624) 2020-12-02 13:28:01 -08:00
Jason Simmons
73ea2c2fea Remove some obsolete code from RuntimeController (flutter/engine#22091) 2020-10-26 10:42:02 -07:00
Greg Spencer
06b6f8af89 Reland: Migration to PlatformDispatcher and multi-window (flutter/engine#21932)
This re-lands #20496 and #21780 after fixing the semantics-enabling code that was causing the post-submit web_smoke_test to fail.

Below is the description from the original PR:

This is a PR for converting the dart:ui code in the engine to use a multi-window API. The goal here is to convert from the window singleton to an API that has the concept of multiple windows. Also, I'm matching up the new PlatformDispatcher class to talk directly to the PlatformConfiguration class in the engine. I'm not attempting to actually enable creating multiple windows here, just migrate to an API that has a concept of multiple windows. The multi-window API in this PR currently only ever creates one window.

The design doc for this change is here.

The major changes in this PR:

Move the platfom-specific attributes out of Window, and into the new PlatformDispatcher class that holds all of the platform state, so that the platform code need only update the configuration on this class.
Create FlutterView, FlutterWindow, and SingletonFlutterWindow classes to separate out the concepts of a view (of which there may be multiple in a window), a window (of which there may be multiple on a screen, and they host views), and a window where there is only ever expected to be one (this hosts the entire API of the former Window class, and will eventually be the type of the window singleton).
Next step after this PR lands:

Remove the Window class entirely (it is replaced by SingletonFlutterWindow). Some minor changes in the Framework are needed to switch to using SingletonFlutterWindow directly first.

The Window class still exists in this PR, but will be removed as soon as the framework is converted to point to the SingletonFlutterWindow class instead. They share the same API, just have different names (Window is currently a subclass of SingletonFlutterWindow). The intention is that the Window name will be freed up to use as a widget class name in the framework for managing windows. The singleton called window will remain, and keep the same API it has now.
2020-10-22 14:54:25 -07:00
Chinmay Garde
c721e67cb7 Isolates launched by the engine instance use the settings of that instance. (flutter/engine#22052)
This regression was introduced in https://github.com/flutter/engine/pull/21820
for sound-null safety. The settings used to launch the VM were incorrectly used
to determine the isolate lifecycle callbacks. Since the first shell/engine in
the process also starts the VM, these objects are usually identical. However,
for subsequent engine shell/engine launches, the callbacks attached to the new
settings object would be ignored. The unit-test harness is also structured in
such a way that each test case tears down the VM before the next. So all
existing tests created a bespoke VM for the test run, and, the tests that did
create multiple isolates did not also test attaching callbacks to the settings
object.

Fixes https://github.com/flutter/engine/pull/22041
2020-10-22 02:20:50 -07:00
Jason Simmons
a66f8a65ad Restore missing call to RuntimeDelegate.OnRootIsolateCreated (flutter/engine#21953)
Fixes https://github.com/flutter/flutter/issues/68411
2020-10-17 20:33:13 -07:00
Chris Bracken
2a726cbb36 Eliminate unnecessary linter opt-outs (flutter/engine#21935)
Eliminates FLUTTER_NOLINT where they can be landed without triggering
lint failures.
2020-10-16 17:24:23 -07:00
Chinmay Garde
db5c793ed5 Enable loading snapshots with sound null safety enabled. (flutter/engine#21820)
Snapshots compiled with sound null-safety enabled require changes to the way in
which isolates are launched. Specifically, the `Dart_IsolateFlags::null_safety`
field needs to be known upfront. The value of this field can only be determined
once the kernel snapshot is available. This poses a problem in the engine
because the engine used to launch the isolate at shell initialization and only
need the kernel mappings later at isolate launch (when transitioning the root
isolate to the `DartIsolate::Phase::Running` phase). This patch delays launch of
the isolate on the UI task runner till a kernel mapping is available. The side
effects of this delay (callers no longer having access to the non-running
isolate handle) have been addressed in this patch. The DartIsolate API has also
been amended to hide the method that could return a non-running isolate to the
caller.  Instead, it has been replaced with a method that requires a valid
isolate configuration that returns a running root isolate. The isolate will be
launched by asking the isolate configuration for its null-safety
characteristics.

A side effect of enabling null-safety is that Dart APIs that work with legacy
types will now terminate the process if used with an isolate that has sound
null-safety enabled. These APIs may no longer be used in the engine. This
primarily affects the Dart Convertors in Tonic that convert certain C++ objects
into the Dart counterparts. All known Dart Converters have been updated to
convert C++ objects to non-nullable Dart types inferred using type traits of the
corresponding C++ object. The few spots in the engine that used the old Dart
APIs directly have been manually updated. To ensure that no usage of the legacy
APIs remain in the engine (as these would cause runtime process terminations),
the legacy APIs were prefixed with the `DART_LEGACY_API` macro and the macro
defined to `[[deprecated]]` in all engine translation units. While the engine
now primarily works with non-nullable Dart types, callers can still use
`Dart_TypeToNonNullableType` to acquire nullable types for use directly or with
Tonic. One use case that is not addressed with the Tonic Dart Convertors is the
creation of non-nullable lists of nullable types. This hasn’t come up so far in
the engine.

A minor related change is reworking tonic to define a single library target.
This allows the various tonic subsystems to depend on one another. Primarily,
this is used to make the Dart convertors use the logging utilities. This now
allows errors to be more descriptive as the presence of error handles is caught
(and logged) earlier.

Fixes https://github.com/flutter/flutter/issues/59879
2020-10-16 14:53:26 -07:00
Yuqian Li
0c645869e3 Revert "Migration to PlatformDispatcher and multi-window #20496" (flutter/engine#21792)
* Revert "Fix documentation build for window changes. (#21780)"

This reverts commit a539d91840d2fbbb4aa07eeed6a92d654db167ab.

* Revert "Migration to PlatformDispatcher and multi-window (#20496)"

This reverts commit a58fec63f196175eedfc5fbaedce9336dab5c508.
2020-10-12 19:26:41 -07:00
Yuqian Li
34774974ab Reland "Create root isolate asynchronously (#20142)" (flutter/engine#21747)
This reverts commit 19ebd61442fd3bf6a69af2156c8b118fc8578ec2.

Additionally, the following _flutter.runInView deadlock is fixed.

Previously, a deadlock would occur when service protocol
_flutter.runInView is used to restart the engine wihtout tearing down
the shell: the shared mutex of the service protocol will be locked
during the restart as it's in the middle of handling a service protocol
message; if ServiceProtocol::AddHandler is also called during the
restart, the deadlock happens as AddHandler also requires such lock.

test/integration.shard/background_isolate_test.dart would fail
without this fix.
2020-10-12 12:02:30 -07:00
Greg Spencer
a58fec63f1 Migration to PlatformDispatcher and multi-window (flutter/engine#20496)
This is a PR for converting the dart:ui code in the engine to use a multi-window API. The goal here is to convert from the window singleton to an API that has the concept of multiple windows. Also, I'm matching up the new PlatformDispatcher class to talk directly to the PlatformConfiguration class in the engine. I'm not attempting to actually enable creating multiple windows here, just migrate to an API that has a concept of multiple windows. The multi-window API in this PR currently only ever creates one window.

The design doc for this change is here.

The major changes in this PR:

Move the platfom-specific attributes out of Window, and into the new PlatformDispatcher class that holds all of the platform state, so that the platform code need only update the configuration on this class.
Create FlutterView, FlutterWindow, and SingletonFlutterWindow classes to separate out the concepts of a view (of which there may be multiple in a window), a window (of which there may be multiple on a screen, and they host views), and a window where there is only ever expected to be one (this hosts the entire API of the former Window class, and will eventually be the type of the window singleton).
Next step after this PR lands:

Remove the Window class entirely (it is replaced by SingletonFlutterWindow). Some minor changes in the Framework are needed to switch to using SingletonFlutterWindow directly first.

The Window class still exists in this PR, but will be removed as soon as the framework is converted to point to the SingletonFlutterWindow class instead. They share the same API, just have different names (Window is currently a subclass of SingletonFlutterWindow). The intention is that the Window name will be freed up to use as a widget class name in the framework for managing windows. The singleton called window will remain, and keep the same API it has now.
2020-10-09 16:29:16 -07:00
Dan Field
f83e92cbaf Use hint freed specifically for image disposal (flutter/engine#20754)
* Use hint freed specifically for image disposal
2020-09-02 13:41:58 -07:00
Yuqian Li
19ebd61442 Revert "Create root isolate asynchronously (#20142)" (flutter/engine#20937)
This reverts commit b3bb6df94c4537240fb563c2394c18ed984a82df.
2020-09-01 22:05:53 -07:00
chenjianguang
b3bb6df94c Create root isolate asynchronously (flutter/engine#20142)
## Description
As the related issue refer, the application may be doing too much work on its main thread even in a simple hello_world demo.
That is because the creation of `Engine` on the ui thread takes a noticeable time, and it is blocking the platform thread in order to run `Shell::Setup` synchronously.
The cost of `Engine`'s constructor is mainly about the creating of root isolate. Actually, there used to be another time-consuming process, the default font manager setup, which was resolved by https://github.com/flutter/engine/pull/18225. 
Similar to https://github.com/flutter/engine/pull/18225, this pr move the creation of root isolate out from creating `Engine`. After this action, the main thread blocking is quite an acceptable slice.

## Related Issues
https://github.com/flutter/flutter/issues/40563 could be resolved by this pr.
2020-09-01 13:31:00 -07:00
Dan Field
35d014eee7 Revert hint_freed (flutter/engine#20746)
This caused over-aggressive GCs, which vastly increased CPU usage benchmarks.

* Revert "fix build (#20644)"

This reverts commit 5e03f90cdd9392f95b47d08b398c18cab6d16b12.

* Revert "Hint freed (#19842)"

This reverts commit 73490a2ca444c8ca491712cde21a459453af8795.
2020-08-25 11:55:40 -07:00
Dan Field
73490a2ca4 Hint freed (flutter/engine#19842)
* Hint the VM when a layer or picture goes out of scope
2020-08-19 14:04:31 -07:00
gaaclarke
852cb9d5c4 Added unit tests to the engine. (flutter/engine#20216) 2020-08-07 15:55:58 -07:00
Mehmet Fidanboylu
59b75c2dcd Fix inconsistent import. (flutter/engine#20206) 2020-08-03 10:29:52 -07:00
Greg Spencer
e994f832d2 Move platform specific information to PlatformConfiguration class (flutter/engine#19652) 2020-07-31 17:21:02 -07:00