492 Commits

Author SHA1 Message Date
Zachary Anderson
c4f4e564da Unconditionaly enable some tracing on startup (flutter/engine#23729) 2021-01-15 22:22:20 -08:00
gaaclarke
8af69442c0 share font collections between spawn engines (flutter/engine#23603) 2021-01-13 11:38:48 -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
Jason Simmons
095b5d15fb Provide a runtime switch for selecting SkParagraph text layout (flutter/engine#23474) 2021-01-07 12:59:03 -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
Gary Qian
d7ab4b01cd Disable flaky/hanging split AOT test (flutter/engine#23070) 2020-12-15 21:18:07 -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
zljj0818
0ef14f3ca3 More rename from GPU thread to raster thread (flutter/engine#22819) 2020-12-03 15:03:02 -08:00
Gary Qian
9352ed557e Split AOT Engine Runtime (flutter/engine#22624) 2020-12-02 13:28:01 -08:00
Daco Harkes
b6c5eff614 WeakPersistentHandle migration (flutter/engine#19843)
and roll Dart to 52783837369de45d3372cb6c6b7cdd63e71cd829.
2020-11-03 13:06:53 +01: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
Chinmay Garde
288c5ee97d Ensure root isolate create callback is invoked before the isolate is in the running phase. (flutter/engine#22041)
Embedders that have access to the Dart native API (only Fuchsia now) may perform
library setup in the isolate create callback. The engine used to depend on the
fact the root isolate entrypoint is invoked in the next iteration of message
loop (via the `_startIsolate` trampoline in `isolate_patch.dart`) to ensure that
library setup occur before the main entrypoint was invoked. However, due to
differences in the way in which message loops are setup in Fuchsia, this
entrypoint was run before the callback could be executed. Dart code on Fuchsia
also has the ability to access the underlying event loops directly. This patch
moves the invocation of the create callback to before user dart code has a
chance to run. This difference in behavior on Fuchsia became an issue when the
isolate initialization was reworked in https://github.com/flutter/engine/pull/21820
for null-safety.

Another issue was discovered in that the callback was being invoked twice, I
fixed that too and added a test.

Fixes https://github.com/flutter/flutter/issues/68732
2020-10-21 15:57:10 -07:00
Chinmay Garde
c0f4a193b0 Determine null-safety isolate flags for launches of the service isolate. (flutter/engine#22013) 2020-10-20 16:57:01 -07:00
Clement Skau
559463b492 Enable lazy-async-stacks by-default in all modes (Take 4) (flutter/engine#21802) 2020-10-20 10:31:15 +02: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
Chris Bracken
2586db3b22 Clean up C++ includes (flutter/engine#21127)
Cleans up header order/grouping for consistency: associated header, C/C++ system/standard library headers, library headers, platform-specific #includes.

Adds <cstring> where strlen, memcpy are being used: there are a bunch of places we use them transitively.

Applies linter-required cleanups. Disables linter on one file due to included RapidJson header. See https://github.com/flutter/flutter/issues/65676

This patch does not cover flutter/shell/platform/darwin. There's a separate, slightly more intensive cleanup for those in progress.
2020-09-11 21:18:35 -07:00
Chris Bracken
d03692449b Prefer C++ standard headers to their C counterpart (flutter/engine#21091)
We currently use a mix of C standard includes (e.g. limits.h) and their
C++ variants (e.g. climits). This migrates to a consistent style for all
cases where the C++ variants are acceptable, but leaves the C
equivalents in place where they are required, such as in the embedder
API and other headers that may be used from C.
2020-09-11 17:10:00 -07:00
Zachary Anderson
5ef8d060bc Revert "Enable lazy-async-stacks by-default in all modes (Take 3) (#20895)" (flutter/engine#21043)
This reverts commit 4200d23617a13ae4e477483ad43493dd36e4d00b.
2020-09-09 09:25:17 -07:00
Chinmay Garde
521395b84f Avoid crashing and display error if the process cannot be prepared for JIT mode Dart VM. (flutter/engine#20980) 2020-09-08 13:41:31 -07:00
Clement Skau
4200d23617 Enable lazy-async-stacks by-default in all modes (Take 3) (flutter/engine#20895)
Lazy async stacks were already enabled by-default in AOT mode in [0] - which made the
gen_snapshot invocations use "--lazy-async-stacks --no-causal-async-stacks".

This change does the same with the engine defaults, which makes this be enabled
by-default in JIT mode as well.

See go/dart-10x-faster-async for more information.

This is a re-land: A fix for what we believe to have caused the last revert has landed upstream in Dart in dart-lang/sdk@0004589

[0] flutter/flutter@3478232
2020-09-07 10:55:48 +02:00
Nathan Rogers
a35a7967ea [fuchsia] Send trace events to system tracing on all configurations (flutter/engine#20974)
This change reverts https://github.com/flutter/engine/pull/15900.  The
design of the expected consumer of the original PR changed, and the
feature ended up going unused.  Since the unexpected difference in trace
event routing behavior has mostly ended up as a source of confusion,
change things back to route trace events to Fuchsia system tracing on
all configurations.
2020-09-03 10:21:36 -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
David Worsham
3a6e0d47c6 fuchsia: Convert legacy permutations to build flag (flutter/engine#20647) 2020-08-19 19:09:51 -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
Yuqian Li
4dec444c69 Add a service protocol for raster cache memory (flutter/engine#20466)
Related issue: https://github.com/flutter/flutter/issues/56719
2020-08-13 20:11:47 -07:00
Mehmet Fidanboylu
0f611fe4b7 Plumbing for setting domain network policy (flutter/engine#20218) 2020-08-13 07:26:43 -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
Zachary Anderson
95b2fed2dc Enable more linting (flutter/engine#20187) 2020-07-31 21:30:58 -07:00
Greg Spencer
e994f832d2 Move platform specific information to PlatformConfiguration class (flutter/engine#19652) 2020-07-31 17:21:02 -07:00
Jason Simmons
6de80232b2 Revert "Enable lazy-async-stacks by-default in all modes (2) (#19270)" (flutter/engine#20165)
This reverts commit 9a94fd08b4493c7af12d2c119f1f67f3a4288264.
2020-07-30 18:34:51 -07:00
Siva
03706dce89 Manual roll of Dart from 24c7666def...40fd1c456e (flutter/engine#20092)
* Manual roll of Dart from 24c7666def...40fd1c456e

dart-lang/sdk@40fd1c456e Revert "[dart:io] Add Abort() on HttpClientRequest"
dart-lang/sdk@17d7296a42 [vm/nnbd/bytecode] Fix reuse of type arguments in bytecode
dart-lang/sdk@58b6f40c73 Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns. (reland)
dart-lang/sdk@fc8a6d9f9b [VM/compiler] Dereference TypeRef literal when propagating constants.
dart-lang/sdk@0689ec527a Move "test.dart" (well, most of its contents) into pkg/test_runner.
dart-lang/sdk@1094b3c61d Prepare static error test updater tool to handle web tests.
dart-lang/sdk@b258585f2f [observatory] Migrate from deprecated isInstanceOf to isA.
dart-lang/sdk@dfe1d9b682 Disable OverrideContributor for Cider.
dart-lang/sdk@aea99b2f5c scope debug property assist to Diagnosticables
dart-lang/sdk@4b96f20a79 [dart:io] Add Abort() on HttpClientRequest
dart-lang/sdk@1b1a39708c [build] Use frameworks instead of libs
dart-lang/sdk@3fef522496 Revert "Reland "[vm] Replaces fuchsia.deprecatedtimezone""
dart-lang/sdk@8c664d4f3f Revert "Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns."
dart-lang/sdk@2efb5bebc7 [ dart:_http ] Fix typo in HTTP response timeline event
dart-lang/sdk@0884dae36c Revert "Fix the #include path for ICU headers"
dart-lang/sdk@5171534e81 Scope tweaks. Report REFERENCED_BEFORE_DECLARATION in more places.
dart-lang/sdk@6bba75079a Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns.
dart-lang/sdk@b4ebbb7f5c [build] Update gn to match Fuchsia
dart-lang/sdk@cb428a7a02 [dart2js] Remove old bug work around in collector.
dart-lang/sdk@08663c20ab Change flutter patch to match existing DEPS on master branch
dart-lang/sdk@146ad014d9 update js/meta for the 2.10 dev sdk
dart-lang/sdk@488c718793 [co19] Roll co19 to d79951e06e443213243e54c2c32694b79a221b65
dart-lang/sdk@ba20edd7be Add patch for flutter-engine when changing to version 2.10

* Rev buildroot to latest version.

* Update license.

* update.

* Update gn revision.

* Format BUILD.gn files as the gn revision has been updated.
2020-07-29 13:10:15 -07:00
Clement Skau
9a94fd08b4 Enable lazy-async-stacks by-default in all modes (2) (flutter/engine#19270) 2020-07-29 12:25:30 +02:00
gaaclarke
ee0e1788d9 Made the linter print out more information in its output and fixed bugs (flutter/engine#19895) 2020-07-22 15:38:09 -07:00
David Worsham
cbd3cd9c0d fuchsia: Enable most unittests (flutter/engine#19583)
Tweak the primary flutter build rule so that fuchsia is more similar to
other platforms in how tests and the shell are built.

Only embedder_unittests and GLFW tests are disabled on Fuchsia now.

TEST: Ran unittests on host/fuchsia; workstation on fuchsia
BUG: fxb/53847, fxb/54056
2020-07-13 17:36:19 -07:00
liyuqian
02f828632c Use FixtureTest to remove duplicate code (flutter/engine#19219)
Fixes https://github.com/flutter/flutter/issues/59109
2020-06-30 10:55:38 -07:00