81 Commits

Author SHA1 Message Date
Dan Field
681e4c6427 Flush UserSettings to window (flutter/engine#6850) 2018-11-13 23:41:56 -08:00
Dan Field
c0ce728956 disable embedder_unittests (flutter/engine#6798) 2018-11-08 11:18:21 -08:00
Michael Goderbauer
0def82ddb0 Unify copyright lines (flutter/engine#6757) 2018-11-07 12:24:35 -08:00
Gary Qian
48019d35ab Roll back _countryCode assert - breaking change (flutter/engine#6693)
* Roll back _countryCode assert - breaking change

* Add tests back in
2018-10-29 17:27:12 -07:00
hugovdm
20bd079a61 Add Locale.fromSubtags and support for scriptCode. (flutter/engine#6518)
* Add Locale.fromComponents.

* Change toString from underscores to dashes. Expand the unit tests.

* Rename 'fromComponents' to 'create'. Change variants from String to List<String>.

* Use default for language parameter. Use hashCode/hashList.

* Have toString() stick with old (underscore) behaviour.

* Demonstrate empty-list bug in assert code.

* Fix empty-list assert bug.

* Add ignores for lint issues. Unsure about 71340 though.

* Fix operator== via _listEquals.

* Remove length-checking asserts: we're anyway not checking characters in fields.

* Documentation update.

* Change reasoning for ignore:prefer_initializing_formals.

* Try 'fromSubtags' as new constructor name.

* Documentation improvements based on Pull Request review.

* Assert-fail for invalid-length subtags and drop bad subtags in production code.

* Revert "Assert-fail for invalid-length subtags and drop bad subtags in production code."

This reverts commit d6f06f5e7b3537d60000c47641580475ef16abbe.

* Re-fix Locale.toString() for variants=[].

* Tear out variants, in case we want to have one fewer pointer in the future.

* Make named parameters' names consistent with member names.

* Also remove _listEquals: no longer in use.

* Lint fix.

* Fix code review nits.

* Lint fix for assert, and a couple more not-zero-length-string asserts.

* Code Review: two of three nits addressed...

* Review fix: change 'should' to 'must' for subtag prescriptions.

* Assert-check that countryCode is never ''.
2018-10-29 14:48:59 -07:00
Chinmay Garde
db31e09d15 Run all supported host unit tests on Cirrus. (flutter/engine#6575) 2018-10-17 17:44:11 -07:00
Gary Qian
b4a3ad2e28 Pass full locale list with script and variant codes to framework (flutter/engine#6557)
* Locale Passing

* Pass full locale list and script and variant codes to framework

* Working Android locale list passing and fallback
2018-10-17 10:53:01 -07:00
Gary Qian
45577f1f07 Pass scriptcode and variantcode to dart:ui Window. (flutter/engine#6493) 2018-10-10 17:22:59 -07:00
Michael Klimushyn
893f867f36 Add a ratio cap to decoded animated image frames (flutter/engine#6310)
Provide a relative, per-image limit to the amount of memory
that's used to cache decoded image frames. Adds an overridable default
that developers can set to control how much memory images are allowed
to use decoded vs undecoded. The cap is set in flutter/flutter#22452.

Note that required frames are always cached regardless of the ratio cap,
because they're currently necessary for the GIF to animate. Previously
cached unessential frames are not cleared in response to the cache
hitting or exceeding the cap.

Addresses #20998 and #14344.
2018-10-09 17:07:46 -07:00
Michael Klimushyn
27cd6283b7 Fix failing test on Cirrus (flutter/engine#6469)
Updates the tests to use the `--use-test-fonts` argument.

Fixes flutter/flutter#22682
2018-10-08 15:47:53 -07:00
Michael Klimushyn
7cde96f315 Add run_tests.sh to cirrus (flutter/engine#6441)
This replaces `ci/test.sh` with `run_tests.sh`. `run_tests.sh` includes
`ci/test.sh` and multiple other tests.

Partially addresses flutter/flutter#22682. Temporarily skipped tests
should be fixed and re-enabled in a follow-up commit.
2018-10-05 11:56:13 -07:00
Michael Goderbauer
53c7767a56 Make verify_exports fail on failures again (flutter/engine#6379)
It is now working properly on the bots.
2018-09-28 10:47:48 -07:00
Michael Goderbauer
9fbb7677c8 Skip non-existing libflutters for symbol check (flutter/engine#6374) 2018-09-27 23:00:10 -07:00
Michael Goderbauer
c32ef44788 Add more debug loging to symbol verification script (flutter/engine#6372) 2018-09-27 21:51:09 -07:00
Michael Goderbauer
fe046b8eb6 Use nm from buildtools (flutter/engine#6371) 2018-09-27 17:36:23 -07:00
Michael Goderbauer
a702b138be Add debug info to figure out why the bots are unhappy (flutter/engine#6369) 2018-09-27 16:27:03 -07:00
Michael Goderbauer
fdd399f16e Script to verify exported symbols on release binaries (flutter/engine#6363) 2018-09-28 00:23:01 +02:00
Michael Klimushyn
b23b36ad34 Update test .gitignore (flutter/engine#6272)
`testing/dart/android/` and `testing/dart/ios` both look like generated
directories created after each `run_tests` execution.
2018-09-17 17:10:30 -07:00
Jason Simmons
a7c7554259 Update engine tests for Dart 2 compilation and language changes (flutter/engine#6262) 2018-09-17 09:28:11 -07:00
Jason Simmons
d84092681b Update test and license scripts for Dart SDK 2.1.0 (flutter/engine#6254) 2018-09-14 11:29:51 -07:00
liyuqian
7357a29311 Remove travis directory (flutter/engine#5935)
This reflects that we no longer uses travis. Scripts are moved to ci folder.
2018-08-06 15:06:49 -07:00
Chinmay Garde
6ab2c166fd Remove all dependencies on Garnet. (flutter/engine#5869) 2018-07-26 12:49:34 -07:00
Ben Konyi
9cec23702e Background Execution Implementation for iOS (flutter/engine#5539) 2018-07-13 10:55:24 -07:00
Chris Bracken
0b939b3cf1 Assert in place of ArgumentError for null checks (flutter/engine#5612)
For consistency with the rest of dart:ui, check required parameters with
assert(param != null) rather than throwing ArgumentError. ArgumentError
is typically reserved for checking the validity of non-null args -- e.g.
that a list has the required number of elements.
2018-06-25 16:33:33 -07:00
Ben Konyi
a5eb947cba Pinned versions of package:test and package:path for testing/dart tests (flutter/engine#5522) 2018-06-13 12:59:45 -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
Dan Field
33f650f452 TwoPointConicGradients again (flutter/engine#5299)
* update docs for getBounds

* Add computeMetrics suggestion

* better explanation

* Support for TwoPointConical gradients
2018-05-18 07:43:52 -04:00
Greg Spencer
4b03aacc53 Adding Color.alphaBlend (flutter/engine#5119)
This is helpful for some Material Design widgets, which are specified as a semi-transparent color over top of a "material". In some cases, the resulting alpha-blended color can be used instead of compositing an additional shape with an opacity.

This new Color.alphaBlend function mimics the alpha blending function, and creates the resulting combined color. The optimization only works for solid color shapes that have the same geometry, of course.
2018-04-30 15:20:29 -07:00
Dan Field
4fc5359abc Path metrics/getBounds/combinations again (flutter/engine#4957)
* add path measure

* fix typo

* getBound and addPathWithMatrix

* Add myself to Authors, add PathOps

* fix linting issues

* update licenses_flutter to add new files

* Use matrix4 instead of matrix3 for consistency/interop

* put pubspec back

* fix bug in getSegment

* fix typo

* Add return value for PathOp

* refactoring from review

* refactoring from review - still TBD on computeMetrics()

* add doc

* lint issue

* fix computeMetrics, add Path.from

* add missing wireup for clone

* change PathMetrics to iterable, fix bug with angle on Tangent

* prefer std::make_unique

* cleanup docs

* add path measure

* fix typo

* getBound and addPathWithMatrix

* Add myself to Authors, add PathOps

* fix linting issues

* update licenses_flutter to add new files

* Use matrix4 instead of matrix3 for consistency/interop

* put pubspec back

* fix bug in getSegment

* fix typo

* Add return value for PathOp

* refactoring from review

* refactoring from review - still TBD on computeMetrics()

* add doc

* lint issue

* fix computeMetrics, add Path.from

* add missing wireup for clone

* change PathMetrics to iterable, fix bug with angle on Tangent

* prefer std::make_unique

* cleanup docs

* fix iterator bug

* remove unnecessary clone for computeMetrics

* fix some doc issues

* fix PathMeasure iterator, extendWithPath, isClosed, and pubspec.lock

* get rid of orElse; use StateException

* StateError, not StateException

* doc improvements and nits

* add unit tests, fix bugs found during testing

* fix two uncommited doc changes

* one more

* change sign of tangent angle, update docs

* update unit tests for inverted angle

* update tangent to include vector

* Doc fixes

* Fix MSVC compilation and unit test
2018-04-25 15:35:01 -07:00
Todd Volkert
cf5661d4ae Support different encodings in Image.toByteData() (flutter/engine#5060)
Fixes https://github.com/flutter/flutter/issues/16635
2018-04-20 19:47:27 -07:00
Todd Volkert
7a94e0c73f Fix broken Linux build (flutter/engine#5019)
After we write the pixels in the correct format,
the color type of the SkPixmap is still set to
its previous value, so the existing assertion was
failing.
2018-04-16 16:20:48 -07:00
Todd Volkert
8d430519b0 Fix broken Chromebot build (flutter/engine#5018) 2018-04-16 15:10:40 -07:00
Todd Volkert
f10bdfbf77 Return raw (unencoded) bytes in Image.toByteData() (flutter/engine#5008)
Building image encoding into the engine bloated the
binary size. This change will return raw bytes, and
callers who use this functionality can take on the
dependency on image encoding in their apps (via a
Dart package or a platform plugin).

Fixes https://github.com/flutter/flutter/issues/16537
2018-04-16 12:39:46 -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
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 Markov
22cda88320 Revert "Add support for measuring, combining, and getting bounds of Path objects " (flutter/engine#4954)
* Revert "Add support for measuring, combining, and getting bounds of Path objects  (#4799)"

This reverts commit db8570675dc3eda5ccdb212d5448d77271c4e883, as it broke engine build bots on Linux and Windows.
2018-04-09 14:31:30 -07:00
Dan Field
db8570675d Add support for measuring, combining, and getting bounds of Path objects (flutter/engine#4799)
* add path measure

* fix typo

* getBound and addPathWithMatrix

* Add myself to Authors, add PathOps

* fix linting issues

* update licenses_flutter to add new files

* Use matrix4 instead of matrix3 for consistency/interop

* put pubspec back

* fix bug in getSegment

* fix typo

* Add return value for PathOp

* refactoring from review

* refactoring from review - still TBD on computeMetrics()

* add doc

* lint issue

* fix computeMetrics, add Path.from

* add missing wireup for clone

* change PathMetrics to iterable, fix bug with angle on Tangent

* prefer std::make_unique

* cleanup docs

* add path measure

* fix typo

* getBound and addPathWithMatrix

* Add myself to Authors, add PathOps

* fix linting issues

* update licenses_flutter to add new files

* Use matrix4 instead of matrix3 for consistency/interop

* put pubspec back

* fix bug in getSegment

* fix typo

* Add return value for PathOp

* refactoring from review

* refactoring from review - still TBD on computeMetrics()

* add doc

* lint issue

* fix computeMetrics, add Path.from

* add missing wireup for clone

* change PathMetrics to iterable, fix bug with angle on Tangent

* prefer std::make_unique

* cleanup docs

* fix iterator bug

* remove unnecessary clone for computeMetrics

* fix some doc issues

* fix PathMeasure iterator, extendWithPath, isClosed, and pubspec.lock

* get rid of orElse; use StateException

* StateError, not StateException

* doc improvements and nits

* add unit tests, fix bugs found during testing

* fix two uncommited doc changes

* one more

* change sign of tangent angle, update docs

* update unit tests for inverted angle

* update tangent to include vector

* Doc fixes
2018-04-09 11:45:39 -07:00
Majid Valipour
9eae92b797 Enable Image encoding by leveraging existing Skia functionality (flutter/engine#4762)
Add Image.toByeData()

Fixes flutter/flutter#11648
2018-04-05 17:26:49 -07:00
Petr Hosek
84293f06da Migrate all uses of gtest to googletest (flutter/engine#4755)
gtest is an old version that predates the googletest and googlemock
merger, all tests should be using the newer googletest that's being
kept in sync with the upstream version.
2018-03-14 11:32:34 -07:00
Alexander Aprelev
5ecac5ba92 Revert "Migrate all uses of gtest to googletest (#4728)" (flutter/engine#4750)
* Merge

* Update license hash
2018-03-06 09:46:24 -08:00
Petr Hosek
93d28a103c Migrate all uses of gtest to googletest (flutter/engine#4728)
gtest is an old version that predates the googletest and googlemock
merger, all tests should be using the newer googletest that's being
kept in sync with the upstream version.
2018-03-06 01:06:32 -08:00
Ian Hickson
73634e73bc Convert MaskFilter to pure-Dart. (flutter/engine#4534) 2018-01-11 23:25:18 -08:00
Ian Hickson
39ba4de88b Offset.direction (flutter/engine#4530)
Since we've got a vector class, and it has a getter for the magnitude,
why not also a getter for the angle.
2018-01-09 22:17:57 -08:00
Jason Simmons
f6c572ca91 Update the path to Skia test images in codec_test (flutter/engine#4460) 2017-12-13 18:12:42 -08:00