747 Commits

Author SHA1 Message Date
Brian Osman
2260bb3fd7 Fix use of uninitialized memory in animator (flutter/engine#22714)
* Fix use of uninitialized memory in animator

Discovered via MSAN build of embedder_unittests
2020-11-24 14:51:31 -05:00
Chris Yang
4f25c151f3 Fix shell_unittests flakes related to external_view_embedder (flutter/engine#22683) 2020-11-23 15:48:03 -08:00
Gary Qian
3676366194 Split AOT Android Embedder and shell (flutter/engine#22179) 2020-11-19 17:22:26 -08:00
gaaclarke
0901a93e5b started providing the GPU sync switch to external view embedders (flutter/engine#22302) 2020-11-17 18:43:01 -08:00
Chris Yang
f12c38bd68 re-enable skipandsubmitframe (flutter/engine#22546) 2020-11-17 09:53:01 -08:00
Dan Field
714fb9e81b Opt in fixutres (flutter/engine#22502) 2020-11-13 12:02:07 -08:00
Kaushik Iska
356e31aef5 Reland "remove surface dependance on external view embedder (#22468)" (flutter/engine#22470) 2020-11-12 15:37:12 -08:00
Dan Field
b388181b25 Limit heap growth on Android (flutter/engine#20473)
Limit heap growth to half of totalMem by default, with the option to set it higher or lower in the AndroidManifest
2020-11-12 14:53:54 -08:00
Kaushik Iska
ae4dbc51b8 Reverts 2 commits that remove surface dependance on external view embedder (flutter/engine#22468)
* Revert "Remove GetExternalViewEmbedder from surface (#22272)"

This reverts commit 9dffddd08d0ad6fa7434c5a5bdff87e09da92e57.

* Revert "Rasterizer is initialized with an external view embedder (#22405)"

This reverts commit 417c869d6bcd70ba82fdd6efc8db1efa19fb997c.
2020-11-12 08:41:11 -08:00
Kaushik Iska
9dffddd08d Remove GetExternalViewEmbedder from surface (flutter/engine#22272)
This decouples surfaces from view embedders.
2020-11-11 13:45:24 -08:00
Kaushik Iska
417c869d6b Rasterizer is initialized with an external view embedder (flutter/engine#22405)
This allows us to not rely on surface methods for getting
the external view embedder.

Conflicts:
	shell/common/rasterizer.cc
	shell/common/rasterizer_unittests.cc
2020-11-11 12:49:03 -08:00
Kaushik Iska
8b9acb11b8 Move common graphics utils to //flutter/common/graphics (flutter/engine#22320) 2020-11-10 12:34:02 -08:00
Chris Yang
e7f73e509c Reland "Do not involve external_view_embedder in submit frame process if threads are not merged. #22275" (flutter/engine#22372) 2020-11-06 21:04:02 -08:00
Gary Qian
6fc7f7b41f Remove extra method in ComputePlatformResolvedLocale (flutter/engine#22362) 2020-11-06 16:34:45 -08:00
Chris Bracken
ca1db50228 Revert "Rasterizer is initialized with an external view embedder (#22348)" (flutter/engine#22367)
This reverts commit cccecc46e10341d655b6bd388222f189215da506.

Due to merge conflicts, this also reverts #22275:

Revert "Do not involve external_view_embedder in submit frame process if threads are not merged. (#22275)"

This reverts commit d3902fc979fac68d498e4fe33584647c375c06ac.
2020-11-06 15:26:47 -08:00
Chris Yang
d3902fc979 Do not involve external_view_embedder in submit frame process if threads are not merged. (flutter/engine#22275) 2020-11-06 11:04:01 -08:00
Kaushik Iska
cccecc46e1 Rasterizer is initialized with an external view embedder (flutter/engine#22348)
This allows us to not rely on surface methods for getting
the external view embedder.
2020-11-06 09:01:28 -08:00
Kaushik Iska
ea42f7eaa0 Platform views have CreateExternalViewEmbedder (flutter/engine#22214) 2020-11-06 05:30:48 -08:00
freiling
4903a92b2b SKP based shader warmup (flutter/engine#20643) 2020-11-04 23:19:02 -08:00
gaaclarke
68eedd5ba3 added unit tests to the rasterizer (flutter/engine#22282) 2020-11-04 13:56:29 -08:00
gaaclarke
a92f113402 Refactored the FlutterEngine to make it easier to implement spawn functionality (flutter/engine#21890) 2020-10-30 15:29:10 -07:00
stuartmorgan
d5a259fcba Fix possible use of std::moved value in Rasterizer (flutter/engine#22125) 2020-10-28 18:12:03 -07:00
Filip Filmar
cb5828068f [fuchsia] Adds a test for timezone change (flutter/engine#21934) 2020-10-23 18:52: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
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
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
Chris Bracken
ef868edd36 Eliminate FLUTTER_NOLINT where possible (flutter/engine#21904)
This removes most of the remaining FLUTTER_NOLINT comments and opts
these files back into linter enforcement.

I've filed https://github.com/flutter/flutter/issues/68273 to require
that all FLUTTER_NOLINT comments be followed by a GitHub issue URL
describing the problem to be fixed.
2020-10-16 12:44:49 -07:00
Jenn Magder
14dee41f00 Add flag to not publish the observatory port over mDNS (flutter/engine#21883) 2020-10-15 14:53:20 -07:00
Jenn Magder
1be440e077 Revert "Add flag to not publish the observatory port over mDNS (#21632)" (flutter/engine#21882)
This reverts commit a23a450aebfb917907e3e9647dffc210e2f31bde.
2020-10-15 12:32:24 -07:00
Jenn Magder
a23a450aeb Add flag to not publish the observatory port over mDNS (flutter/engine#21632)
* Add flag to not publish the observatory port over mDNS

* Review edits

* Format
2020-10-15 10:48:50 -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
Jonah Williams
127f3af9e0 Preserve specified AssetResolvers when performing a hot restart or updating the asset directory (flutter/engine#21611)
Follow up from #21436 . That PR works for all embeddings except for Android, which creates a special JNI AssetResolver. Since the shell cannot recreate this resolver, update the logic to preserve existing resolvers instead.
2020-10-08 09:22:01 -07:00
Pieter van Loon
3ce29048c0 Enabled metal on ios simulator (flutter/engine#17881) 2020-10-07 17:47:03 -07:00
George Wright
f4afab33d9 Use the gpu config for shell_unittests to declare SHELL_ENABLE_{GL,VULKAN} (flutter/engine#21603) 2020-10-06 12:47:02 -07:00
Yuqian Li
9fdea6bbbc Do not remove directories in purge (flutter/engine#21478)
Otherwise, the persistent cache may hold invalid directories and make
subsequent store fail.

The newly added unit tests would fail without the fix.
2020-10-05 20:05:00 -07:00
Jonah Williams
e37debbf9b Allow hot reload without syncing all asset files to devFS (flutter/engine#21436)
Always add the asset resolver from the configuration settings directory when restarting or recreating the asset manager
2020-10-02 14:09:07 -07:00
Kaushik Iska
a5f4486147 Reland multiple display support for embedder API (flutter/engine#21464) 2020-09-28 12:35:34 -07:00
Jason Simmons
19b073917b Do not pass invalid platform view rendering surfaces to the rasterizer (flutter/engine#21259) 2020-09-28 11:57:01 -07:00
George Wright
67cfb02b18 Enable embedder_unittests on Fuchsia (flutter/engine#21418) 2020-09-28 11:12:02 -07:00
Kaushik Iska
bd90847bad Revert multiple display support for embedder API (flutter/engine#21456)
This reverts commits
- 5f34b8442366463b5ad53e3e87e7920a006392eb.
- fc8b468d84f1fef5bf5183dd0b36d9411d454ea7.

See: https://github.com/flutter/flutter/issues/66829
2020-09-28 09:46:46 -07:00
Kaushik Iska
5f34b84423 Embedder API Support for display settings (flutter/engine#21355)
Embedders can now notify shell during startup about the various displays and their corresponding settings.
Adds a notion of Display update type which can later include chages to displays during runtime such as addition / removal / reconfiguration of displays.

We also remove the responsibility of providing the refresh rate from `vsync_waiter` to `DisplayManager`.
Rewires existing platform implementations of the said API to use `Shell::OnDisplayUpdate` to notify the display manager of the startup configuration.

DisplayManager is also thread-safe to account for rasterizer and UI thread accesses.
2020-09-25 11:04:10 -07:00
Dan Field
5e3ad78d3a Avoid sending a 0 DPR to framework (flutter/engine#21389)
* Avoid sending a 0 DPR to framework

* check width and height as well
2020-09-25 10:35:57 -07:00
Matej Knopp
62a0f720af Discard wrong size layer tree instead of rendering it (flutter/engine#21179) 2020-09-18 12:37:02 -07:00
George Wright
82b966ba18 Disable ShellTest.SkipAndSubmitFrame for flakes (flutter/engine#21254) 2020-09-17 16:20:52 -07:00
Martin Kustermann
bbaa27cd9f Add --enable-isolate-groups to allowed flags in switches.cc (flutter/engine#21149)
This will allow customers to try out the lightweight isolate support in the Dart VM in AOT mode.

To be future proof, we also add the negative flags to the allow list, thereby allowing the Dart VM to
change the default in the future, while still allowing customers to opt out.

Issue b/158554251
2020-09-17 14:33:51 -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