50 Commits

Author SHA1 Message Date
Chinmay Garde
6ab2c166fd Remove all dependencies on Garnet. (flutter/engine#5869) 2018-07-26 12:49:34 -07:00
Chris Bracken
0ab5914e26 Revert "Eliminate support for Dart 1 (#5504)" (flutter/engine#5505)
Broke runtime_unittests, which are still running directly from source.

This reverts commit 6a89437fec6f67c8f6526b22dd50f3e992dd9699.
2018-06-11 18:12:10 -07:00
Chris Bracken
6a89437fec Eliminate support for Dart 1 (flutter/engine#5504)
Eliminates support for running directly from sources or script snapshots. In
debug mode, we run from a kernel snapshot; in profile and release modes, we
link in AOT-compiled code.

Renames --dart-non-checked-mode to --disable-dart-asserts since checked mode
does not make sense in Dart 2.
2018-06-11 17:00:43 -07:00
Zachary Anderson
e95110f16f Adds dynamic, interpreter configs to tools/gn (flutter/engine#5446)
Adds --dynamic and --interpreter flags to
tools/gn. These flags result in engines with
properties as follows:

--dynamic:
- JIT targeting native code on Android and
  DBC on iOS

--interpreter
- Target DBC even if running on Android.

For example:

gn --android --dynamic --interpreter --runtime-mode release

Will generate an engine:
- Without Dart asserts
- Without Observatory
- With JIT compililation to DBC

into out/android_dynamic_release_dbc
2018-06-05 14:52:52 -07:00
Chinmay Garde
5b5db4f2fc Allow embedders to specify a custom advisory URI and entrypoint. (flutter/engine#5408)
The Fuchsia embedder wants to specify the application name in the field for the advisory URI. This allows embedders to specify whatever they want.
2018-05-29 15:10:12 -07:00
Chinmay Garde
1c1b28b8b5 Remove unused defines and update buildroot. (flutter/engine#5307) 2018-05-18 12:33:19 -07:00
Ryan Macnak
aab4242b2c [fuchsia] Teach engine how to set up an isolate from a list of kernel files. (flutter/engine#5210) 2018-05-16 10:09:53 -07:00
Jason Simmons
67381c0c35 Remove Blink code (flutter/engine#5218)
Fixes https://github.com/flutter/flutter/issues/12212
2018-05-10 15:57:29 -07:00
Ryan Macnak
b8b7e8e829 [fuchsia] Changes for running Dart 2 on flutter_runner. (flutter/engine#5080)
- Remove assumption that we're in Dart 2 mode only if there's a platform kernel.
 - Load core snapshots from the package instead of linking them in.
2018-04-25 13:31:13 -07:00
Chinmay Garde
61d20bfe48 Only make ERROR and FATAL log levels visible by default. (flutter/engine#5022)
Adds the --verbose-logging flag to enable logging at all other severities.
2018-04-16 21:34:11 -07:00
Chinmay Garde
82c5c8feda Re-land "Support multiple shells in a single process. (#4932)" (flutter/engine#4998)
* Re-land "Support multiple shells in a single process. (#4932)"

This reverts commit a9dd1abd80f9c5148c74d606302171fa260365ca.
2018-04-13 13:48:15 -07:00
Vyacheslav Egorov
a9dd1abd80 Revert "Re-land "Support multiple shells in a single process. (#4932)" (#4977)" (flutter/engine#4981)
This reverts commit e27940623b550f50fece0740ea3d6e9cb259fdae.
2018-04-12 18:28:55 +02:00
Chinmay Garde
e27940623b Re-land "Support multiple shells in a single process. (#4932)" (flutter/engine#4977)
This reverts commit a1befb4f3090141d738fc2b801e5454d96047121.
2018-04-11 15:41:23 -07:00
Chinmay Garde
a1befb4f30 Revert "Support multiple shells in a single process. (#4932)" (flutter/engine#4964)
This reverts commit 077d29581c35a08a076c5aeb5186855975756b55.
2018-04-10 15:28:43 -07:00
Chinmay Garde
077d29581c Support multiple shells in a single process. (flutter/engine#4932)
* Support multiple shells in a single process.

The Flutter Engine currently works by initializing a singleton shell
instance. This shell has to be created on the platform thread. The shell
is responsible for creating the 3 main threads used by Flutter (UI, IO,
GPU) as well as initializing the Dart VM. The shell, references to task
runners of the main threads as well as all snapshots used for VM
initialization are stored in singleton objects. The Flutter shell only
creates the threads, rasterizers, contexts, etc. to fully support a
single Flutter application. Current support for multiple Flutter
applications is achieved by making multiple applications share the same
resources (via the platform views mechanism).

This scheme has the following limitations:

* The shell is a singleton and there is no way to tear it down. Once you
  run a Flutter application in a process, all resources managed by it
  will remain referenced till process termination.
* The threads on which the shell performs its operations are all
  singletons. These threads are never torn down and multiple Flutter
  applications (if present) have to compete with one another on these
  threads.
* Resources referenced by the Dart VM are leaked because the VM isn't
  shutdown even when there are no more Flutter views.
* The shell as a target does not compile on Fuchsia. The Fuchsia content
  handler uses specific dependencies of the shell to rebuild all the
  shell dependencies on its own. This leads to differences in frame
  scheduling, VM setup, service protocol endpoint setup, tracing, etc..
  Fuchsia is very much a second class citizen in this world.
* Since threads and message loops are managed by the engine, the engine
  has to know about threading and platform message loop interop on each
  supported platform.

Specific updates in this patch:

* The shell is no longer a singleton and the embedder holds the unique
  reference to the shell.
* Shell setup and teardown is deterministic.
* Threads are no longer managed by the shell. Instead, the shell is
  given a task runner configuration by the embedder.
* Since the shell does not own its threads, the embedder can control
  threads and the message loops operating on these threads. The shell is
  only given references to the task runners that execute tasks on these
  threads.
* The shell only needs task runner references. These references can be
  to the same task runner. So, if the embedder thinks that a particular
  Flutter application would not need all the threads, it can pass
  references to the same task runner. This effectively makes Flutter
  application run in single threaded mode. There are some places in the
  shell that make synchronous calls, these sites have been updated to
  ensure that they don’t deadlock.
* The test runner and the headless Dart code runner are now Flutter
  applications that are effectively single threaded (since they don’t
  have rendering concerns of big-boy Flutter application).
* The embedder has to guarantee that the threads and outlive the shell.
  It is easy for the embedder to make that guarantee because shell
  termination is deterministic.
* The embedder can create as many shell as it wants. Typically it
  creates a shell per Flutter application with its own task runner
  configuration. Most embedders obtain these task runners from threads
  dedicated to the shell. But, it is entirely possible that the embedder
  can obtain these task runners from a thread pool.
* There can only be one Dart VM in the process. The numerous shell
  interact with one another to manage the VM lifecycle. Once the last
  shell goes away, the VM does as well and hence all resources
  associated with the VM are collected.
* The shell as a target can now compile and run on Fuchsia. The current
  content handler has been removed from the Flutter engine source tree
  and a new implementation has been written that uses the new shell
  target.
* Isolate management has been significantly overhauled. There are no
  owning references to Dart isolates within the shell. The VM owns the
  only strong reference to the Dart isolate. The isolate that has window
  bindings is now called the root isolate. Child isolates can now be
  created from the root isolate and their bindings and thread
  configurations are now inherited from the root isolate.
* Terminating the shell terminates its root isolates as well as all the
  isolates spawned by this isolate. This is necessary be shell shutdown
  is deterministic and the embedder is free to collect the threads on
  which the isolates execute their tasks (and listen for mircrotasks
  flushes on).
* Launching the root isolate is now significantly overhauled. The shell
  side (non-owning) reference to an isolate is now a little state
  machine and illegal state transitions should be impossible (barring
  construction issues). This is the only way to manage Dart isolates in
  the shell (the shell does not use the C API is dart_api.h anymore).
* Once an isolate is launched, it must be prepared (and hence move to
  the ready phase) by associating a snapshot with the same. This
  snapshot can either be a precompiled snapshot, kernel snapshot, script
  snapshot or source file. Depending on the kind of data specified as a
  snapshot as well as the capabilities of the VM running in the process,
  isolate preparation can fail preparation with the right message.
* Asset management has been significantly overhauled. All asset
  resolution goes through an abstract asset resolver interface. An asset
  manager implements this interface and manages one or more child asset
  resolvers. These asset resolvers typically resolve assets from
  directories, ZIP files (legacy FLX assets if provided), APK bundles,
  FDIO namespaces, etc…
* Each launch of the shell requires a separate and fully configured
  asset resolver. This is necessary because launching isolates for the
  engine may require resolving snapshots as assets from the asset
  resolver. Asset resolvers can be shared by multiple launch instances
  in multiple shells and need to be thread safe.
* References to the command line object have been removed from the
  shell. Instead, the shell only takes a settings object that may be
  configured from the command line. This makes it easy for embedders and
  platforms that don’t have a command line (Fuchsia) to configure the
  shell. Consequently, there is only one spot where the various switches
  are read from the command line (by the embedder and not the shell) to
  form the settings object.
* All platform now respect the log tag (this was done only by Android
  till now) and each shell instance have its own log tag. This makes
  logs from multiple Flutter application in the same process (mainly
  Fuchsia) more easily decipherable.
* The per shell IO task runner now has a new component that is
  unfortunately named the IOManager. This component manages the IO
  GrContext (used for asynchronous texture uploads) that cooperates with
  the GrContext on the GPU task runner associated with the shell. The
  IOManager is also responsible for flushing tasks that collect Skia
  objects that reference GPU resources during deterministic shell
  shutdown.
* The embedder now has to be careful to only enable Blink on a single
  instance of the shell. Launching the legacy text layout and rendering
  engine multiple times is will trip assertions. The entirety of this
  runtime has been separated out into a separate object and can be
  removed in one go when the migration to libtxt is complete.
* There is a new test target for the various C++ objects that the shell
  uses to interact with the Dart VM (the shell no longer use the C API
  in dart_api.h). This allows engine developers to test VM/Isolate
  initialization and teardown without having the setup a full shell
  instance.
* There is a new test target for the testing a single shell instances
  without having to configure and launch an entire VM and associated
  root isolate.
* Mac, Linux & Windows used to have different target that created the
  flutter_tester referenced by the tool. This has now been converted
  into a single target that compiles on all platforms.
* WeakPointers vended by the fml::WeakPtrFactory(notice the difference
  between the same class in the fxl namespace) add threading checks on
  each use. This is enabled by getting rid of the “re-origination”
  feature of the WeakPtrFactory in the fxl namespace. The side effect of
  this is that all non-thread safe components have to be created, used
  and destroyed on the same thread. Numerous thread safety issues were
  caught by this extra assertion and have now been fixed.
  * Glossary of components that are only safe on a specific thread (and
    have the fml variants of the WeakPtrFactory):
    * Platform Thread: Shell
    * UI Thread: Engine, RuntimeDelegate, DartIsolate, Animator
    * GPU Thread: Rasterizer, Surface
    * IO Thread: IOManager

This patch was reviewed in smaller chunks in the following pull
requests. All comments from the pulls requests has been incorporated
into this patch:

* flutter/assets: https://github.com/flutter/engine/pull/4829
* flutter/common: https://github.com/flutter/engine/pull/4830
* flutter/content_handler: https://github.com/flutter/engine/pull/4831
* flutter/flow: https://github.com/flutter/engine/pull/4832
* flutter/fml: https://github.com/flutter/engine/pull/4833
* flutter/lib/snapshot: https://github.com/flutter/engine/pull/4834
* flutter/lib/ui: https://github.com/flutter/engine/pull/4835
* flutter/runtime: https://github.com/flutter/engine/pull/4836
* flutter/shell: https://github.com/flutter/engine/pull/4837
* flutter/synchronization: https://github.com/flutter/engine/pull/4838
* flutter/testing: https://github.com/flutter/engine/pull/4839
2018-04-10 14:57:02 -07:00
Siva
0a63f58b0c Fix strong flag setting (flutter/engine#4683)
* Turn on strong mode by default when a platform file is present in the
bundle instead of using a flag passed into the engine which might not be
true when we invoke an installed app.

* - Roll dart to version fe96de2858f078e4ad04f8f30640184bf3d8102d

* Update license file.
2018-02-15 11:02:31 -08:00
Siva
04d910f0b1 Add support for --strong option in the engine, create a strong mode version of the platform file (flutter/engine#4504)
* Add a --strong option to the front end server so we can use strong mode with preview-dart-2.

* Plumb the --strong option through the dart controller into the VM.

* - Build a strong version of platform.dill for use with the engine.
- Fix a strong mode static error in the assert statement

* Enable asserts when running debug version even in strong mode.

* Use the correct platform dill file for linking when doing the aot builds.

* Fix formatting issue.
2018-01-03 16:52:24 -08:00
Martin Kustermann
9f29a0f744 Enable flutter engine to also work with .*so files on android (flutter/engine#4298)
* Enable flutter engine to also work with .*so files on android

We would like to be able to use native tools (e.g. simpleperf, gdb) with
precompiled flutter apps.  The native tools work much better with *.so
files instead of the custom formats the Dart VM uses by default.

This CL adds support for being able to load the flutter app from an *.so
file on Android.

* Add sanity check to ensure we have either shared library or instruction snapshot (but not both)
2017-11-21 13:14:50 +01:00
Jason Simmons
f9ccc371b9 Remove the diagnostic server (includes Dart roll) (flutter/engine#4287) 2017-10-27 11:53:00 -07:00
P.Y. Laligand
235f07742a Allow the project to be mapped to a location other than //flutter. (flutter/engine#4203)
This is for Fuchsia where we would like it to be located at //third_party/flutter.
2017-10-13 17:00:58 -07:00
George Kulakowski
b2b9a646ca Fix remaining ftl->fxl conversions (flutter/engine#4091)
* Fix remaining ftl->fxl conversions

The previous scripting pass at this did not account for objective c file endings

* Update tonic DEPS reference to the post-fxl version
2017-09-11 16:31:18 -07:00
George Kulakowski
fa539e618e Rename ftl to fxl in Fuchsia specific code (flutter/engine#4090) 2017-09-11 15:58:48 -07:00
Adam Barth
2cf3cffd3f Add //garnet (flutter/engine#4043)
This repository contains FTL now in the Fuchsia build.
2017-08-31 16:47:13 -07:00
Jason Simmons
e4cc8f5e41 Rebase the libtxt integration by @GaryQian onto the current engine head (flutter/engine#4022)
See https://github.com/flutter/engine/pull/3964
2017-08-28 13:01:15 -07:00
Chinmay Garde
f7b67119d3 Update the content handler to use the Mozart session API. (flutter/engine#3887) 2017-07-18 15:40:18 -07:00
Chris Bracken
1fd2bd9850 Revert libtxt integration (flutter/engine#3802)
* Revert "Fix licenses_lib golden file (#3798)"

This reverts commit d8ac43c3c9123fead15af3004d1e445834115bbd.

* Revert "Remove ParagraphConstriants (#3796)"

This reverts commit 2358613f9b6e3f3eee70f1cbfd2af92d3c049475.

* Revert "Reland "Initial integration of libtxt with Flutter alongside Blink." (#3793)"

This reverts commit d9bc2f5604e5cfef7deef2f813751e0cd46a515d.
2017-06-20 09:59:56 -07:00
Gary Qian
d9bc2f5604 Reland "Initial integration of libtxt with Flutter alongside Blink." (flutter/engine#3793)
* Transition to Hybrid lib/txt and blink text system.
2017-06-19 15:21:41 -07:00
Ian McKellar
756341be6e Revert "Initial integration of libtxt with Flutter alongside Blink." (flutter/engine#3785)
* Revert "Enable line join styles and miter limit. (#3777)"

This reverts commit cafd4b93a06b6d327f1bc59e296bf2c618eb34e4.

* Revert "Revert "Update switches to use StringView." (#3784)"

This reverts commit 5ffa5ef3a6b2c8689c7d12cd67b6823ba25783a5.

* Revert "Initial integration of libtxt with Flutter alongside Blink. (#3771)"

This reverts commit b4a9f9c6d5008f677400826dfa3a0ab30de3db23.
2017-06-16 15:15:48 -07:00
Gary Qian
b4a9f9c6d5 Initial integration of libtxt with Flutter alongside Blink. (flutter/engine#3771) 2017-06-16 14:15:53 -07:00
Gary Qian
49440f6e14 Allow switching to the software rendering backend on Android. (flutter/engine#3719)
* Enable software rendering backend on android. Add "enable-software-rendering" flag.

* Fix variable naming and threading.
2017-05-31 17:27:47 -07:00
Todd Volkert
855f18ecc1 Add ipv6 flag to shell. (flutter/engine#3646)
It controls whether the observatory and diagnostic server will
bind to the IPv6 loopback address rather than the IPv4.

Fixes https://github.com/flutter/flutter/issues/9813
2017-05-04 19:35:59 -07:00
Chinmay Garde
aac27e52b3 Use software rendering on iOS simulators without needing a flag. (flutter/engine#3465) 2017-03-06 14:49:25 -08:00
Chinmay Garde
0110abf008 Allow plugging in a software backend for rendering in the shell. (flutter/engine#3404) 2017-02-22 15:40:23 -08:00
Chinmay Garde
ea582e5d36 Allow running in debug product mode with checked mode off. (flutter/engine#3398) 2017-02-07 17:01:27 -08:00
Ryan Macnak
023ebac36d Adapt to refactoring of snapshot APIs in the Dart VM. (flutter/engine#3354)
Adapt to refactoring of snapshot APIs in the Dart VM.
2017-01-23 12:09:59 -08:00
Jason Simmons
4c92ea1506 Add flags for disabling the diagnostic server or setting its port (flutter/engine#3352)
Fixes https://github.com/flutter/flutter/issues/7557
2017-01-20 15:18:13 -08:00
Jason Simmons
633c3e25db An API for setting the tag for Flutter log messages on Android (flutter/engine#3335)
Fixes https://github.com/flutter/flutter/issues/7226
2017-01-12 15:47:18 -08:00
Chinmay Garde
d14c8ac6f5 Re-format all GN files using gn format. (flutter/engine#3319) 2017-01-03 15:59:48 -08:00
Chinmay Garde
6f3487f5f6 Add option to desktop test shells to use an embedded font for consistent unit tests. (flutter/engine#3301)
* This allows the tests to add their own FLX files but still use consistent fonts.
* The test fonts are only embedded on the desktop test shells. The option is not available on mobile platforms.
* Right now, all fonts will resolve to the test font. If we want tests to be able to use the fonts they embed in FLX files but use the test font for platform fallbacks, we will need to add font selector fallbacks. I can do this in an another patch. So far, there are no users of this functionality.
2016-12-09 14:47:49 -08:00
Todd Volkert
76b5744ea7 Make dylib filename configurable in Info.plist for iOS (flutter/engine#3277) 2016-11-28 19:44:08 -08:00
Chinmay Garde
40ae490ca8 Disable profiling by default. Allow enabling via --enable-dart-profiling. (flutter/engine#3238) 2016-11-21 11:50:42 -08:00
Adam Barth
42b02cda80 Switch backend to consume new semantics API (flutter/engine#3103) 2016-10-11 10:52:48 -07:00
Adam Barth
86501e442b Add new platform message transport on Android (flutter/engine#3105)
This transport uses the Dart and JNI APIs directly instead of indirecting
through Mojo.
2016-10-07 12:05:43 -07:00
Chinmay Garde
613ea2c91f Add a —disable-observatory flag to explicitly disable observatory even in non-product modes. (flutter/engine#3012) 2016-09-09 15:54:07 -07:00
Chinmay Garde
7489deea92 Remove the enable_observatory instance variable from blink::Settings. (flutter/engine#3011)
We used to be able to toggle observatory via a command line flag. But now, we enable or disable observatory based on the Flutter product mode.

This also allows us to fix an issue where the —non-interactive flags was being hijacked by the Dart initialization logic to enable or disable observatory. However this flag was orignally meant for the standalone runner to launch either to run tests or to run a full graphics enabled window on the desktop.
2016-09-08 16:35:30 -07:00
Chinmay Garde
66ecf81e48 Remove support for the —enable-checked-mode flag from the engine. (flutter/engine#2987) 2016-08-31 09:46:05 -07:00
Chinmay Garde
8fc97078ca Add “—endless-trace-buffer” to switch to an endless buffer from a ring buffer while tracing. (flutter/engine#2966) 2016-08-23 16:16:22 -07:00
Todd Volkert
dd98748b48 Add config properties to specify snapshot blob file names. (flutter/engine#2943)
* Add config properties to specify snapshot blob file names.

This adds the ability of the shell to override the default
dart aot snapshot blob file names, and it wires up Android's
FlutterMain to recognize the properties in the app's manifest.

This will be used for flutter applications that build their
binary snapshots into files other than the default ones
that the engine uses.
2016-08-18 16:27:16 -07:00
Adam Barth
6598d2104d Invert the relationship between lib/ui and sky/engine (flutter/engine#2920)
Now lib/ui depends on sky/engine rather than the reverse.
2016-08-12 16:12:07 -07:00
Adam Barth
6b0e5e85a4 Finish removing //flutter/tonic (flutter/engine#2917)
This pulled a refactoring of how we keep track of the primary threads.
2016-08-12 12:05:48 -07:00