739 Commits

Author SHA1 Message Date
Dan Field
5a9ac6e780 expose max depth on Window (flutter/engine#10414) 2019-08-02 20:37:24 -07:00
Jason Simmons
430bed2f4f Ensure that the SingleFrameCodec stays alive until the ImageDecoder invokes its callback (flutter/engine#10297)
SingleFrameCodec had been holding a persistent handle to the peer Dart object
while waiting for the decoder callback.  However, Dart code could call
Codec.dispose during that interval, which would cause the Dart peer to drop
its reference to the SingleFrameCodec and potentially delete the
SingleFrameCodec.

Fixes https://github.com/flutter/flutter/issues/36631
2019-07-31 14:58:44 -07:00
Kaushik Iska
e20083819a [fuchsia] Push CMX to fars and add product mode support (flutter/engine#10144)
* Capture stderr for ninja command

* br

* [fuchsia] Push CMX to fars and add product mode support.

* fix shit

* fix GN format
2019-07-25 15:09:04 -07:00
gaaclarke
8d52ae8514 Revert "[fuchsia] Use the patched sdk to generate the flutter jit runner far (#10122)" (flutter/engine#10140)
This reverts commit 2c7cabdff9c346ac28b49044726c551c93132f3d.
2019-07-25 10:52:27 -07:00
Kaushik Iska
2c7cabdff9 [fuchsia] Use the patched sdk to generate the flutter jit runner far (flutter/engine#10122) 2019-07-24 17:10:48 -07:00
Jason Simmons
4e67ab7b5f Change ParagraphBuilder to replace the parent style's font families with the child style's font families (flutter/engine#10074)
Previously ParagraphBuilder was concatenating the child's fonts to the
parent's font list, causing the parent's fonts to take precedence.

Fixes https://github.com/flutter/flutter/issues/35992
2019-07-23 17:57:56 -07:00
Jason Simmons
8afed18167 Fix caching of Locale.toString (flutter/engine#9920) 2019-07-19 15:57:28 -07:00
Jason Simmons
2f63de4797 Fix reentrancy handling in SingleFrameCodec (flutter/engine#9931)
After the frame is decoded SingleFrameCodec will invoke pending callbacks
from calls to getNextFrame.  The callbacks could result in more calls to
getNextFrame.  Those calls should receive the frame instead of being added
to the pending list.
2019-07-18 15:54:21 -07:00
Jason Simmons
a5f93f517b Handle decompressed images in InstantiateImageCodec (flutter/engine#9901)
Fixes https://github.com/flutter/flutter/issues/36312
2019-07-18 14:50:45 -07:00
Jason Simmons
51518af101 Fix failure of the onReportTimings window hook test (flutter/engine#9923) 2019-07-18 14:42:33 -07:00
Mouad Debbar
9a2e83b856 Add the isMultiline semantics flag to values (flutter/engine#9894) 2019-07-18 13:14:11 -07:00
Chinmay Garde
215194392d Respect EXIF information while decompressing images. (flutter/engine#9905)
Adds a unit-test asserting this behavior.
2019-07-17 19:14:01 -07:00
Jason Simmons
27f6890c60 In a single frame codec, release the compressed image buffer after giving it to the decoder (flutter/engine#9825)
The codec will retain a reference to the decoded frame so it can be returned
in repeated calls to getNextFrame.

Also change the compressed image buffer to use an anonymous mapping on Android.
This is a workaround for high consumption of native heap pages by Android's
malloc when buffers are allocated on one thread and freed on another thread.

See https://github.com/flutter/flutter/issues/36079
2019-07-17 13:34:40 -07:00
Mouad Debbar
046005bf1f Add multi-line flag to semantics (flutter/engine#9850) 2019-07-17 09:51:09 -07:00
gaaclarke
fd3dac0f58 Made Picture::toImage happen on the IO thread with no need for an onscreen surface. (flutter/engine#9813)
Made Picture::toImage happen on the IO thread with no need for a surface.
2019-07-15 17:16:20 -07:00
Tim Sneath
91405e01e0 Document FontFeature class (flutter/engine#9808)
Add typography sample from the Flutter 1.7 announcement blog.
2019-07-15 10:55:20 -07:00
Chinmay Garde
fc8d8ad4b0 Only release the image data in the unit-test once Skia has accepted ownership of it. (flutter/engine#9816)
Fixes UB which caused failures on Windows on the unit-test run.
2019-07-12 13:03:17 -07:00
Dan Field
7e9ccecf47 Remove breaking asserts (flutter/engine#9797) 2019-07-11 16:46:54 -07:00
Gary Qian
9ca4d91350 Fix typo in PlaceholderAlignment docs (flutter/engine#9793) 2019-07-11 15:38:09 -07:00
Dan Field
fcf9c42593 fix ColorFilter.matrix constness (flutter/engine#9789) 2019-07-11 12:55:49 -07:00
Jason Simmons
20bc546d69 Minimal integration with the Skia text shaper module (flutter/engine#9556)
This converts the libtxt Paragraph and ParagraphBuilder classes into
interfaces with Minikin and SkShaper/SkParagraph based implementations.

Use the --enable-skshaper GN flag to select the Skia shaper implementation
at build time.
2019-07-10 14:13:55 -07:00
Jason Simmons
fe7aa44548 libtxt: fix reference counting of SkFontStyleSets held by font asset providers (flutter/engine#9561) 2019-07-10 12:08:15 -07:00
Dan Field
e38fb755f3 Let pushColorFilter accept all types of ColorFilters (flutter/engine#9641) 2019-07-10 12:06:58 -07:00
Chinmay Garde
4ab0bffeab Fix windows test by not attempting to open a directory as a file. (flutter/engine#9745) 2019-07-10 10:54:40 -07:00
Siva
e0f15b2166 Roll src/third_party/dart 06c3d7ad3a...09fc76bc51 (flutter/engine#9728)
* Roll src/third_party/dart 06c3d7ad3a...09fc76bc51

dart-lang/sdk@09fc76bc51 [vm, compiler] Remove dead _classRangeCheckNegative.
dart-lang/sdk@b472d7a9be Unnecessary null aware spread hint
dart-lang/sdk@f939ad3964 library scope extensions
dart-lang/sdk@9503969664 [vm/bytecode] Add DebugCheck bytecode instruction
dart-lang/sdk@fc542be6b4 Issue 36682. Check that selection offset/length is valid in Extract Method refactoring.
dart-lang/sdk@803658a6d8 [corelib_2] fix bigint_from_test for web platforms
dart-lang/sdk@ad6b1ebbd6 Support for 'double' fields in protocol.
dart-lang/sdk@5479175012 Remove incorrect test.
dart-lang/sdk@058092b5f6 [vm] Fix simarm_x64 build on mac
dart-lang/sdk@307ca3f3b6 [vm/bytecode] Improve single stepping and breakpoint setting in bytecode.
dart-lang/sdk@855830f324 Update LSP spec
dart-lang/sdk@d992f55094 [dartfix] Bump pedantic dep to v1.8.0 and cleanup lint violations
dart-lang/sdk@41330f3e34 gitignore .clangd
dart-lang/sdk@8d07009931 [ VM / Gardening ] Mark disassemble_determinism_test as slow on Windows
dart-lang/sdk@1b82367ed6 Update CHANGELOG to reflect breaking change #36765
dart-lang/sdk@a86db84e0a [fasta] Preserve information about const constructors in outline.
dart-lang/sdk@25319ef7a6 Fix bug in codegen/string_escapes_test.dart.
dart-lang/sdk@7acecda2cc [vm/ffi] Fix FFI Utf8 example.
dart-lang/sdk@e3b3c6fa28 [vm] Rename 3head flutter patch after re-land of concurrency change
dart-lang/sdk@2cb5303782 [infra] Update checked in SDKs to 2.4.0
dart-lang/sdk@fce43ebc4e [ddk] Pass environmentDefines to CFE through CompilerOptions
dart-lang/sdk@5450d08ca1 Add support for analyzer static error tests.
dart-lang/sdk@0425997b31 Second attempt to reland "[vm/concurrency] Introduce concept of Isolate Groups"
dart-lang/sdk@5470159054 [vm, gc] Produce a proper error message when crashing due to lack of memory at isolate startup.
dart-lang/sdk@bfc7d21da6 Remove useless dart2js_extra/class_test
dart-lang/sdk@572619b639 [vm, bytecode] Fix vm/cc/CompileFunctionOnHelperThread.
dart-lang/sdk@4de495fccc [vm, compiler] Remove dead stub ICCallThroughFunction.
dart-lang/sdk@8a1dcdae68 Graduate 'flutter' domain from experimental, remove unused methods and fields.
dart-lang/sdk@a945888627 Discard constructors and fields temporarily to get valid code compiling

* Fix analyzer warning.
2019-07-09 16:12:06 -07:00
Chinmay Garde
a5799c0964 Rework image & texture management to use concurrent message queues. (flutter/engine#9486)
This patch reworks image decompression and collection in the following ways
because of misbehavior in the described edge cases.

The current flow for realizing a texture on the GPU from a blob of compressed
bytes is to first pass it to the IO thread for image decompression and then
upload to the GPU. The handle to the texture on the GPU is then passed back to
the UI thread so that it can be included in subsequent layer trees for
rendering. The GPU contexts on the Render & IO threads are in the same
sharegroup so the texture ends up being visible to the Render Thread context
during rendering. This works fine and does not block the UI thread. All
references to the image are owned on UI thread by Dart objects. When the final
reference to the image is dropped, the texture cannot be collected on the UI
thread (because it has not GPU context). Instead, it must be passed to either
the GPU or IO threads. The GPU thread is usually in the middle of a frame
workload so we redirect the same to the IO thread for eventual collection. While
texture collections are usually (comparatively) fast, texture decompression and
upload are slow (order of magnitude of frame intervals).

For application that end up creating (by not necessarily using) numerous large
textures in straight-line execution, it could be the case that texture
collection tasks are pending on the IO task runner after all the image
decompressions (and upload) are done. Put simply, the collection of the first
image could be waiting for the decompression and upload of the last image in the
queue.

This is exacerbated by two other hacks added to workaround unrelated issues.
* First, creating a codec with a single image frame immediately kicks of
  decompression and upload of that frame image (even if the frame was never
  request from the codec). This hack was added because we wanted to get rid of
  the compressed image allocation ASAP. The expectation was codecs would only be
  created with the sole purpose of getting the decompressed image bytes.
  However, for applications that only create codecs to get image sizes (but
  never actually decompress the same), we would end up replacing the compressed
  image allocation with a larger allocation (device resident no less) for no
  obvious use. This issue is particularly insidious when you consider that the
  codec is usually asked for the native image size first before the frame is
  requested at a smaller size (usually using a new codec with same data but new
  targetsize). This would cause the creation of a whole extra texture (at 1:1)
  when the caller was trying to “optimize” for memory use by requesting a
  texture of a smaller size.
* Second, all image collections we delayed in by the unref queue by 250ms
  because of observations that the calling thread (the UI thread) was being
  descheduled unnecessarily when a task with a timeout of zero was posted from
  the same (recall that a task has to be posted to the IO thread for the
  collection of that texture). 250ms is multiple frame intervals worth of
  potentially unnecessary textures.

The net result of these issues is that we may end up creating textures when all
that the application needs is to ask it’s codec for details about the same (but
not necessarily access its bytes). Texture collection could also be delayed
behind other jobs to decompress the textures on the IO thread. Also, all texture
collections are delayed for an arbitrary amount of time.

These issues cause applications to be susceptible to OOM situations. These
situations manifest in various ways. Host memory exhaustion causes the usual OOM
issues. Device memory exhaustion seems to manifest in different ways on iOS and
Android. On Android, allocation of a new texture seems to be causing an
assertion (in the driver). On iOS, the call hangs (presumably waiting for
another thread to release textures which we won’t do because those tasks are
blocked behind the current task completing).

To address peak memory usage, the following changes have been made:
* Image decompression and upload/collection no longer happen on the same thread.
  All image decompression will now be handled on a workqueue. The number of
  worker threads in this workqueue is equal to the number of processors on the
  device. These threads have a lower priority that either the UI or Render
  threads. These workers are shared between all Flutter applications in the
  process.
* Both the images and their codec now report the correct allocation size to Dart
  for GC purposes. The Dart VM uses this to pick objects for collection. Earlier
  the image allocation was assumed to 32bpp with no mipmapping overhead
  reported. Now, the correct image size is reported and the mipmapping overhead
  is accounted for. Image codec sizes were not reported to the VM earlier and
  now are. Expect “External” VM allocations to be higher than previously
  reported and the numbers in Observatory to line up more closely with actual
  memory usage (device and host).
* Decoding images to a specific size used to decode to 1:1 before performing a
  resize to the correct dimensions before texture upload. This has now been
  reworked so that images are first decompressed to a smaller size supported
  natively by the codec before final resizing to the requested target size. The
  intermediate copy is now smaller and more promptly collected. Resizing also
  happens on the workqueue worker.
* The drain interval of the unref queue is now sub-frame-interval. I am hesitant
  to remove the delay entirely because I have not been able to instrument the
  performance overhead of the same. That is next on my list. But now, multiple
  frame intervals worth of textures no longer stick around.

The following issues have been addressed:
* https://github.com/flutter/flutter/issues/34070 Since this was the first usage
  of the concurrent message loops, the number of idle wakes were determined to
  be too high and this component has been rewritten to be simpler and not use
  the existing task runner and MessageLoopImpl interface.
* Image decoding had no tests. The new `ui_unittests` harness has been added
  that sets up a GPU test harness on the host using SwiftShader. Tests have been
  added for image decompression, upload and resizing.
* The device memory exhaustion in this benchmark has been addressed. That
  benchmark is still not viable for inclusion in any harness however because it
  creates 9 million codecs in straight-line execution. Because these codecs are
  destroyed in the microtask callbacks, these are referenced till those
  callbacks are executed. So now, instead of device memory exhaustion, this will
  lead to (slower) exhaustion of host memory. This is expected and working as
  intended.

This patch only addresses peak memory use and makes collection of unused images
and textures more prompt. It does NOT address memory use by images referenced
strongly by the application or framework.
2019-07-09 14:59:34 -07:00
Dan Field
52ef4e6cbc Refactor ColorFilter to have a native wrapper (flutter/engine#9668) 2019-07-08 15:36:16 -07:00
Gary Qian
a56a82dc85 TextStyle.height property as a multiple of font size instead of multiple of ascent+descent+leading. (flutter/engine#9041) 2019-07-08 15:32:02 -07:00
liyuqian
44b3aaca5b Improve window documentation (flutter/engine#9669)
To reflect Matt Carroll's recent (02/06/2019) email about promoting
`WidgetsBinding.instance.window` and demoting `ui.window`.

I have to manually search for Matt's email several times when I need
to access the Window object. Having it in the documentation would
help me do that much faster.
2019-07-08 14:40:21 -07:00
Yegor
34839e477a Adds API for retaining intermediate engine layers (flutter/engine#9461)
Add new optional named oldLayer arguments to all push* methods of the SceneBuilder class.

When not null oldLayer signals to the engine that the intent is to update a layer rendered in a previous frame. The engine may optionally use that signal to reuse the resources allocated for that layer in the previous frame. For example, on the Web we can reuse existing DOM nodes and some of their properties and move fewer nodes around the tree.

The return type of each push method has been tightened up. Instead of having all methods return the same EngineLayer type, each method has its own unique layer type, e.g. OffsetEngineLayer. oldLayer parameters match the returned type. This prevents the framework (and other developers using dart:ui directly) from accidentally supplying an engine layer of the wrong type.
2019-06-28 12:56:03 -07:00
Dan Field
489e39e29d Support image filter on paint (flutter/engine#9508) 2019-06-26 23:02:36 -07:00
liyuqian
8bd7715e9c Send timings of the first frame without batching (flutter/engine#9424)
For https://github.com/flutter/flutter/issues/34867

Test added:
* ReportTimingsIsCalledImmediatelyAfterTheFirstFrame
2019-06-24 12:40:38 -07:00
Shi-Hao Hong
b47f8090be Convert RRect.scaleRadii to public method (flutter/engine#9452)
* convert RRect.scaleRadii to public method

* Add scaleRadii tests
2019-06-24 11:20:25 -07:00
chunhtai
9fe6a47ab6 Introduce read only text field semantics (flutter/engine#9281) 2019-06-19 09:42:23 -07:00
Chinmay Garde
5f5821e8c1 Replace lock_guard with scoped_lock and use class template argument deduction. (flutter/engine#9338) 2019-06-17 10:08:45 -07:00
Jason Simmons
14436b047f Fix the name of the channel parameter in PlatformMessage constructors (flutter/engine#9334) 2019-06-14 14:56:51 -07:00
David Worsham
c913c07e29 [scene_host] Expose Opacity and remove ExportNode (flutter/engine#9297)
SCN-947 #comment
SCN-1291 #comment
2019-06-13 10:16:21 -07:00
Zachary Anderson
35107c4dca Revert tracing changes (flutter/engine#9296)
* Revert "[fuchsia] Fix alignment of Fuchsia/non-Fuchsia tracing (#9289)"

This reverts commit e7d406fe36790b1a8161d4687a6a4a144ba44254.

* Revert "Align fuchsia and non-fuchsia tracing (#9199)"

This reverts commit 1ccb372e5f8ceaaf90f5b43b42df617d7f18d955.
2019-06-12 10:25:49 -07:00
Dan Field
899cd81833 [iOS] [a11y] Don't allow scroll views to grab a11y focus (flutter/engine#9282) 2019-06-11 18:02:47 -07:00
liyuqian
fe0db192d9 Report timings faster (100ms) in profile/debug (flutter/engine#9287)
This should satisfy the low-latency need of DevTools.

Test added:
* ReportTimingsIsCalledSoonerInNonReleaseMode
* ReportTimingsIsCalledLaterInReleaseMode
2019-06-11 16:51:20 -07:00
liyuqian
43f4c1d3c7 Make flow layers' attributes immutable (flutter/engine#9176)
For https://github.com/flutter/flutter/issues/33807

We still need to make layers' children immutable for full immutability.
That will require us to change the SceneBuilder API to build the layer
bottom up instead of top down (post-order traversal instead of pre-order
traversal).
2019-06-10 13:09:37 -07:00
Dan Field
41f7455e7d Mark semantics functions const (flutter/engine#9243) 2019-06-08 15:11:04 -07:00
liyuqian
fb0ea0ef4c Add onReportTimings and FrameRasterizedCallback API (flutter/engine#8983)
Using it, a Flutter app can monitor missing frames in the release mode, and a custom Flutter runner (e.g., Fuchsia) can add a custom FrameRasterizedCallback.

Related issues:
https://github.com/flutter/flutter/issues/26154
https://github.com/flutter/flutter/issues/31444
https://github.com/flutter/flutter/issues/32447

Need review as soon as possible so we can merge this before the end of May to catch the milestone.

Tests added:
* NoNeedToReportTimingsByDefault
* NeedsReportTimingsIsSetWithCallback
* ReportTimingsIsCalled
* FrameRasterizedCallbackIsCalled
* FrameTimingSetsAndGetsProperly
* onReportTimings preserves callback zone
* FrameTiming.toString has the correct format

This will need a manual engine roll as the TestWindow defined in the framework needs to implement onReportTimings.
2019-06-06 10:42:48 -07:00
Dan Field
1ccb372e5f Align fuchsia and non-fuchsia tracing (flutter/engine#9199) 2019-06-05 15:14:27 -07:00
David Worsham
7be67a888d [scene_host] Cleanup scene_host closures (flutter/engine#9061)
Fix null closure warnings, and a possible race condition where the
handle for the view_holder_token is destroyed on the gpu thread.  The
handle's destructor enters the isolate, so it must be destroyed on the
UI thread.

FL-257 #done
FL-269 #done
2019-06-04 12:56:03 -07:00
Gary Qian
f7100ebdd4 Text inline widget LibTxt/dart:ui implementation (flutter/engine#8207) 2019-06-03 10:32:46 -07:00
Dan Field
7513edc9c2 Preserve safe area (flutter/engine#8848)
Preserve safe area on Window regardless of insets.
2019-05-31 09:24:38 -07:00
Chinmay Garde
5efe381d1d Fix unopt variants of profile and release builds. (flutter/engine#9107)
This fixes a regression I introduced in https://github.com/flutter/engine/pull/8869 while preparing the buildroot for Fuchsia.
2019-05-28 12:42:53 -07:00
Chris Bracken
21fd6fb32a Correct typos, adopt US spellings (flutter/engine#9081)
Corects a bnuch of typeos throughout teh engien codebsae. Also makes
a couple minor Commonwealth -> US spelling adjustments for consistency
with the rest of Flutter's codebase.

Made use of `misspell` tool:
https://github.com/client9/misspell
2019-05-25 13:14:46 -07:00
Jason Simmons
6b2bdb6147 libtxt: have GetRectsForRange(strut) fall back to tight bounds if layout isn't forcing use of the strut (flutter/engine#9058) 2019-05-22 13:57:59 -07:00