411 Commits

Author SHA1 Message Date
Yegor
3d213f5548
remove the no longer used children parameter (#5333) 2018-05-22 12:44:42 -07:00
Todd Volkert
dee0a224ac
Support single-argument signature in Canvas.scale() (#5334) 2018-05-22 12:10:38 -07:00
Yegor
f876bd5710
split children into two ordered lists: traversal and hit test (#5091)
* split `children` into two ordered lists: traversal and hit test

* address comments

* reduce node object byte size

* link to DebugSemanticsDumpOrder
2018-05-21 17:44:23 -07:00
liyuqian
eacf06793c
Add debug asserts to using SkVertices::Builder (#5292)
Fixes flutter/flutter#9226
2018-05-18 10:32:56 -07:00
Greg Spencer
05a1687cf6
Moving assets-for-api-docs links to point to new asset dir. (#5296)
No logic changes, only links in doc comments.
2018-05-18 08:56:34 -07:00
Dan Field
0a74ef48f2
TwoPointConicGradients again (#5299)
* update docs for getBounds

* Add computeMetrics suggestion

* better explanation

* Support for TwoPointConical gradients
2018-05-18 07:43:52 -04:00
Alexander Aprelev
4a7940075c
Revert "Support for TwoPointConical gradients (#5275)" (#5293)
This reverts commit 919e8c211f518f17dbd298d9f8e39091b9e3897f as it
breaks flutter gradient_test.
2018-05-17 14:10:19 -07:00
Dan Field
ef0915c106
update docs for Path.getBounds (#5261)
* update docs for getBounds

* Add computeMetrics suggestion

* better explanation
2018-05-17 07:02:28 -04:00
Dan Field
919e8c211f
Support for TwoPointConical gradients (#5275) 2018-05-16 19:27:44 -04:00
Matan Lurey
be6c51735c
Fix documentation mistake in painting.dart (#5236)
s/`[red]`/_correct color_.
2018-05-15 08:00:30 -07:00
Jason Simmons
bff0e0d597
Allow Canvas.saveLayer without bounds (#5240)
Fixes https://github.com/flutter/flutter/issues/17497
2018-05-11 15:18:35 -07:00
Ben Konyi
39c02c4dc9
Fixed Windows build after Blink removal (#5230) 2018-05-10 17:21:12 -07:00
Jason Simmons
4a4cff96d4
Remove Blink code (#5218)
Fixes https://github.com/flutter/flutter/issues/12212
2018-05-10 15:57:29 -07:00
Jason Simmons
11d50441a6
Provide an SkPaint that describes the background of a text style (#5153)
Fixes https://github.com/flutter/flutter/issues/11961
2018-05-09 11:36:52 -07:00
Alexander Aprelev
9e4c5d0e1f
Roll dart sdk to e6d7d67f4b35556805dd083fed15bf3ed41f7e33. (#5165)
* Roll dart sdk to e6d7d67f4b35556805dd083fed15bf3ed41f7e33.

Changes since last dart roll:

```
e6d7d67f4b Revert 4f18af12c7c6d53f02cf32cb9b5ea848b86e1d77 as it causes test breakages.
4877587346 [GN] Uses dart_action.gni instead of compiled_action.gni.
4b89ba24fb Meta CHANGELOG markdown cleanup.
3d688deba7 Bump analysis server version to 1.20.2
0dc81ae4eb Publish package:meta 1.1.5
7e54844fe7 [vm] Fix build for gcc 7.3.0.
9d10a6ad4a Issue 33034. Fix statement completion with missing condition right parenthesis.
3fd2d5fb05 [vm] Use compiler warnings to insist callers check for errors from Dart_Invoke*/Load*/Compile*.
afb490adbc [dart:io] Provide modern Dart-styled constants
2929b71aa2 [kernel/vm] Address follow-up review comments for bytecode generation
73768a5342 General TypeInfo and IdentifierContext cleanup
e93b2ee250 Improve typedef identifier recovery
46a9ed0617 Added example about calling a tear-off with a wrong-shape argument list
0c839cf3f8 [fasta] Add 'as' expressions to the Forest API
16f6ce2fee [release] Prepare changelog for 2.0.0-dev.53.0
d13bf49870 Check type-variable bounds on generic methods
794fe1e14f Add stacktrace tests for synchronous async
fb779df11c [frontend-server] Disable depfile test on Windows.
```

* Adjust gn-scripts to accommodate 487758734695e7a701325b80178465ebbd0fafdd refactoring.
2018-05-03 15:05:50 -07:00
Yegor
d5c1117170
Roll dart to 011676641a8b4b77bb372384c712709cbf037675 (#5146)
* Roll Dart to 011676641a8b4b77bb372384c712709cbf037675.

Reverts b6be9377c58c488afea042a1b0ed8910b158c319 and uses Dart_NewExternalTypedDataWithFinalizer.

* update license goldens
2018-05-01 17:45:38 -07:00
Ryan Macnak
2812ea3ed3
Define Uri.base as CWD to match the standalone Dart VM. (#5137)
Bug: https://github.com/flutter/flutter/issues/17118
2018-05-01 09:30:30 -07:00
Chinmay Garde
110bce4fde
Use the GPU object constructor to create a gradient shader. (#5136)
Fixes build break introduced in 33aaf6fc2f9185aff37683ceaa5c66ec4ea9f916.
2018-04-30 17:06:59 -07:00
Victor Choueiri
33aaf6fc2f Enable sweep gradients (#4950)
* Enable sweep gradients

* Use _matrix4IsValid

* Add assert for startAngle < endAngle

* Use radians for startAngle and endAngle

* Update AUTHORS

* Better assert on matrix4IsValid
2018-04-30 15:58:53 -07:00
Greg Spencer
cf91f89c84
Adding Color.alphaBlend (#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
Chinmay Garde
4d106f8520
In case of empty Dart data responses, don’t call the buffer method on null. (#5114)
Fixes regression introduced in https://github.com/flutter/engine/pull/5101.
2018-04-27 15:22:16 -07:00
Jason Simmons
b6be9377c5
Create message response external typed data objects as Uint8Lists (#5101)
PlatformMessageResponseDart will wrap large responses in Dart external typed
data objects in order to avoid copying the data into a new buffer.

Previously these objects were created with the Dart_TypedData_kByteData type.
A weak persistent handle is then associated with the ByteData to provide a
finalizer that deletes the raw buffer.  However, the Dart VM could call
finalizer on the ByteData even if references still existed to the Dart ByteBuffer
object backing the ByteData.  The ByteBuffer would then be referencing a deleted
raw buffer.

This PR prevents that scenario by creating a Dart_TypedData_kUint8 object,
attaching the finalizer to that object, and then wrapping it in a ByteData.
2018-04-26 17:49:51 -07:00
Dan Field
c249b7026f Path metrics/getBounds/combinations again (#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
Jason Simmons
8da9398ed3
Throw an exception if a secondary isolate tries to send a platform message (#5069)
Platform messages are only support in the UI isolate.  Secondary isolates
do not have a window that can receive incoming messages, and outgoing messages
are not tagged with a destination isolate and thus will always be dispatched
to the UI isolate.

Fixes https://github.com/flutter/flutter/issues/16846
2018-04-25 10:29:20 -07:00
Ryan Macnak
a20fd83039
[fuchsia] Remove dead package file generation from core snapshots. (#5071) 2018-04-24 09:33:52 -07:00
Chinmay Garde
79b9ffb14b
Fixup Fuchsia content handler post shell refactor. (#5072) 2018-04-23 20:16:01 -07:00
Yegor
ec611470b5
replace nextNodeId/previousNodeId with hitTestPosition (#5066) 2018-04-23 16:16:17 -07:00
Jason Simmons
2970c099f7
Use the default microtask scheduler on all isolates except the UI isolate (#5068)
See https://github.com/flutter/flutter/issues/16846
2018-04-23 15:02:19 -07:00
Todd Volkert
cb3376c5de
Support different encodings in Image.toByteData() (#5060)
Fixes https://github.com/flutter/flutter/issues/16635
2018-04-20 19:47:27 -07:00
Michael Goderbauer
995633ef49
Add SemanticsFlag.isHidden (#5052) 2018-04-20 10:37:02 -07:00
Jonah Williams
3405e23a32
AccessibilityBridge support for edge triggered semantics (iOS + Android) (#4901)
AccessibilityBridge support for edge triggered semantics (iOS + Android)
2018-04-19 11:14:47 -07:00
Brian Osman
388f019961 Enable downscale of very large images when uploading on IO thread (#5011) 2018-04-18 18:00:00 -07:00
Jason Simmons
7a6b77999f
Remove the weak pointer factory from the service isolate's DartIsolate object (#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
8973c733a5
Implement Scene::toImage for creating a raster image representation of a scene. (#5021) 2018-04-18 12:42:16 -07:00
Chinmay Garde
1bc0e1bb9a
On windows, refer to Dart snapshot directly executable. (#5024) 2018-04-16 22:02:19 -07:00
Todd Volkert
d6d4eec24c
Fix broken Linux build (#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
d15dc76ea7
Fix broken Chromebot build (#5018) 2018-04-16 15:10:40 -07:00
Todd Volkert
4eaf2c2fea
Return raw (unencoded) bytes in Image.toByteData() (#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
Jonah Williams
0b7d6be976
Re-land "do not pause rendering when android view loses focus" (#5004)
* do not pause rendering when android view loses focus
2018-04-13 17:08:00 -07:00
Chinmay Garde
58e84c8bf0
Re-land "Support multiple shells in a single process. (#4932)" (#4998)
* Re-land "Support multiple shells in a single process. (#4932)"

This reverts commit 723c7d01439da4261bc836075fb55651ce9e7f03.
2018-04-13 13:48:15 -07:00
Jonah Williams
8a6e64a8ef
Revert "Do not pause rendering when android activity loses focus (#4848)" (#4985)
This reverts commit c83d1ef12df0cf8b11a6dda044f812f8cc6c16ef.
2018-04-12 11:20:24 -07:00
Jonah Williams
c83d1ef12d
Do not pause rendering when android activity loses focus (#4848)
* do not pause rendering when android view loses focus
2018-04-12 11:00:31 -07:00
Vyacheslav Egorov
723c7d0143
Revert "Re-land "Support multiple shells in a single process. (#4932)" (#4977)" (#4981)
This reverts commit a3327bff86800b3e654a2988fa7e6049edeb679c.
2018-04-12 18:28:55 +02:00
Chinmay Garde
a3327bff86
Re-land "Support multiple shells in a single process. (#4932)" (#4977)
This reverts commit 9199b40f2a2a6e448cd251de44e020ec3b75002d.
2018-04-11 15:41:23 -07:00
Chinmay Garde
9199b40f2a
Revert "Support multiple shells in a single process. (#4932)" (#4964)
This reverts commit 6baff4c821350bbcb64e7d029574b567f3801a1a.
2018-04-10 15:28:43 -07:00
Chinmay Garde
6baff4c821
Support multiple shells in a single process. (#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
c8e4c6984b
Avoid copying the contents of large platform message responses (#4947)
Assets are loaded via platform messages, and currently asset payloads are
being copied into Dart typed data buffers.  This change uses external
typed data objects that wrap the existing buffer if copying would be
expensive.

See https://github.com/flutter/flutter/issues/16291
2018-04-10 12:15:58 -07:00
Alexander Markov
3cc6c672e1
Revert "Add support for measuring, combining, and getting bounds of Path objects " (#4954)
* Revert "Add support for measuring, combining, and getting bounds of Path objects  (#4799)"

This reverts commit 8c00101a59cd16c30d51663b58c6f2ee9ee2e2b9, as it broke engine build bots on Linux and Windows.
2018-04-09 14:31:30 -07:00
Dan Field
8c00101a59 Add support for measuring, combining, and getting bounds of Path objects (#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
Jason Simmons
d42b5b73b5
libtxt: support for locale-specific text styles (#4943)
Fixes https://github.com/flutter/flutter/issues/12630
2018-04-06 11:48:03 -07:00