198 Commits

Author SHA1 Message Date
Ryan Macnak
8e2bc7b70e Reapply "Don't link the core snapshot in the Android engine." (flutter/engine#5353)
Add back the core snapshot to runtime_unittests and embedder_unittests.
2018-05-23 17:09:51 -07:00
Ryan Macnak
49c1ba1007 Revert "Don't link the core snapshot in the Android engine. (#5348)" (flutter/engine#5352)
This reverts commit d40b0dbcd2c28fbd4eadc91943f3c2c9ee0d7df5.
2018-05-23 16:11:57 -07:00
Ryan Macnak
d40b0dbcd2 Don't link the core snapshot in the Android engine. (flutter/engine#5348)
Allows one to use a different core snapshot without a custom engine build by just packaging a different one in the APK.
2018-05-23 15:56:28 -07:00
Martin Kustermann
83f32f0961 Restore functionality to run from .so file on Android (flutter/engine#5278)
Flutter AOT builds can be done on Android using .so files (instead of
separate instruction/data snapshots) using the `--build-shared-library`
flag.

Running from .so files stopped working after the engine refactoring in
82c5c8feda, which this CL restores.

Issue https://github.com/flutter/flutter/issues/17236
2018-05-23 10:11:44 +02:00
Alexander Aprelev
965ce6f3e9 Disable kernel-based expression evaluation. (flutter/engine#5290)
This should be reverted once dartbug.com/33087 is fixed.
2018-05-17 14:09:45 -07:00
Chinmay Garde
bddd31be8f Remove dart_vm_entry_points_fuchsia.txt as it has been moved to //topaz (flutter/engine#5291) 2018-05-17 13:41:36 -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
Alexander Aprelev
2d74bd4c27 Enable flutter service protocol rpcs to run on UI isolate. (flutter/engine#5263)
With this change if flutter tools provides isolateId parameter, then VM will run the handler on that isolate. If no isolateId is provided, VM will continue running handlers as if they were registered wit Dart_RegisterRootServiceRequestCallback.

This goes towards fixing https://github.com/flutter/flutter/issues/17434
2018-05-16 07:29:20 -07:00
Ryan Macnak
9ee60830b1 Roll Dart to a5c11d7d0329432ca37e35bb249b20f60aa0aa31. (flutter/engine#5269)
Update engine for removal of Dart_ReadKernelBinary and refactored build targets.
2018-05-15 16:13:21 -07:00
Ryan Macnak
f49044eebd Revert "Roll Dart to a5c11d7d0329432ca37e35bb249b20f60aa0aa31. (#5259)" (flutter/engine#5266)
This reverts commit e2a590e926c80ba039fc70a336ea6cd341c27f12.
2018-05-15 13:26:51 -07:00
Ryan Macnak
e2a590e926 Roll Dart to a5c11d7d0329432ca37e35bb249b20f60aa0aa31. (flutter/engine#5259)
Update engine for removal of Dart_ReadKernelBinary and refactored build targets.
2018-05-15 12:57:01 -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
Chinmay Garde
1add7581f0 Allow explicit specification of the isolate snapshot. (flutter/engine#5193)
The mobile shells all use the same isolate snapshot. This is also the snapshot used by the service isolate. This works towards a world where the isolate snapshot is no longer a member variable of the DartVM instance. Instead, all snapshots must be specified in the run configuration. For now, the new `Shell::Create` overload will only be used by Fuchsia till I refactor `dart_vm.cc`.

There are no API updates to the mobile shells.
2018-05-07 17:28:31 -07:00
Alexander Aprelev
b76f2c6abc Roll dart to b298fc6d8f6a0e1aa841dbbdda26663d6012a79a. (flutter/engine#5155)
* Roll dart to b298fc6d8f6a0e1aa841dbbdda26663d6012a79a.

Changes since last roll:
```
b298fc6d8f Revert "[kernel] Change dill representation of doubles"
9a7e1f64a2 Revert "Revert "Fix incorrect handling of NSM forwarders and pull all logic into CFE.""
cbca4006f8 fix #30907, add library constants for all SDK libraries
61c226b4ea Only create Goma's analyzer on Linux.
24dd9b4176 Revert "Fix incorrect handling of NSM forwarders and pull all logic into CFE."
bed71b7776 Migrate and clean up the prefix negative tests.
1fcd896ed9 [VM] Avoid deadlock by allowing us to run kernel isolate from a script snapshot, fixes all dartk-sim* builders
0bc6e7217a Update expression compilation expectations.
9038b8f45f CFE support for compiling individual expressions in a context.
7d5025e814 Fix incorrect handling of NSM forwarders and pull all logic into CFE.
e2247e5e00 Put the '@' outside the revision variables.
9381424204 Fix presubmit on Windows. Dart executable is not called .bat
2a8c3515b2 Avoid strong+checked mode: strong mode supersedes checked mode
b7698dcbce Update status for Windows
8baa82413b [infra] Remove --no-preview-dart-2 flag from gardening tools
47e9039512 Don't encode strings up front; don't toString uris
4a0ac85cc3 Update co19 status
ce7329849d Fix build breakages - use platform independent path specification is test so that   it works on windows - skip test for precompiled and dartk builds as the test uses   spawnUri which is not supported in these modes
ee6351a147 [VM] Set up package config value when invoking the front end for compilation, this should fix issue 32950 "(Isolate.spawnUri() ignores packageConfig argument in Dart 2 mode.'
d1286a367e Strong mode update for swarm
fd27cc3435 Don't store bytes in the file cache.
73abd61304 Re-land "Clean up the use of deprecated API in the analyzer_plugin package".
607f4f5769 [vm] Get more helpful errors from Dart_SetVMFlags and Dart_MakeIsolateRunnable.
f044637c8b [infra] Upgrade checked in SDKs to 2.0.0-dev.52.0
dcf10816aa [infra] Add script that updates checked in SDKs
f8bea2a7e6 dart2js: Register inlined native methods for dump info
7fe8659613 dump-info: Use relative paths for library canonicalUri...
dcf4886500 [frontend-server] Add verbose option.
5087ffa481 [release] Move DDC sync-async flip to correct section in the release notes
fe7056ebaa [release] Update changelog for 2.0.0-dev.52.0
```

* Pick up another revert to fix https://github.com/flutter/flutter/issues/17214 and few more dart commits landed since:

```
4c9b712052 Revert "Don't encode strings up front; don't toString uris"
a1fbf62742 [build] Place 'extern "C"' before __attribute__, as required by gcc.
258c5172df [vm] Remove dart_mirrors_api.h.
384c55c29e Update dartdoc & dependencies to v0.19.0.
```

* fix licenses
2018-05-02 18:42:14 -07:00
Ryan Macnak
4089df7bce Define Uri.base as CWD to match the standalone Dart VM. (flutter/engine#5137)
Bug: https://github.com/flutter/flutter/issues/17118
2018-05-01 09:30:30 -07:00
Ryan Macnak
cb8d6bb865 Roll Dart to 0cc70c4a7c448078dd2aea8e45c56bc50fbbb31c. (flutter/engine#5133) 2018-04-30 13:57:32 -07:00
Alexander Aprelev
7bbee90efb Set file modified callback. (flutter/engine#5096)
This fixes dart1 hot reload regression caused by 82c5c8fed.
2018-04-26 08:43:28 -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
Jason Simmons
21d13e46fa Use the default microtask scheduler on all isolates except the UI isolate (flutter/engine#5068)
See https://github.com/flutter/flutter/issues/16846
2018-04-23 15:02:19 -07:00
Chinmay Garde
1461d08b68 Prepare and run child isolates on a VM managed (i.e. no UI) task runner. (flutter/engine#5054) 2018-04-19 19:17:11 -07:00
Chinmay Garde
326b317633 Allow runtime unit-test to perform dynamic symbol resolution for Dart snapshots. (flutter/engine#5044) 2018-04-18 17:55:39 -07:00
Jason Simmons
6856d1b63d Remove the weak pointer factory from the service isolate's DartIsolate object (flutter/engine#5041)
The WeakPtrFactory must be deleted on the thread where it was created.
However, the service isolate is created and destroyed on threads from
the Dart thread pool, and the creating thread may not be the same as
the destroying thread.
2018-04-18 13:02:19 -07:00
Chinmay Garde
3028fb7777 Simplify weak pointer factories and allow vending weak pointers on multiple threads. (flutter/engine#5029) 2018-04-18 11:07:16 -07:00
Chinmay Garde
e45e1c17b2 Don't send platform messages to isolates that are not running. (flutter/engine#5031)
Isolates may be launched and awaiting snapshot association. We don't
want to send such isolates any messages before their "main" method is
called. In such cases, the engine may intercept and store certain
launch specific information.
2018-04-17 17:10:17 -07:00
Chinmay Garde
ae8bdd8dfc In the service protocol, if no view is specified to flush tasks on, pick the first one. (flutter/engine#5028) 2018-04-17 12:07:00 -07:00
Chinmay Garde
eee5b18b17 On windows, refer to Dart snapshot directly executable. (flutter/engine#5024) 2018-04-16 22:02:19 -07:00
Chinmay Garde
bfed2f04a0 Specify the packages file path when running engine dart tests. (flutter/engine#5005) 2018-04-13 16:17:38 -07:00
Chinmay Garde
8ad80a986f If the test specifies a .dill file, dont make the engine interpret is as source. (flutter/engine#5002) 2018-04-13 15:07:28 -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
Jason Simmons
53df117523 Load kernel files from the script URI in the isolate create callback (flutter/engine#4828)
Fixes https://github.com/flutter/flutter/issues/15731
2018-03-20 17:25:22 -07:00
Zachary Anderson
fb3456f64f Remove some unneeded profiling flags (flutter/engine#4827) 2018-03-20 15:48:41 -07:00
Ryan Macnak
7886e02834 Reapply "Roll Dart to f1ebe2bd5cfcb6b522e5b4fd406cdabb1a2d2091." (flutter/engine#4809) 2018-03-19 11:22:23 -07:00
Alhaad Gokhale
ab632603e1 Revert "Roll Dart to f1ebe2bd5cfcb6b522e5b4fd406cdabb1a2d2091. (#4800) (#4805)" (flutter/engine#4807)
This reverts commit 8790a33a0ddfa70635e5dd87d795bb9051e17d3d.
2018-03-19 09:51:41 -07:00
mikejurka
8790a33a0d Roll Dart to f1ebe2bd5cfcb6b522e5b4fd406cdabb1a2d2091. (#4800) (flutter/engine#4805) 2018-03-16 17:08:06 -07:00
mikejurka
713dbf4ca8 Revert "Roll Dart to f1ebe2bd5cfcb6b522e5b4fd406cdabb1a2d2091. (#4800)" (flutter/engine#4803)
This reverts commit e121d45124ba9cf6270427ff46017ea26fc2c8fa.
2018-03-16 16:22:41 -07:00
Ryan Macnak
e121d45124 Roll Dart to f1ebe2bd5cfcb6b522e5b4fd406cdabb1a2d2091. (flutter/engine#4800) 2018-03-16 12:17:38 -07:00
Zachary Anderson
69d5d6b1b0 [fuchsia] Fix AOT debug builds (flutter/engine#4787) 2018-03-14 19:19:15 +01:00
Jason Simmons
64cfbcc419 Do not free the buffer owned by the kernel_data vector (flutter/engine#4753)
Fixes https://github.com/flutter/flutter/issues/14947
2018-03-07 14:21:15 -08:00
Sarah Zakarias
9f5ad5fd1e Read assets out of APK on Android (flutter/engine#4742) 2018-03-05 14:09:45 +01:00
Ryan Macnak
77d162e857 [fuchsia] Place Observatory in the runner's package instead of linking it in. (flutter/engine#4719)
This allows blobfs to deduplicate it across {dart,flutter}_{jit,aot}_runner.
2018-02-27 16:45:52 -08:00
Vyacheslav Egorov
51dc8c3808 Switch on --sync-async in Dart 2 mode (flutter/engine#4686) 2018-02-27 09:44:27 +01: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
Alexander Markov
210eb79918 Make native wrapper classes non-abstract (flutter/engine#4607)
* Make native wrapper classes non-abstract as they are instantiated from native code
* Make constructors of native wrapper classes private
2018-02-09 12:17:36 -08:00
Ryan Macnak
a1f23bf8fc [fuchsia] Add missing AOT entry points for FromFileResult and MapResult. (flutter/engine#4649) 2018-02-08 09:34:19 -08:00
Zachary Anderson
cc7a67da96 Reland: [fuchsia] Enable running from source packages (flutter/engine#4634)
This relands https://github.com/flutter/engine/pull/4629 with a
tonic roll to fix the build.
2018-02-06 10:08:24 -08:00
Jason Simmons
c3ef874a23 Fix an improper deletion of DirectoryAssetBundle when creating isolates (flutter/engine#4637) 2018-02-05 17:33:59 -08:00