84 Commits

Author SHA1 Message Date
Chinmay Garde
4555fcca31 Re-apply "Log Tonic errors with FML_LOG" (flutter/engine#6026)
This reverts commit 201900fd6354a0f1a9318e31f101e05aeea612bd and updates the tonic SHA.
2018-08-15 14:28:24 -07:00
Chinmay Garde
201900fd63 Revert "Log Tonic errors with FML_LOG" (flutter/engine#6021)
Reverts flutter/engine#6015

This is causing the Windows bots to fail.
2018-08-14 22:22:28 -07:00
Jason Simmons
ee9fe6a5fc Log Tonic errors with FML_LOG (flutter/engine#6015) 2018-08-14 17:04:38 -07:00
Jason Simmons
c761e6e2a0 Detach the resource context before shutting down the IO thread (flutter/engine#6009) 2018-08-14 13:15:42 -07:00
Chinmay Garde
d9d6c2e825 Remove unused argument on Animator, Engine and PlatformView delegates. (flutter/engine#6007)
When these delegate methods were initially added, it was expected that a single
shell would be able to own mutliple platform views, engines and animators. This
plan was abandoned in favor of creating multiple shells with their own platform
views, engines, etc.. The arguments were meant to ease the disambiguate the
instances of the variaous objects managed by the shell. This is no longer
necessary.
2018-08-13 16:16:10 -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
amirh
3cc77fae93 Flush all embedded Android views on hot restart. (flutter/engine#5929)
* Flush all embedded Android view on hot restart.

Adds an OnEngineRestarted method to PlatformView, this is currently only
implemented for Android where we need to use it for embedded views.

* review comments followup

* rename to OnPreEngineRestart, call before Clone
2018-08-03 08:54:12 -07:00
Jonah Williams
3a3f6ca0ee Initial support for more finely-grained a11y features on Window (flutter/engine#5901) 2018-07-31 18:18:19 -07:00
Jason Simmons
d1cc979466 Return proper JSON-RPC error responses from service protocol failures (flutter/engine#5889)
Fixes https://github.com/flutter/flutter/issues/19571
2018-07-30 09:52:12 -07:00
Chinmay Garde
6ab2c166fd Remove all dependencies on Garnet. (flutter/engine#5869) 2018-07-26 12:49:34 -07:00
Chinmay Garde
c1c309ae2d Make //flutter/synchronization Garnet free. (flutter/engine#5865) 2018-07-25 14:30:41 -07:00
Chinmay Garde
62289623fc Remove //flutter/glue and use FML directly. (flutter/engine#5862) 2018-07-25 13:20:48 -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
Jonah Williams
c8516387e2 Revert rollback of "add assistiveTechnologyEnabled to window" (flutter/engine#5750) 2018-07-16 09:04:20 -07:00
Jonah Williams
b07e9faa35 Revert "Add assistiveTechnologyEnabled flag to window" (flutter/engine#5746)
Reverts flutter/engine#5740
2018-07-13 15:55:49 -07:00
Jonah Williams
71e01bf548 Add assistiveTechnologyEnabled flag to window (flutter/engine#5740) 2018-07-13 13:47:31 -07:00
Jonah Williams
5bf14b1e4d Custom accessibility (local context) action support for iOS and Android. (flutter/engine#5597) 2018-07-11 10:27:50 -07:00
Ben Konyi
a3b839a0bf IsolateNameServer reland (flutter/engine#5519)
* Reland "Added IsolateNameServer functionality (#5410)"

This reverts commit 1598c7ad7b830b298647c17a0c85f3648f6b737d.

* Fixed issue with isolate_name_server_test which caused test to timeout

* Disabled thread_annotations on Android as they aren't supported in the
NDK headers for std::mutex. Readded thread annotations to
IsolateNameServer.
2018-06-13 11:57:10 -07:00
Ben Konyi
1598c7ad7b Revert "Added IsolateNameServer functionality (#5410)" (flutter/engine#5516)
This reverts commit 851868ef29597ca8711f2de2e759069e26930c7d.
2018-06-12 17:03:13 -07:00
Ben Konyi
851868ef29 Added IsolateNameServer functionality (flutter/engine#5410)
* Added IsolateNameServer functionality, which allows for the association
of string names with isolate SendPort ids that can be used to establish
inter-isolate communications.
2018-06-12 15:50:48 -07:00
Ryan Macnak
e94cb4f2f9 [fuchsia] Plumbing for sharing between AOT snapshots. (flutter/engine#5351) 2018-05-24 13:24:14 -07:00
Chinmay Garde
1718f9b935 Break the FXL from flutter/assets. (flutter/engine#5316) 2018-05-18 17:04:36 -07:00
Jason Simmons
8e68e89f66 Drain any pending work on the IO thread before shutting down the platform view (flutter/engine#5272)
iOS does not allow usage of OpenGL ES APIs when the app has been moved to the
background.  With this change, the shell will wait until pending IO thread tasks
complete and the Skia unref queue is drained before proceeding with shutdown.

See https://github.com/flutter/flutter/issues/17511
2018-05-15 17:40:25 -07:00
Chinmay Garde
47d04deb99 Read/apply settings that apply process wide before creating any shell components. (flutter/engine#5203) 2018-05-08 11:56:31 -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
Chinmay Garde
94586c2dac Set the start timestamp in the contructor of the first shell. (flutter/engine#5030) 2018-04-17 16:02:06 -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
Jason Simmons
d4a358e2e4 Enable libtxt as the default text renderer (flutter/engine#4779) 2018-03-13 11:35:40 -07:00
Jason Simmons
5fb9cce456 Revert "Enable libtxt as the default text renderer" (flutter/engine#4774)
This reverts commit 8f3e0f83869da7cd40018033062b56c778cde208.
2018-03-12 11:40:19 -07:00
Jason Simmons
8f3e0f8386 Enable libtxt as the default text renderer (flutter/engine#4773) 2018-03-12 11:15:21 -07:00
Adam Barth
9cacbff47a Switch from fxl::Mutex to std::mutex (flutter/engine#4764)
We're going to remove fxl::Mutex soon.
2018-03-09 11:19:23 -08:00
Jason Simmons
77474bd3ba Revert "Enable libtxt as the default text renderer (#4751)" (flutter/engine#4758)
This reverts commit e35e882cebc7d4b7eb98bdd0c89e781278952032.
2018-03-08 16:17:02 -08:00
Jason Simmons
e35e882ceb Enable libtxt as the default text renderer (flutter/engine#4751) 2018-03-06 13:12:39 -08:00
Jason Simmons
32d7bed11b Revert "Enable libtxt as the default text renderer (#4697)" (flutter/engine#4717)
This reverts commit 11b7c21e44c54e43dbc79c831d9097b92f6c09ef.

The libtxt font collection cache is consuming too much memory at startup.
2018-02-27 10:25:27 -08:00
Jason Simmons
11b7c21e44 Enable libtxt as the default text renderer (flutter/engine#4697) 2018-02-21 13:34:31 -08:00
Todd Volkert
d72908a9fe Respect Switch::SkiaDeterministicRendering in all runtime modes (flutter/engine#4695)
https://github.com/flutter/flutter/issues/14519
2018-02-20 19:36:34 -08:00
Todd Volkert
1555f6f175 Add flag to skip call to SkGraphics::Init() (flutter/engine#4694)
https://github.com/flutter/flutter/issues/14519
2018-02-20 17:42:11 -08: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 Aprelev
a6d6f56e67 Fix windows build by using lambda capture workaround (flutter/engine#4514)
* Fix windows build by using lambda capture workaround

* clang format, add todo

* clang-format again
2018-01-04 10:41:54 -08: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
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
Ben Konyi
5ff8528682 Updated fml to build on Windows. (flutter/engine#4415) 2017-12-08 10:40:10 -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
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