1272 Commits

Author SHA1 Message Date
Michael Klimushyn
0f980e5e01 Add better CIPD docs. (flutter/engine#10185)
Also commits cipd.yaml to source.
2019-07-26 15:39:48 -07:00
Kaushik Iska
92f9dac0f7 [dart_runner] dart jit runner and dart jit product runner (flutter/engine#10179)
We now build dart runner as well
2019-07-26 13:29:46 -07:00
Jonah Williams
addbc5d4cb add suggested changes from flutter roll (flutter/engine#10176) 2019-07-26 12:56:08 -07:00
Kaushik Iska
7c3360e4bf [fuchsia] Add support for aot mode in flutter runner (flutter/engine#10171)
* [fuchsia] Add support for aot mode in flutter runner

* [fuchsia] Bundle observatory with not product runners
2019-07-26 10:19:13 -07:00
Kaushik Iska
af07c640f7 [dart_runner] Rename dart to dart runner (flutter/engine#10172) 2019-07-26 10:15:08 -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
Francisco Magdaleno
3d070e1376 Revert "[macos] Revert check on FlutterCodecs and refactor message function] (#10009)" (flutter/engine#10141)
This reverts commit 471657f667d1489274fe7a414a8523e1429e4bd7.
2019-07-25 13:47:29 -07:00
gaaclarke
c3c32a1e2f ios: Fixed the callback for the first frame so that it isn't predicated on having a splash screen. (flutter/engine#9952) 2019-07-25 12:37:38 -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
gaaclarke
60c57dbb11 Fixed memory leak with engine registrars. (flutter/engine#10068) 2019-07-24 15:43:39 -07:00
Kaushik Iska
7f9170be1f [fuchsia] Use manifest file to better replicate the existing build (flutter/engine#10102)
* Use manifest file to better replicate the existing build

Also fix app/bin error

* Add remaining shit

* patch in the remaining stuff

* Update BUILD.gn
2019-07-24 13:57:46 -07:00
Kaushik Iska
2117168f17 [fuchsia] Add sysroot and clang libs to package (flutter/engine#10082)
* [fuchsia] Add sysroot deps

* bundle in clang stuff too

* fix host_os
2019-07-23 21:08:25 -07:00
Kaushik Iska
602771c7d4 [fuchsia] Add support for libs in packages (flutter/engine#10081) 2019-07-23 19:22:42 -07:00
Kaushik Iska
99a3e1a60f One more luci fix (flutter/engine#10078)
* Missing icu data from the far

* One more place to change the artifact name

* real name
2019-07-23 17:56:49 -07:00
Kaushik Iska
27f1cc9865 Basic structure for flutter_jit_runner far (flutter/engine#10073)
* Basic structure for flutter_jit_runner far

- Added a package_dir gni that copies the dir structure.
- Doesn't support a lot of the existing functionality.
- Added a script to copy paths.

* pick libdart based on flutter mode

* fix licenses
2019-07-23 16:51:50 -07:00
Francisco Magdaleno
471657f667 [macos] Revert check on FlutterCodecs and refactor message function] (flutter/engine#10009)
* [macos] Revert check on FlutterCodecs and refactor message function]

* Remove duplicated code

* Move FlutterPlatformMessage initialization
2019-07-23 15:22:38 -07:00
adazh
6f7e34fbb8 Added a DartExecutor API for querying # of pending channel callbacks (flutter/engine#10021) 2019-07-23 13:11:03 -07:00
Michael Klimushyn
603d401fc2 Add working Robolectric tests (flutter/engine#9954)
`gclient sync` now grabs Robolectric, JUnit, and their transitive
runtime dependencies. They're being stored in a new CIPD package,
`flutter/android/robolectric_bundle`.

`shell/platform/android/BUILD.gn` has a new target for building the
tests, `robolectric_tests`. `testing/run_tests.py` has been extended to
build and run the new target. Runs the android tests under
"build_and_test_android" on CI.

This also adds some very simple sample tests to start with and a README
to the java tests directory.
2019-07-23 09:06:19 -07:00
Justin McCandless
1b87854bf5 Add support for Android's visible password input type (flutter/engine#9999)
For framework PR https://github.com/flutter/flutter/issues/31738
2019-07-23 07:57:39 -07:00
stuartmorgan
1299da0e74 Add a macro for prefixing embedder.h symbols (flutter/engine#9851)
embedder.h is a C API, so has no namespace, and only uses 'Flutter' as a
prefix for most symbol names. This creates potential collisions with
other code; for instance, FlutterEngine is the name of a type in
embedder.h, but also an ObjC class in the iOS Flutter API.

This adds a macro that can be set to prefix symbol names, allowing
clients (notably, the macOS embedding) to adjust the names used by the
embedding API internally without breaking ABI or API compatibility for
the standard engine build.

Currently the macro is only applied to FlutterEngine, since that's the
symbol that is currently at issue, but it can be expanded to other
symbols in the future.
2019-07-23 05:48:48 -07:00
Matt Carroll
342ba41f9c Android Embedding Refactor PR36: Add splash screen support. (flutter/engine#9525) 2019-07-22 14:01:34 -07:00
Jason Simmons
b48ddc3d9c Declare a copy of the enable_bitcode flag within the Flutter build scripts for use in Fuchsia builds (flutter/engine#10003)
enable_bitcode is defined in build/toolchain/clang.gni, which exists in the
Flutter buildroot but not in the Fuchsia source tree.
2019-07-22 12:06:16 -07:00
Francisco Magdaleno
4833061af2 [macos] Add reply to binary messenger (flutter/engine#9953)
* Add reply to binary messenger

* Address comments

* Formatting

* Address comments
2019-07-22 11:08:08 -07:00
Matt Carroll
532ed38c87 Added hasRenderedFirstFrame() to old FlutterView for Espresso (#36211). (flutter/engine#9939) 2019-07-19 16:46:02 -07:00
Matt Carroll
4046164120 Removed PlatformViewsController if-statements from TextInputPlugin (#34286). (flutter/engine#9938) 2019-07-19 13:52:45 -07:00
gaaclarke
e7720142ef Removed logic from FlutterAppDelegate into FlutterPluginAppLifeCycleDelegate (flutter/engine#9893)
Removed logic from FlutterAppDelegate into
FlutterPluginAppLifeCycleDelegate.  This is a better place for
add-to-app since it doesn't require them to use our app delegate.
2019-07-19 10:58:39 -07:00
gaaclarke
9bc02314b0 Split out lifecycle protocol (flutter/engine#9922)
Split out lifecycle calls to plugins to their own protocol to clean up
FlutterPlugin and make the API slightly closer to Android.
2019-07-19 10:17:48 -07:00
Chris Yang
bd2335aea6 [platform view] do not make clipping view and interceptor view clipToBounds (flutter/engine#9937) 2019-07-19 09:00:43 -07:00
stuartmorgan
934901b4e8 Don't try to use unset assets_dir setting (flutter/engine#9924)
Debug builds log invalid file errors on launch of anything using the
embedding API due to an unconditional use of assets_dir, even though
only one of assets_dir or assets_path needs to be set (and the embedding
API currently uses the latter). This checks that the FD has been set
before trying to use it to create an asset resolver.

Also eliminates a duplicate code path in embedder.cc, where it was
calling RunConfiguration::InferFromSettings, then running exactly the
same asset manager creation code again locally.
2019-07-18 14:07:13 -07:00
gaaclarke
8ef2e3aa28 Removed unused method. (flutter/engine#9919) 2019-07-18 11:28:41 -07:00
Dan Field
f743db9bf5 Add clang version to Info.plist (flutter/engine#9873) 2019-07-17 12:14:07 -07:00
Mouad Debbar
046005bf1f Add multi-line flag to semantics (flutter/engine#9850) 2019-07-17 09:51:09 -07:00
Francisco Magdaleno
cfbe3d0463 Assign missing headless execution variable (flutter/engine#9855) 2019-07-17 08:46:01 -07:00
gaaclarke
c84f60ea75 Fixed error in generated xml Info.plist. (flutter/engine#9867) 2019-07-16 18:24:53 -07:00
gaaclarke
4a23fbcb30 Started adding the engine hash to frameworks' Info.plist. (flutter/engine#9847)
Started adding the engine hash to Flutter.framework's Info.plist.
2019-07-16 15:54:26 -07:00
Amir Hardon
c87144b653 Preserve the alpha for VD content by setting a transparent background. (flutter/engine#9849)
The previous attempt to do this by setting the theme to
Theme_Translucent_NoTitleBar was reported to offsetting touch events on
specific Xiaomi devices.
2019-07-16 12:45:20 -07:00
Pierre Champion
4d9128b964 SendPlatformMessage allow null message value (flutter/engine#9781) 2019-07-16 11:38:33 -07:00
Amir Hardon
a6be960c2f Make the virtual display's window translucent (flutter/engine#9828)
By default alpha is not preserved for the VD's contents.
We make the window translucent as a side effect of doing so is preserving alpha.
There should not be extra performance cost for setting the window to be translucent as there is only a single window within the VD.

Fixes flutter/flutter#33756
2019-07-15 16:51:36 -07:00
Jason Simmons
d4894e906d Fall back to a fully qualified path to libapp.so if the library can not be loaded by name (flutter/engine#9762)
libapp.so contains compiled application Dart code.  On most Android systems,
this library can be loaded by calling dlopen("libapp.so"), which will search
Android's default library directories.

On some Android devices this does not work as expected.  As a workaround, this
patch provides a fallback path to libapp.so based on ApplicationInfo.nativeLibraryDir.

Fixes https://github.com/flutter/flutter/issues/35838
2019-07-11 12:39:42 -07:00
liyuqian
907657faaf Add comments to differentiate two cache paths (flutter/engine#9721) 2019-07-11 11:24:43 -07:00
gaaclarke
5b09d678cf Un-deprecated FlutterViewController's binaryMessenger. (flutter/engine#9767)
Un-deprecated FlutterViewController's binaryMessenger.  Leaving it as
a valid convenience method and to help minimize a breaking change.
2019-07-11 10:04:26 -07:00
Michael Klimushyn
15a831d358 Add hooks for InputConnection lock and unlocking (flutter/engine#9727)
With this, plugins can know whether or not their input connection should
be cached. In very rare cases this can be used by plugins to know how to
more properly handle their own input connections, in cases where they're
overriding typical input behavior themselves.
2019-07-11 09:47:35 -07:00
stuartmorgan
28e61558ae FLEViewController/Engine API changes (flutter/engine#9750)
Updates the way FLEViewController and FLEEngine interact,
making their APIs much more closely aligned with the iOS versions
of the classes.

As part of the change, removes the need for an explicit launch
call on FLEViewController. Also adds entrypoint support when
running an engine directly, matching iOS.

Breaking change for macOS runners.

Part of https://github.com/flutter/flutter/issues/31735
2019-07-10 19:54:41 -07:00
stuartmorgan
d79e57999b Make FLEViewController's view an internal detail (flutter/engine#9741)
Rather than clients needing to create an appropriate view in a XIB and
attach it to an FLEViewController, which is error-prone, have
FLEViewController create its own view programatically. The view is now
an internal detail, so calling setView: on an FLEViewController will no
longer work.

As a result of the view being internal, the public API surface is
simplified.

This is a breaking change for macOS Runners.
2019-07-10 13:45:53 -07:00
gaaclarke
6acae05b3c Synchronize main thread and gpu thread for first render frame (flutter/engine#9506)
Got rid of the black frame by synchronizing the main thread with the
gpu thread to make sure a frame is rendered before presenting the
view.
2019-07-10 13:14:07 -07:00
Gary Qian
41296831a7 Fix backspace crash on Chinese devices (flutter/engine#9734) 2019-07-10 12:08:03 -07:00
Siva
60dbf1c7ac Fix Fuchsia build. (flutter/engine#9730) 2019-07-09 16:52:00 -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