58 Commits

Author SHA1 Message Date
Ben Konyi
af54a8129e Dart SDK roll for 2018-09-28 (flutter/engine#6388) 2018-09-28 18:02:04 -07:00
Chinmay Garde
74c44fa72a Wire up the Skia persistent GPU related artifacts cache. (flutter/engine#6278)
Also teaches FML to create files and directories.
2018-09-26 14:54:09 -07:00
Dan Field
1df2685196 Format for #6324 (flutter/engine#6326)
Format code from previous patch
2018-09-24 18:42:04 -04:00
Dan Field
89eeaf461e Engine::Run returns enum: success, failure, or isolate already running (flutter/engine#6324)
* If isolate is already running, return true

* Use shell::Engine::RunStatus as result of Engine::Run
2018-09-24 18:01:22 -04:00
Ryan Macnak
a6d25b895c Reapply "Some cleanups enabled by removing support for Dart 1" (flutter/engine#6250)
Following fixes in dart-lang/sdk@91cbb57cd5
2018-09-14 09:36:13 -07:00
Michael Goderbauer
d6ba11b0c1 Revert "Reapply "Some cleanups enabled by removing support for Dart 1" (#6216)" (flutter/engine#6232)
This reverts commit 88aac222998fac4a7c0e57e99c48feacefc92aa6.
2018-09-12 12:07:20 +02:00
Ryan Macnak
88aac22299 Reapply "Some cleanups enabled by removing support for Dart 1." (flutter/engine#6216)
- Add missing Dart 2 flags to gen_snapshot invocation.
 - Disable brittle service test.
2018-09-10 17:03:54 -07:00
Ryan Macnak
75e10e3845 Revert "Some cleanups enabled by removing support for Dart. (#5621)" (flutter/engine#6205)
This reverts commit e05d573589bded526e9acf44128e35151d142b7e.
2018-09-07 17:39:51 -07:00
Ryan Macnak
e05d573589 Some cleanups enabled by removing support for Dart. (flutter/engine#5621)
- Switch core snapshot to Dart 2 and remove support for loading platform.dill.
 - Remove support for loading script snapshots.
 - Remove support for loading source.
 - Remove settings and fix names to reflect the above.
 - Remove support for loading the service isolate from source.
2018-09-07 15:44:46 -07:00
Chinmay Garde
cef3ee517c Check the kernel header magic to determine if a mapping may be a valid kernel blob. (flutter/engine#5997) 2018-08-10 15:12:48 -07:00
Todd Volkert
306464cb6f Reference platform_strong.dill, not platform.dill (flutter/engine#5992) 2018-08-10 11:55:36 -07:00
Alexander Aprelev
5de4538b21 Fix IsolateStart event kind. (flutter/engine#5978) 2018-08-08 15:45:26 -07:00
Chinmay Garde
6ab2c166fd Remove all dependencies on Garnet. (flutter/engine#5869) 2018-07-26 12:49:34 -07:00
Jason Simmons
ebbdba1aea Migrate to a standalone Tonic repository separated from Topaz (flutter/engine#5817) 2018-07-23 11:49:35 -07:00
Joshua Seaton
967a473c6d [fml][fxl] Migrate AutoResetWaitableEvent to fml version. (flutter/engine#5808)
Thanks Jason for the speedy review
2018-07-20 10:12:38 -07:00
Greg Spencer
5a4558f9bf Synchronizes analysis_options.yaml files, and turns on Function typedef lint. (flutter/engine#5419)
Addresses flutter/flutter#18028 for the engine repo, and synchronizes the analysis_options.yaml files between the engine and the flutter/flutter repo.
2018-05-30 16:06:05 -07:00
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
Chinmay Garde
1718f9b935 Break the FXL from flutter/assets. (flutter/engine#5316) 2018-05-18 17:04:36 -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
Ryan Macnak
4f023940cd [fuchsia] Add dependencies needed to build the test shell. (flutter/engine#5216) 2018-05-09 13:43:27 -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
Alexander Aprelev
834a85578d Fix shell launcher test (dart2 compliant and stop polling) (flutter/engine#5009)
* Make test Dart2 compliant

* Use service and debug events instead of polling to wait for isolate to start, run and resume.

* Refactor into _onServiceEvent. Wait for 'paused' event instead of 'isolate runnable'.
2018-04-16 19:31:43 -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
Alexander Aprelev
a4ae031706 This adds RPC call to set asset path. (flutter/engine#4323)
* This adds rpc call to simply set asset path.

This is needed when doing hot reload to pick up updated assets.

* Move asset_directory fetch for after view_id. Clean up return. Fix formatting.

* Add SetAssetBundlePath methods implementations for mac and ios

* Fix mac mm

* Fix formatting

* Merge and use nullptr
2018-01-04 09:48:01 -08:00
Chris Bracken
6f144d0bde Revert "Roll Fuchsia buildtools to 85907c59e97527d79bbfdfd849d8e85c24959cc5 (#4331)" (flutter/engine#4340)
With the update to HEAD of the Fuchsia buildtools repo, the new clang
toolchain picked up caused link-time breakage in android x86_64
libFlutter.so builds.

Sample log:
https://build.chromium.org/p/client.flutter/builders/Linux%20Engine/builds/1974/steps/build%20android_debug_x64/logs/stdio

Sample failure:
FAILED: libflutter.so libflutter.so.TOC lib.stripped/libflutter.so
../../third_party/android_tools/ndk/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld.gold: error: obj/flutter/shell/platform/android/libflutter/android_context_gl.o: unsupported reloc 42 against global symbol std::__ndk1::num_put<char, std::__ndk1::ostreambuf_iterator<char, std::__ndk1::char_traits<char> > >::id

This reverts commit fecc7aa281821e01037089846744b5331e3cbd22.
2017-11-08 16:48:00 -08:00
Chris Bracken
fecc7aa281 Roll Fuchsia buildtools to 85907c59e97527d79bbfdfd849d8e85c24959cc5 (flutter/engine#4331)
* Roll Fuchsia buildtools to 85907c59e97527d79bbfdfd849d8e85c24959cc5

This also updates Flutter buildroot to a6e52dbb776c45cc8c57d7143b8eb8b2e762fdfb
which disables -Wtautological-constant-compare temporarily until
https://reviews.llvm.org/D39462 lands in clang. This is in line with
Fuchsia's compiler options.

* Apply clang-format diffs

No logical changes. This applies clang-format from the latest Fuchsia
buildtools to the engine codebase.
2017-11-08 11:18:17 -08:00
Chinmay Garde
3dd5e0aceb Avoid registering both the platform view and the rasterizer in the shell. (flutter/engine#4293)
Instead, the rasterizer can be accessed via the platform view.
2017-10-30 13:28:39 -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
Michael Goderbauer
ac24af87f0 Format all c-like sources with clang-format (flutter/engine#4088)
* format

* license script adaptions

* updated licenses

* review comments
2017-09-12 15:36:20 -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
a17f541da0 Hold the TestRunner's platform view through a shared_ptr (flutter/engine#3870)
flutter_tester was throwing a bad_weak_ptr while setting up the engine
because the PlatformViewTest was held in a unique_ptr
2017-07-12 16:37:47 -07:00
Carlo Bernaschina
c9286a9e4d Add missing virtual methods in PlatformView (flutter/engine#3867) 2017-07-12 13:06:02 -07:00
Carlo Bernaschina
dc20dc0cec Avoid to freeze the system if hot reloading during debug (flutter/engine#3833) 2017-07-12 10:25:42 -07:00
Ian Hickson
cf8689ffa2 Move the test runner to a higher DPI screen. (flutter/engine#3688)
Having the device pixel ratio of the test shell be 1.0x makes it
unlikely that we will catch errors relating to mishandling of the
device pixel ratio in the test shell.

This patch arbitrarily increases the device pixel resolution while
keeping the logical resolution the same.
2017-05-15 13:18:56 -07:00
Chinmay Garde
6ff5a41327 Remove uses of //base from all //flutter projects and replace them with //fml variants. (flutter/engine#3492) 2017-03-22 15:42:51 -07:00
Jason Simmons
23a36caa6f Fix a race in PlatformView construction (flutter/engine#3380)
The PlatformView superclass constructor was posting a task to the UI thread
that adds the view to the shell's global list.  This could result in UI thread
operations seeing PlatformView instances that are not fully constructed and do
not yet have an engine.

This was happening in https://github.com/flutter/flutter/issues/7735
2017-01-31 17:54:34 -08:00
Jason Simmons
15df8436d1 Add a flag to sky_shell that keeps the process alive after the Dart script completes (flutter/engine#3363) 2017-01-25 12:06:23 -08:00
Jason Simmons
4c32d9a960 Exit the non-interactive sky_shell on Linux when the Dart script has completed (flutter/engine#3358)
The script will be finished when the microtask queue has been drained and
Dart_HasLivePorts is returning false for the main isolate
2017-01-24 15:39:30 -08:00
Chinmay Garde
fa8c14973b Rework switches in the shell so that they display help text for all flags. (flutter/engine#3259) 2016-11-22 16:58:55 -08:00