diff --git a/.cirrus.yml b/.cirrus.yml index f49b9da8bfea6..585c265c3e5e5 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -19,11 +19,12 @@ task: gclient sync matrix: - - name: build_host + - name: build_and_test_host compile_host_script: | cd $ENGINE_PATH/src ./flutter/tools/gn --unoptimized ninja -C out/host_debug_unopt + test_host_script: cd $ENGINE_PATH/src && ./flutter/testing/run_tests.sh - name: build_android compile_host_script: | cd $ENGINE_PATH/src @@ -45,4 +46,3 @@ format_and_dart_test_task: format_script: cd $ENGINE_PATH/src/flutter && ./ci/format.sh build_script: cd $ENGINE_PATH/src/flutter && ./ci/build.sh - test_script: cd $ENGINE_PATH/src/flutter && ./ci/test.sh diff --git a/.gitattributes b/.gitattributes index 21a13a6c6e189..915d1ed51d121 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,7 +1,3 @@ -## This page intentionally left blank. ## -# -# Workaround for VS2013 automatically creating .gitattributes files with -# default settings that we don't want. -# See also: -# http://connect.microsoft.com/VisualStudio/feedback/details/804948/inappropriately-creates-gitattributes-file -# http://crbug.com/342064 +# Dart sources have to be normalized so that source offsets in kernel files +# with source embedded in them match across all platforms. +*.dart text eol=lf \ No newline at end of file diff --git a/.gitignore b/.gitignore index 730c7e4ce18fb..870f951370586 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ tags Thumbs.db .idea pubspec.lock +.vscode/ diff --git a/AUTHORS b/AUTHORS index ddcf4d7bd4e18..53ad592d738bf 100644 --- a/AUTHORS +++ b/AUTHORS @@ -4,6 +4,8 @@ # Name/Organization Google Inc. +The Chromium Authors +The Fuchsia Authors Jim Simon Ali Bitek Jacob Greenfield diff --git a/BUILD.gn b/BUILD.gn index 36cb322caa3bd..9bfa135468c01 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -43,6 +43,10 @@ group("flutter") { "$flutter_root/synchronization:synchronization_unittests", "$flutter_root/third_party/txt:txt_unittests", ] + + if (!is_win) { + public_deps += [ "$flutter_root/shell/common:shell_benchmarks" ] + } } } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6fe6a92aafd73..aa1efa2bc0437 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,274 +3,16 @@ Contributing to the Flutter engine [![Build Status](https://cirrus-ci.com/flutter/engine.svg)](https://cirrus-ci.com/flutter/engine) -_See also: [Flutter's code of conduct](https://flutter.io/design-principles/#code-of-conduct)_ +_See also: [Flutter's code of conduct](https://github.com/flutter/flutter/blob/master/CODE_OF_CONDUCT.md)_ Welcome ------- -This guide introduces you to building and contributing to the Flutter engine. -For an introduction to contributing to the Flutter framework, see [the equivalent -document in the framework's repository](https://github.com/flutter/flutter/blob/master/CONTRIBUTING.md). +For an introduction to contributing to Flutter, see [our +contributor +guide](https://github.com/flutter/flutter/blob/master/CONTRIBUTING.md). - -I built it before. Remind me, how do I do it again? ---------------------------------------------------- - -If you have previously built the engine (i.e. your environment is already setup) and just want a refresher, then feel free to skip to one of the following sections: - -- [Build for Android](#android-cross-compiling-from-mac-or-linux) -- [Build for iOS](#ios-cross-compiling-from-mac) -- [Build flutter_tester](#desktop-mac-and-linux-for-tests) - -Otherwise, begin from the next section, which will help you prepare your environment. - -Things you will need --------------------- - - * Linux, Mac OS X, or Windows - * Windows doesn't support cross-compiling artifacts for Android or iOS - * Linux doesn't support cross-compiling artifacts for iOS - * git (used for source version control). - * An IDE. We recommend [IntelliJ with the Flutter plugin](https://flutter.io/intellij-ide/) or Xcode. - * An ssh client (used to authenticate with GitHub). - * Chromium's [depot_tools](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up) (make sure it's in your path). We use the `gclient` tool from depot_tools. - * Python (used by many of our tools, including 'gclient'). - * On Mac OS X and Linux: curl and unzip (used by `gclient sync`). - * On Windows: Visual Studio (required for non-Googlers only). - * Recommended for Googlers: Goma for distributed builds. - -You do not need [Dart](https://www.dartlang.org/downloads/linux.html) installed, as a Dart tool chain is automatically downloaded as part of the "getting the code" step. Similarly for the Android SDK, it's downloaded by the `gclient sync` step below. - -Getting the code and configuring your environment -------------------------------------------------- - - * Ensure all the dependencies described in the previous section, in particular git, ssh, depot_tools, python, and curl, are installed. - * Fork `https://github.com/flutter/engine` into your own GitHub account. If you already have a fork, and are now installing a development environment on a new machine, make sure you've updated your fork so that you don't use stale configuration options from long ago. Do not use `git clone` to check out this repository; `gclient` will do it for you. - * If you haven't configured your machine with an SSH key that's known to github then - follow the directions here: https://help.github.com/articles/generating-ssh-keys/. - * Create an empty directory for your copy of the repository. For best results, call it `engine`: some of the tools assume this name when working across repositories. (They can be configured to use other names too, so this isn't a strict requirement.) - * Create a `.gclient` file in the `engine` directory with the following contents, replacing - `` with your GitHub account name: - -``` -solutions = [ - { - "managed": False, - "name": "src/flutter", - "url": "git@github.com:/engine.git", - "custom_deps": {}, - "deps_file": "DEPS", - "safesync_url": "", - }, -] -``` - - * `cd engine` (Change to the directory in which you put the `.gclient` file.) - * `gclient sync` This will fetch all the source code that Flutter depends on. Avoid interrupting this script, it can leave your repository in an inconsistent state that is tedious to clean up. (This step automatically runs `git clone`, among other things.) - * `cd src/flutter` (Change to the `flutter` directory of the `src` directory that `gclient sync` created in your `engine` directory.) - * `git remote add upstream git@github.com:flutter/engine.git` (So that you fetch from the master `flutter/engine` repository, not your clone, when running `git fetch` et al.) - * `cd ..` (Return to the `src` directory that `gclient sync` created in your `engine` directory.) - * If you're on Linux, run `sudo ./build/install-build-deps-android.sh` - * If you're on Linux, run `sudo ./build/install-build-deps.sh` - * If you're on Mac, install Oracle's Java JDK, version 1.7 or later. - * If you're on Mac, install `ant`: `brew install ant` - * If you're on Windows, install Visual Studio (non-Google developers only) - * If you're planning on working on the [buildroot](https://github.com/flutter/buildroot) repository as well, and have a local checkout of that repository, run the following commands in the `src` directory to update your git remotes accordingly: - - ```bash - git remote rename origin upstream - git remote add origin git@github.com:/buildroot.git - ``` - -Building and running the code ------------------------------ - -### General - -Most developers will use the `flutter` tool in [the main Flutter repository](https://github.com/flutter/flutter) for interacting with their built flutter/engine. To do so, the `flutter` tool accepts two global parameters `local-engine-src-path` and `local-engine`, a typical invocation would be: `--local-engine-src-path /path/to/engine/src --local-engine=android_debug_unopt`. - -Additionally if you've modified dart sources in `flutter/engine`, you'll need to add a `dependency_overrides` section to point to your modified `package:sky_engine` and `package:sky_services` to the `pubspec.yaml` for the flutter app you're using the custom engine with. A typical example would be: -``` -dependency_overrides: - sky_engine: - path: /path/to/flutter/engine/out/host_debug/gen/dart-pkg/sky_engine - sky_services: - path: /path/to/flutter/engine/out/host_debug/gen/dart-pkg/sky_services -``` -Depending on the platform you choose below, you will need to replace `host_debug` with the appropriate directory. - -### Android (cross-compiling from Mac or Linux) - -Run the following steps, from the `src` directory created in the steps above: - -* Update the Flutter Engine repo. - * `git pull upstream master` in `src/flutter` -* Update your dependencies - * `gclient sync` -* Prepare your build files - * `./flutter/tools/gn --android --unoptimized` for device-side executables - * `./flutter/tools/gn --android --android-cpu x86 --unoptimized` for x86 emulators - * `./flutter/tools/gn --android --android-cpu x64 --unoptimized` for x64 emulators - * `./flutter/tools/gn --unoptimized` for host-side executables -* Build your executables - * `ninja -C out/android_debug_unopt` for device-side executables - * `ninja -C out/android_debug_unopt_x86` for x86 emulators - * `ninja -C out/android_debug_unopt_x64` for x64 emulators - * `ninja -C out/host_debug_unopt` for host-side executables - * These commands can be combined. Ex: `ninja -C out/android_debug_unopt && ninja -C out/host_debug_unopt` - * For Googlers, consider also using the option `-j 1000` to parallelize the build using Goma. - -This builds a debug-enabled ("unoptimized") binary configured to run Dart in -checked mode ("debug"). There are other versions, [discussed on the wiki](https://github.com/flutter/flutter/wiki/Flutter's-modes). - -To run an example with your locally built binary, you'll also need to clone -[the main Flutter repository](https://github.com/flutter/flutter). See -[the instructions for contributing](https://github.com/flutter/flutter/blob/master/CONTRIBUTING.md) -to the main Flutter repository for detailed instructions. For your convenience, -the `engine` and `flutter` directories should be in the same parent directory. - -Once you've got everything set up, you can run an example using your locally -built engine by switching to that example's directory, running `pub get` to make -sure its dependencies have been downloaded, and using `flutter run` with an -explicit `--local-engine-src-path` pointing at the `engine/src` directory. Make -sure you have a device connected over USB and debugging enabled on that device: - - * `cd /path/to/flutter/examples/hello_world` - * `../../bin/flutter run --local-engine-src-path /path/to/engine/src --local-engine=android_debug_unopt` or `--local-engine=android_debug_unopt_x64` - -If you put the `engine` and `flutter` directories side-by-side, you can skip the -tedious `--local-engine-src-path` option and the `flutter` tool will -automatically determine the path. - -You can also specify a particular Dart file to run if you want to run an example -that doesn't have a `lib/main.dart` file using the `-t` command-line option. For -example, to run the `tabs.dart` example in the `examples/widgets` directory on a -connected Android device, from that directory you would run: - - * `flutter run --local-engine=android_debug_unopt -t tabs.dart` - -If you're going to be debugging crashes in the engine, make sure you add -`android:debuggable="true"` to the `` element in the -`android/AndroidManifest.xml` file for the Flutter app you are using -to test the engine. - -### iOS (cross-compiling from Mac) - -* Make sure you have Xcode 9.0+ installed. -* `git pull upstream master` in `src/flutter` to update the Flutter Engine repo. -* `gclient sync` to update dependencies. -* `./flutter/tools/gn --ios --unoptimized` to prepare build files for device-side executables (or `--ios --simulator --unoptimized` for simulator). - * For a discussion on the various flags and modes, [read this discussion](https://github.com/flutter/flutter/wiki/Flutter's-modes). - * This also produces an Xcode project for working with the engine source code at `out/ios_debug_unopt` -* `./flutter/tools/gn --unoptimized` to prepare the build files for host-side executables. -* `ninja -C out/ios_debug_unopt && ninja -C out/host_debug_unopt` to build all artifacts (use `out/ios_debug_sim_unopt` for Simulator). - * For Googlers, consider also using the option `-j 1000` to parallelize the build using Goma. - -Once the artifacts are built, you can start using them in your application by following these steps: -* `cd /path/to/flutter/examples/hello_world` -* `../../bin/flutter run --local-engine-src-path /path/to/engine/src --local-engine=ios_debug_unopt` or `--local-engine=ios_debug_sim_unopt` for simulator - * If you are debugging crashes in the engine, you can connect the `LLDB` debugger from `Xcode` by opening `ios/Runner.xcworkspace` and starting the application by clicking the Run button (CMD + R). - * To debug non crashing code, open Xcode with `ios/Runner.xcworkspace`, expand Flutter->Runner->Supporting Files->main.m in the Runner project. Put a breakpoint in main() then set your desired breakpoint in the engine in [lldb](https://lldb.llvm.org/tutorial.html) via `breakpoint set -...`. - - -### Desktop (Mac and Linux), for tests - -To run the tests, you should first clone [the main Flutter repository](https://github.com/flutter/flutter). -See [the instructions for contributing](https://github.com/flutter/flutter/blob/master/CONTRIBUTING.md) -to the main Flutter repository for detailed instructions. By default, Flutter will use the bundled version -of the engine. Follow the next steps to run tests using the locally-built engine: - -* `git pull upstream master` in `src/flutter` to update the Flutter Engine repo. -* `gclient sync` to update your dependencies. -* `./flutter/tools/gn --unoptimized` to prepare your build files. -* `ninja -C out/host_debug_unopt` to build a desktop unoptimized binary. - * For Googlers, consider also using the option `-j 1000` to parallelize the build using Goma. -* `--unoptimized` disables C++ compiler optimizations and does not strip debug symbols. You may skip the flag and invoke `ninja -C out/host_debug` if you would rather have the native components optimized. -* `flutter test --local-engine=host_debug_unopt` will run tests using the locally-built `flutter_tester`. - -### Desktop (gen_snapshot for Windows) - -You can only build selected binaries on Windows (mainly `gen_snapshot`). - -* Make sure you have Visual Studio installed (non-Googlers only). -* `git pull upstream master` in `src/flutter` to update the Flutter Engine repo. -* `gclient sync` to update your dependencies. -* `python .\flutter\tools\gn [--unoptimized] --runtime-mode=[debug|profile|release] [--android]` to prepare your build files. -* `ninja -C .\out\ gen_snapshot` to build. - -### Building all the builds that matter on Linux and Android - -The following script will update all the builds that matter if you're developing on Linux and testing on Android and created the `.gclient` file in `~/dev/engine`: - -```bash -set -ex - -cd ~/dev/engine/src/flutter -git fetch upstream -git rebase upstream/master -gclient sync -cd .. - -flutter/tools/gn --unoptimized --runtime-mode=debug -flutter/tools/gn --android --unoptimized --runtime-mode=debug -flutter/tools/gn --android --unoptimized --runtime-mode=profile -flutter/tools/gn --android --unoptimized --runtime-mode=release -flutter/tools/gn --android --runtime-mode=debug -flutter/tools/gn --android --runtime-mode=profile -flutter/tools/gn --android --runtime-mode=release - -cd out -find . -mindepth 1 -maxdepth 1 -type d | xargs -n 1 sh -c 'ninja -C $0 || exit 255' -``` - - -Contributing code ------------------ - -We gladly accept contributions via GitHub pull requests. See [the wiki](https://github.com/flutter/engine/wiki) for -information about the engine's architecture. - -To start working on a patch: - - * Make sure you are in the `engine/src/flutter` directory. - * `git fetch upstream` - * `git checkout upstream/master -b name_of_your_branch` - * Hack away. - * Please peruse our [style guides](https://flutter.io/style-guide/) and - [design principles](https://flutter.io/design-principles/) before - working on anything non-trivial. These guidelines are intended to - keep the code consistent and avoid common pitfalls. - * C, C++, and Objective-C code should be formatted with `clang-format` before - submission (use `buildtools//clang/bin/clang-format --style=file -i`). - * `git commit -a -m ""` - * `git push origin name_of_your_branch` - -To send us a pull request: - - * `git pull-request` (if you are using [Hub](http://github.com/github/hub/)) or - go to `https://github.com/flutter/engine` and click the - "Compare & pull request" button - -Once you've gotten an LGTM from a project maintainer, submit your changes to the -`master` branch using one of the following methods: - -* Wait for one of the project maintainers to submit it for you -* Click the green "Merge pull request" button on the GitHub UI of your pull - request (requires commit access) -* `git push upstream name_of_your_branch:master` (requires commit access) - -Then, make sure it doesn't make our tree catch fire by watching [the waterfall](https://build.chromium.org/p/client.flutter/waterfall). The waterfall runs -slightly different tests than Travis, so it's possible for the tree to go red even if -Travis did not. If that happens, please immediately revert your change. Do not check -anything in while the tree is red unless you are trying to resolve the problem. - -Please make sure all your checkins have detailed commit messages explaining the patch. -If you made multiple commits for a single pull request, either make sure each one has a detailed -message explaining that specific commit, or squash your commits into one single checkin with a -detailed message before sending the pull request. - -You must complete the -[Contributor License Agreement](https://cla.developers.google.com/clas). -You can do this online, and it only takes a minute. -If you've never submitted code before, you must add your (or your -organization's) name and contact info to the [AUTHORS](AUTHORS) file. +For specific instructions regarding building Flutter's engine, see +[Setting up the Engine development +environment](https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment) +on our wiki. Those instructions are part of the broader onboarding instructions described in the contributing guide. diff --git a/DEPS b/DEPS index 7b875e8e53b01..34a083e6f2d4c 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '3b8b11e1f912fb2ad41de46292819d41f9230748', + 'skia_revision': 'bb37aba39910ef1a95cdcbb5b85d99cdabf3c362', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the @@ -31,7 +31,7 @@ vars = { # Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS. # You can use //tools/dart/create_updated_flutter_deps.py to produce # updated revision list of existing dependencies. - 'dart_revision': '8a919426f0e8665a0e6b01c2fcf3113587f8b040', + 'dart_revision': 'f9ebf2129732fd2b606286fdf58e500384b8a0bc', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -47,20 +47,20 @@ vars = { 'dart_convert_tag': '2.0.2', 'dart_crypto_tag': '2.0.6', 'dart_csslib_tag': '0.14.4+1', - 'dart_dart2js_info_tag': '0.5.6+4', + 'dart_dart2js_info_tag': '0.5.13', 'dart_dart_style_tag': '1.2.0', - 'dart_dartdoc_tag': 'v0.21.1', + 'dart_dartdoc_tag': 'v0.24.1', 'dart_fixnum_tag': '0.10.8', 'dart_glob_tag': '1.1.7', 'dart_html_tag': '0.13.3+2', 'dart_http_multi_server_tag': '2.0.5', 'dart_http_parser_tag': '3.1.1', 'dart_http_retry_tag': '0.1.1', - 'dart_http_tag': '0.11.3+17', + 'dart_http_tag': '0.12.0', 'dart_http_throttle_tag': '1.0.2', - 'dart_intl_tag': '0.15.6', + 'dart_intl_tag': '0.15.7', 'dart_json_rpc_2_tag': '2.0.9', - 'dart_linter_tag': '0.1.65', + 'dart_linter_tag': '0.1.71', 'dart_logging_tag': '0.11.3+2', 'dart_markdown_tag': '2.0.2', 'dart_matcher_tag': '0.12.3', @@ -92,7 +92,7 @@ vars = { 'dart_string_scanner_tag': '1.0.3', 'dart_term_glyph_tag': '1.0.1', 'dart_test_reflective_loader_tag': '0.1.8', - 'dart_test_tag': '1.0.0', + 'dart_test_tag': '1.3.4', 'dart_tuple_tag': 'v1.0.1', 'dart_typed_data_tag': '1.1.6', 'dart_usage_tag': '3.4.0', @@ -104,7 +104,7 @@ vars = { # Build bot tooling for iOS 'ios_tools_revision': '69b7c1b160e7107a6a98d948363772dc9caea46f', - 'buildtools_revision': 'c1408453246f0475547b6fe634c2f3dad71c6457', + 'buildtools_revision': '5a9e1b3a0b84a2871f20f85fde665e54a894ba72', } # Only these hosts are allowed for dependencies in this DEPS file. @@ -117,7 +117,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '96d2493887daabe6877142caa8504a2f964b0e7e', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '29a5d76757ec12655c0562b317830f669bd44ea7', # Fuchsia compatibility # @@ -126,19 +126,19 @@ deps = { # and not have to specific specific hashes. 'src/third_party/tonic': - Var('fuchsia_git') + '/tonic' + '@' + 'd91fa62844f8531a3701450f6192298d0e873246', + Var('fuchsia_git') + '/tonic' + '@' + '5c9c2b63091ffd6000d44a3b5ff86e4f349e6978', 'src/third_party/benchmark': - Var('fuchsia_git') + '/third_party/benchmark' + '@' + '296537bc48d380adf21567c5d736ab79f5363d22', + Var('fuchsia_git') + '/third_party/benchmark' + '@' + '21f1eb3fe269ea43eba862bf6b699cde46587ade', 'src/third_party/googletest': Var('fuchsia_git') + '/third_party/googletest' + '@' + '2072b0053d3537fa5e8d222e34c759987aae1320', 'src/third_party/rapidjson': - Var('fuchsia_git') + '/third_party/rapidjson' + '@' + '9defbb0209a534ffeb3a2b79d5ee440a77407292', + Var('fuchsia_git') + '/third_party/rapidjson' + '@' + '32d07c55db1bb6c2ae17cba4033491a667647753', 'src/third_party/harfbuzz': - Var('fuchsia_git') + '/third_party/harfbuzz' + '@' + 'd837034f09a957faf2814002e8ebd81da6151d1b', + Var('fuchsia_git') + '/third_party/harfbuzz' + '@' + '02caec6c1c6ad996666788b8e920ccaec8b385e5', # Chromium-style # @@ -353,7 +353,7 @@ deps = { Var('chromium_git') + '/external/colorama.git' + '@' + '799604a1041e9b3bc5d2789ecbd7e8db2e18e6b8', 'src/third_party/freetype2': - Var('fuchsia_git') + '/third_party/freetype2' + '@' + '6581fd3e9c8645f01c0d51e4f53893f5391f2bf3', + Var('fuchsia_git') + '/third_party/freetype2' + '@' + 'a10b062df0c8958d69377aa04ea6554a9961a111', 'src/third_party/root_certificates': Var('dart_git') + '/root_certificates.git' + '@' + Var('dart_root_certificates_rev'), @@ -370,9 +370,9 @@ deps = { 'src/third_party/gyp': Var('chromium_git') + '/external/gyp.git' + '@' + '4801a5331ae62da9769a327f11c4213d32fb0dad', - # Headers for Vulkan 1.0 + # Headers for Vulkan 1.1 'src/third_party/vulkan': - Var('github_git') + '/KhronosGroup/Vulkan-Docs.git' + '@' + 'e29c2489e238509c41aeb8c7bce9d669a496344b', + Var('github_git') + '/KhronosGroup/Vulkan-Docs.git' + '@' + 'v1.1.91', 'src/third_party/pkg/when': Var('dart_git') + '/when.git' + '@' + '0.2.0', diff --git a/LICENSE b/LICENSE index 972bb2edb099e..60513d107bf46 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/README.md b/README.md index 7f2d8a53c4850..8eedc223a79fb 100644 --- a/README.md +++ b/README.md @@ -14,26 +14,13 @@ toolchain. Most developers will interact with Flutter via the [Flutter Framework](https://github.com/flutter/flutter), which provides a modern, reactive framework, and a rich set of platform, layout and foundation widgets. - -_Flutter is still under development and we continue to add -features._ However, it is ready for use by early adopters who are willing to deal -with the odd wrinkle or two along the way. We hope you try it out and send -us [feedback](mailto:flutter-dev@googlegroups.com). - - - For information about using Flutter to build apps, please see - the [getting started guide](https://flutter.io/getting-started/). - - - For information about contributing to the Flutter framework, please see - [the main Flutter repository](https://github.com/flutter/flutter/blob/master/CONTRIBUTING.md). - - - For information about contributing code to the engine itself, please see - [CONTRIBUTING.md](CONTRIBUTING.md). - - - For information about the engine's architecture, please see - [the wiki](https://github.com/flutter/engine/wiki). - -Community ---------- - -Join us in our [Gitter chat room](https://gitter.im/flutter/flutter) or join our mailing list, -[flutter-dev@googlegroups.com](https://groups.google.com/forum/#!forum/flutter-dev). +If you are new to Flutter, then you will find more general information +on the Flutter project, including tutorials and samples, on our Web +site at [flutter.io](https://flutter.io). For specific information +about Flutter's APIs, consider our API reference which can be found at +the [docs.flutter.io](https://docs.flutter.io/). + +If you intend to contribute to Flutter, welcome! You are encouraged to +start with [our contributor +guide](https://github.com/flutter/flutter/blob/master/CONTRIBUTING.md), +which helps onboard new team members. diff --git a/assets/BUILD.gn b/assets/BUILD.gn index f28e9bdd0a6ea..f04fe40e1e90a 100644 --- a/assets/BUILD.gn +++ b/assets/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/assets/asset_manager.cc b/assets/asset_manager.cc index 2155d24a78a26..610bd10a14a3f 100644 --- a/assets/asset_manager.cc +++ b/assets/asset_manager.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,10 +7,6 @@ #include "flutter/assets/directory_asset_bundle.h" #include "flutter/fml/trace_event.h" -#ifdef ERROR -#undef ERROR -#endif - namespace blink { AssetManager::AssetManager() = default; @@ -39,7 +35,8 @@ std::unique_ptr AssetManager::GetAsMapping( if (asset_name.size() == 0) { return nullptr; } - TRACE_EVENT0("flutter", "AssetManager::GetAsMapping"); + TRACE_EVENT1("flutter", "AssetManager::GetAsMapping", "name", + asset_name.c_str()); for (const auto& resolver : resolvers_) { auto mapping = resolver->GetAsMapping(asset_name); if (mapping != nullptr) { diff --git a/assets/asset_manager.h b/assets/asset_manager.h index 4ab58ed0f2bf7..42ffa9b1053c4 100644 --- a/assets/asset_manager.h +++ b/assets/asset_manager.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,9 +15,12 @@ namespace blink { -class AssetManager final : public AssetResolver, - public fml::RefCountedThreadSafe { +class AssetManager final : public AssetResolver { public: + AssetManager(); + + ~AssetManager() override; + void PushFront(std::unique_ptr resolver); void PushBack(std::unique_ptr resolver); @@ -32,13 +35,7 @@ class AssetManager final : public AssetResolver, private: std::deque> resolvers_; - AssetManager(); - - ~AssetManager(); - FML_DISALLOW_COPY_AND_ASSIGN(AssetManager); - FML_FRIEND_MAKE_REF_COUNTED(AssetManager); - FML_FRIEND_REF_COUNTED_THREAD_SAFE(AssetManager); }; } // namespace blink diff --git a/assets/asset_resolver.h b/assets/asset_resolver.h index d0a68f0bf2cd8..c49b8fb99a868 100644 --- a/assets/asset_resolver.h +++ b/assets/asset_resolver.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/assets/directory_asset_bundle.cc b/assets/directory_asset_bundle.cc index e801e04ad76e9..2f39535314d91 100644 --- a/assets/directory_asset_bundle.cc +++ b/assets/directory_asset_bundle.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/assets/directory_asset_bundle.h b/assets/directory_asset_bundle.h index f61ac147ff1fb..041c301e8730a 100644 --- a/assets/directory_asset_bundle.h +++ b/assets/directory_asset_bundle.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/assets/zip_asset_store.cc b/assets/zip_asset_store.cc index 7823f6e594396..1b6cb126246c9 100644 --- a/assets/zip_asset_store.cc +++ b/assets/zip_asset_store.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -41,7 +41,8 @@ bool ZipAssetStore::IsValid() const { // |blink::AssetResolver| std::unique_ptr ZipAssetStore::GetAsMapping( const std::string& asset_name) const { - TRACE_EVENT0("flutter", "ZipAssetStore::GetAsMapping"); + TRACE_EVENT1("flutter", "ZipAssetStore::GetAsMapping", "name", + asset_name.c_str()); auto found = stat_cache_.find(asset_name); if (found == stat_cache_.end()) { diff --git a/assets/zip_asset_store.h b/assets/zip_asset_store.h index f801e0b0cca25..a026fb91d29c4 100644 --- a/assets/zip_asset_store.h +++ b/assets/zip_asset_store.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/benchmarking/BUILD.gn b/benchmarking/BUILD.gn new file mode 100644 index 0000000000000..7d49d06c4e7d6 --- /dev/null +++ b/benchmarking/BUILD.gn @@ -0,0 +1,26 @@ +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +config("benchmark_config") { + include_dirs = [ "//third_party/benchmark:benchmark_config" ] +} + +source_set("benchmarking") { + testonly = true + + sources = [ + "benchmarking.cc", + "benchmarking.h", + ] + + public_deps = [ + "$flutter_root/fml", + "//third_party/benchmark", + ] + + public_configs = [ + "$flutter_root:config", + ":benchmark_config", + ] +} diff --git a/benchmarking/benchmarking.cc b/benchmarking/benchmarking.cc new file mode 100644 index 0000000000000..c8e5af7ea3dd5 --- /dev/null +++ b/benchmarking/benchmarking.cc @@ -0,0 +1,22 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "benchmarking.h" + +#include "flutter/fml/icu_util.h" + +namespace benchmarking { + +int Main(int argc, char** argv) { + benchmark::Initialize(&argc, argv); + fml::icu::InitializeICU("icudtl.dat"); + ::benchmark::RunSpecifiedBenchmarks(); + return 0; +} + +} // namespace benchmarking + +int main(int argc, char** argv) { + return benchmarking::Main(argc, argv); +} diff --git a/benchmarking/benchmarking.h b/benchmarking/benchmarking.h new file mode 100644 index 0000000000000..d84004f4d8b01 --- /dev/null +++ b/benchmarking/benchmarking.h @@ -0,0 +1,33 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_BENCHMARKING_BENCHMARKING_H_ +#define FLUTTER_BENCHMARKING_BENCHMARKING_H_ + +#include "benchmark/benchmark_api.h" + +namespace benchmarking { + +class ScopedPauseTiming { + public: + ScopedPauseTiming(::benchmark::State& state, bool enabled = true) + : state_(state), enabled_(enabled) { + if (enabled_) { + state_.PauseTiming(); + } + } + ~ScopedPauseTiming() { + if (enabled_) { + state_.ResumeTiming(); + } + } + + private: + ::benchmark::State& state_; + const bool enabled_; +}; + +} // namespace benchmarking + +#endif // FLUTTER_BENCHMARKING_BENCHMARKING_H_ diff --git a/build/dart/rules.gni b/build/dart/rules.gni index b4b8df6253680..d1b66255e987d 100644 --- a/build/dart/rules.gni +++ b/build/dart/rules.gni @@ -1,4 +1,4 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/build/dart/tools/dart_package_name.py b/build/dart/tools/dart_package_name.py index 5817945e49cba..255ef5be7a13a 100755 --- a/build/dart/tools/dart_package_name.py +++ b/build/dart/tools/dart_package_name.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/build/dart/tools/dart_pkg.py b/build/dart/tools/dart_pkg.py index 34396b827685d..18d2e6951faf8 100755 --- a/build/dart/tools/dart_pkg.py +++ b/build/dart/tools/dart_pkg.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/build/git_revision.py b/build/git_revision.py index bc58320306d14..c571ee823cb0c 100755 --- a/build/git_revision.py +++ b/build/git_revision.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2018 The Flutter Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/ci/build.sh b/ci/build.sh index bf517b64cc0fe..57699445121c1 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -5,7 +5,10 @@ PATH="$HOME/depot_tools:$PATH" cd .. +# Build the dart UI files flutter/tools/gn --unoptimized ninja -C out/host_debug_unopt generate_dart_ui + +# Analyze the dart UI flutter/ci/analyze.sh flutter/ci/licenses.sh diff --git a/ci/docker/build/Dockerfile b/ci/docker/build/Dockerfile index 81655f7adf228..7529ba37d5c7a 100644 --- a/ci/docker/build/Dockerfile +++ b/ci/docker/build/Dockerfile @@ -19,7 +19,7 @@ RUN ./build/install-build-deps.sh --no-prompt RUN ./build/install-build-deps-android.sh --no-prompt WORKDIR $HOME/dart -RUN wget https://storage.googleapis.com/dart-archive/channels/dev/release/2.0.0-dev.63.0/sdk/dartsdk-linux-x64-release.zip +RUN wget https://storage.googleapis.com/dart-archive/channels/dev/release/2.1.0-dev.7.1/sdk/dartsdk-linux-x64-release.zip RUN unzip dartsdk-linux-x64-release.zip ENV PATH $PATH:$HOME/dart/dart-sdk/bin diff --git a/ci/licenses.sh b/ci/licenses.sh index 472285b5b88c3..fe9341cdb5ef4 100755 --- a/ci/licenses.sh +++ b/ci/licenses.sh @@ -8,6 +8,7 @@ echo "Verifying license script is still happy..." for f in out/license_script_output/licenses_*; do if ! cmp -s flutter/ci/licenses_golden/$(basename $f) $f then + echo "============================= ERROR =============================" echo "License script got different results than expected for $f." echo "Please rerun the licenses script locally to verify that it is" echo "correctly catching any new licenses for anything you may have" @@ -21,5 +22,24 @@ for f in out/license_script_output/licenses_*; do fi done +echo "Checking license count in licenses_flutter..." +actualLicenseCount=`tail -n 1 flutter/ci/licenses_golden/licenses_flutter | tr -dc '0-9'` +expectedLicenseCount=2 # When changing this number: Update the error message below as well describing all expected license types. + +if [ "$actualLicenseCount" -ne "$expectedLicenseCount" ] +then + echo "=============================== ERROR ===============================" + echo "The total license count in flutter/ci/licenses_golden/licenses_flutter" + echo "changed from $expectedLicenseCount to $actualLicenseCount." + echo "It's very likely that this is an unintentional change. Please" + echo "double-check that all newly added files have a BSD-style license" + echo "header with the following copyright:" + echo " Copyright 2013 The Flutter Authors. All rights reserved." + echo "Files in 'third_party/txt' may have an Apache license header instead." + echo "If you're absolutely sure that the change in license count is" + echo "intentional, update 'flutter/ci/licenses.sh' with the new count." + exit 1 +fi + echo "Licenses are as expected." exit 0 diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 39147c86be005..981a165c789df 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -7,34 +7,132 @@ USED LICENSES: ==================================================================================================== LIBRARY: engine LIBRARY: txt -ORIGIN: ../../../flutter/flow/layers/physical_shape_layer.cc + ../../../LICENSE +ORIGIN: ../../../flutter/LICENSE TYPE: LicenseType.bsd +FILE: ../../../flutter/DEPS +FILE: ../../../flutter/assets/asset_manager.cc +FILE: ../../../flutter/assets/asset_manager.h +FILE: ../../../flutter/assets/asset_resolver.h +FILE: ../../../flutter/assets/directory_asset_bundle.cc +FILE: ../../../flutter/assets/directory_asset_bundle.h +FILE: ../../../flutter/assets/zip_asset_store.cc +FILE: ../../../flutter/assets/zip_asset_store.h +FILE: ../../../flutter/benchmarking/benchmarking.cc +FILE: ../../../flutter/benchmarking/benchmarking.h +FILE: ../../../flutter/common/settings.cc +FILE: ../../../flutter/common/settings.h +FILE: ../../../flutter/common/task_runners.cc +FILE: ../../../flutter/common/task_runners.h +FILE: ../../../flutter/flow/compositor_context.cc +FILE: ../../../flutter/flow/compositor_context.h FILE: ../../../flutter/flow/debug_print.cc FILE: ../../../flutter/flow/debug_print.h +FILE: ../../../flutter/flow/embedded_views.cc +FILE: ../../../flutter/flow/embedded_views.h +FILE: ../../../flutter/flow/export_node.cc FILE: ../../../flutter/flow/export_node.h +FILE: ../../../flutter/flow/instrumentation.cc +FILE: ../../../flutter/flow/instrumentation.h +FILE: ../../../flutter/flow/layers/backdrop_filter_layer.cc +FILE: ../../../flutter/flow/layers/backdrop_filter_layer.h +FILE: ../../../flutter/flow/layers/child_scene_layer.cc +FILE: ../../../flutter/flow/layers/child_scene_layer.h +FILE: ../../../flutter/flow/layers/clip_path_layer.cc +FILE: ../../../flutter/flow/layers/clip_path_layer.h +FILE: ../../../flutter/flow/layers/clip_rect_layer.cc +FILE: ../../../flutter/flow/layers/clip_rect_layer.h +FILE: ../../../flutter/flow/layers/clip_rrect_layer.cc +FILE: ../../../flutter/flow/layers/clip_rrect_layer.h +FILE: ../../../flutter/flow/layers/color_filter_layer.cc +FILE: ../../../flutter/flow/layers/color_filter_layer.h +FILE: ../../../flutter/flow/layers/container_layer.cc +FILE: ../../../flutter/flow/layers/container_layer.h +FILE: ../../../flutter/flow/layers/layer.cc +FILE: ../../../flutter/flow/layers/layer.h +FILE: ../../../flutter/flow/layers/layer_tree.cc +FILE: ../../../flutter/flow/layers/layer_tree.h +FILE: ../../../flutter/flow/layers/opacity_layer.cc +FILE: ../../../flutter/flow/layers/opacity_layer.h +FILE: ../../../flutter/flow/layers/performance_overlay_layer.cc +FILE: ../../../flutter/flow/layers/performance_overlay_layer.h FILE: ../../../flutter/flow/layers/physical_shape_layer.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.h +FILE: ../../../flutter/flow/layers/picture_layer.cc +FILE: ../../../flutter/flow/layers/picture_layer.h +FILE: ../../../flutter/flow/layers/platform_view_layer.cc +FILE: ../../../flutter/flow/layers/platform_view_layer.h +FILE: ../../../flutter/flow/layers/shader_mask_layer.cc +FILE: ../../../flutter/flow/layers/shader_mask_layer.h FILE: ../../../flutter/flow/layers/texture_layer.cc FILE: ../../../flutter/flow/layers/texture_layer.h +FILE: ../../../flutter/flow/layers/transform_layer.cc +FILE: ../../../flutter/flow/layers/transform_layer.h FILE: ../../../flutter/flow/matrix_decomposition.cc FILE: ../../../flutter/flow/matrix_decomposition.h FILE: ../../../flutter/flow/matrix_decomposition_unittests.cc FILE: ../../../flutter/flow/paint_utils.cc FILE: ../../../flutter/flow/paint_utils.h +FILE: ../../../flutter/flow/raster_cache.cc +FILE: ../../../flutter/flow/raster_cache.h FILE: ../../../flutter/flow/raster_cache_key.cc FILE: ../../../flutter/flow/raster_cache_key.h FILE: ../../../flutter/flow/raster_cache_unittests.cc +FILE: ../../../flutter/flow/scene_update_context.cc +FILE: ../../../flutter/flow/scene_update_context.h +FILE: ../../../flutter/flow/skia_gpu_object.cc +FILE: ../../../flutter/flow/skia_gpu_object.h FILE: ../../../flutter/flow/texture.cc FILE: ../../../flutter/flow/texture.h +FILE: ../../../flutter/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart +FILE: ../../../flutter/fml/arraysize.h +FILE: ../../../flutter/fml/base32.cc +FILE: ../../../flutter/fml/base32.h +FILE: ../../../flutter/fml/base32_unittest.cc +FILE: ../../../flutter/fml/build_config.h +FILE: ../../../flutter/fml/closure.h +FILE: ../../../flutter/fml/command_line.cc +FILE: ../../../flutter/fml/command_line.h +FILE: ../../../flutter/fml/command_line_unittest.cc +FILE: ../../../flutter/fml/compiler_specific.h +FILE: ../../../flutter/fml/eintr_wrapper.h +FILE: ../../../flutter/fml/export.h +FILE: ../../../flutter/fml/file.cc +FILE: ../../../flutter/fml/file.h +FILE: ../../../flutter/fml/file_unittest.cc FILE: ../../../flutter/fml/icu_util.cc FILE: ../../../flutter/fml/icu_util.h +FILE: ../../../flutter/fml/log_level.h +FILE: ../../../flutter/fml/log_settings.cc +FILE: ../../../flutter/fml/log_settings.h +FILE: ../../../flutter/fml/log_settings_state.cc +FILE: ../../../flutter/fml/logging.cc +FILE: ../../../flutter/fml/logging.h +FILE: ../../../flutter/fml/macros.h +FILE: ../../../flutter/fml/make_copyable.h +FILE: ../../../flutter/fml/mapping.cc FILE: ../../../flutter/fml/mapping.h +FILE: ../../../flutter/fml/memory/ref_counted.h +FILE: ../../../flutter/fml/memory/ref_counted_internal.h +FILE: ../../../flutter/fml/memory/ref_counted_unittest.cc +FILE: ../../../flutter/fml/memory/ref_ptr.h +FILE: ../../../flutter/fml/memory/ref_ptr_internal.h +FILE: ../../../flutter/fml/memory/thread_checker.h +FILE: ../../../flutter/fml/memory/weak_ptr.h +FILE: ../../../flutter/fml/memory/weak_ptr_internal.cc +FILE: ../../../flutter/fml/memory/weak_ptr_internal.h +FILE: ../../../flutter/fml/memory/weak_ptr_unittest.cc +FILE: ../../../flutter/fml/message.cc +FILE: ../../../flutter/fml/message.h FILE: ../../../flutter/fml/message_loop.cc FILE: ../../../flutter/fml/message_loop.h FILE: ../../../flutter/fml/message_loop_impl.cc FILE: ../../../flutter/fml/message_loop_impl.h FILE: ../../../flutter/fml/message_loop_unittests.cc +FILE: ../../../flutter/fml/message_unittests.cc +FILE: ../../../flutter/fml/native_library.h +FILE: ../../../flutter/fml/paths.cc FILE: ../../../flutter/fml/paths.h +FILE: ../../../flutter/fml/paths_unittests.cc FILE: ../../../flutter/fml/platform/android/jni_util.cc FILE: ../../../flutter/fml/platform/android/jni_util.h FILE: ../../../flutter/fml/platform/android/jni_weak_ref.cc @@ -42,6 +140,7 @@ FILE: ../../../flutter/fml/platform/android/jni_weak_ref.h FILE: ../../../flutter/fml/platform/android/message_loop_android.cc FILE: ../../../flutter/fml/platform/android/message_loop_android.h FILE: ../../../flutter/fml/platform/android/paths_android.cc +FILE: ../../../flutter/fml/platform/android/paths_android.h FILE: ../../../flutter/fml/platform/android/scoped_java_ref.cc FILE: ../../../flutter/fml/platform/android/scoped_java_ref.h FILE: ../../../flutter/fml/platform/darwin/cf_utils.cc @@ -51,215 +150,185 @@ FILE: ../../../flutter/fml/platform/darwin/message_loop_darwin.mm FILE: ../../../flutter/fml/platform/darwin/paths_darwin.mm FILE: ../../../flutter/fml/platform/darwin/platform_version.h FILE: ../../../flutter/fml/platform/darwin/platform_version.mm +FILE: ../../../flutter/fml/platform/darwin/scoped_block.h FILE: ../../../flutter/fml/platform/darwin/scoped_block.mm FILE: ../../../flutter/fml/platform/darwin/scoped_nsobject.h FILE: ../../../flutter/fml/platform/darwin/scoped_nsobject.mm +FILE: ../../../flutter/fml/platform/fuchsia/paths_fuchsia.cc FILE: ../../../flutter/fml/platform/linux/message_loop_linux.cc FILE: ../../../flutter/fml/platform/linux/message_loop_linux.h FILE: ../../../flutter/fml/platform/linux/paths_linux.cc FILE: ../../../flutter/fml/platform/linux/timerfd.cc FILE: ../../../flutter/fml/platform/linux/timerfd.h +FILE: ../../../flutter/fml/platform/posix/file_posix.cc FILE: ../../../flutter/fml/platform/posix/mapping_posix.cc +FILE: ../../../flutter/fml/platform/posix/native_library_posix.cc +FILE: ../../../flutter/fml/platform/posix/paths_posix.cc +FILE: ../../../flutter/fml/platform/posix/shared_mutex_posix.cc +FILE: ../../../flutter/fml/platform/posix/shared_mutex_posix.h +FILE: ../../../flutter/fml/platform/win/errors_win.cc +FILE: ../../../flutter/fml/platform/win/errors_win.h +FILE: ../../../flutter/fml/platform/win/file_win.cc FILE: ../../../flutter/fml/platform/win/mapping_win.cc FILE: ../../../flutter/fml/platform/win/message_loop_win.cc FILE: ../../../flutter/fml/platform/win/message_loop_win.h +FILE: ../../../flutter/fml/platform/win/native_library_win.cc FILE: ../../../flutter/fml/platform/win/paths_win.cc +FILE: ../../../flutter/fml/platform/win/wstring_conversion.h +FILE: ../../../flutter/fml/string_view.cc +FILE: ../../../flutter/fml/string_view.h +FILE: ../../../flutter/fml/string_view_unittest.cc +FILE: ../../../flutter/fml/synchronization/atomic_object.h +FILE: ../../../flutter/fml/synchronization/count_down_latch.cc +FILE: ../../../flutter/fml/synchronization/count_down_latch.h +FILE: ../../../flutter/fml/synchronization/count_down_latch_unittests.cc +FILE: ../../../flutter/fml/synchronization/shared_mutex.h +FILE: ../../../flutter/fml/synchronization/shared_mutex_std.cc +FILE: ../../../flutter/fml/synchronization/shared_mutex_std.h +FILE: ../../../flutter/fml/synchronization/thread_annotations.h +FILE: ../../../flutter/fml/synchronization/thread_annotations_unittest.cc +FILE: ../../../flutter/fml/synchronization/thread_checker.h +FILE: ../../../flutter/fml/synchronization/thread_checker_unittest.cc +FILE: ../../../flutter/fml/synchronization/waitable_event.cc +FILE: ../../../flutter/fml/synchronization/waitable_event.h +FILE: ../../../flutter/fml/synchronization/waitable_event_unittest.cc FILE: ../../../flutter/fml/task_runner.cc FILE: ../../../flutter/fml/task_runner.h FILE: ../../../flutter/fml/thread.cc FILE: ../../../flutter/fml/thread.h +FILE: ../../../flutter/fml/thread_local.cc FILE: ../../../flutter/fml/thread_local.h FILE: ../../../flutter/fml/thread_local_unittests.cc FILE: ../../../flutter/fml/thread_unittests.cc +FILE: ../../../flutter/fml/time/time_delta.h +FILE: ../../../flutter/fml/time/time_delta_unittest.cc +FILE: ../../../flutter/fml/time/time_point.cc +FILE: ../../../flutter/fml/time/time_point.h +FILE: ../../../flutter/fml/time/time_point_unittest.cc +FILE: ../../../flutter/fml/time/time_unittest.cc FILE: ../../../flutter/fml/trace_event.cc FILE: ../../../flutter/fml/trace_event.h +FILE: ../../../flutter/fml/unique_fd.cc +FILE: ../../../flutter/fml/unique_fd.h +FILE: ../../../flutter/fml/unique_object.h +FILE: ../../../flutter/lib/io/dart_io.cc +FILE: ../../../flutter/lib/io/dart_io.h +FILE: ../../../flutter/lib/snapshot/libraries.json +FILE: ../../../flutter/lib/snapshot/snapshot.dart +FILE: ../../../flutter/lib/snapshot/snapshot.h +FILE: ../../../flutter/lib/snapshot/snapshot_fuchsia.dart +FILE: ../../../flutter/lib/ui/compositing.dart +FILE: ../../../flutter/lib/ui/compositing/scene.cc +FILE: ../../../flutter/lib/ui/compositing/scene.h +FILE: ../../../flutter/lib/ui/compositing/scene_builder.cc +FILE: ../../../flutter/lib/ui/compositing/scene_builder.h FILE: ../../../flutter/lib/ui/compositing/scene_host.cc FILE: ../../../flutter/lib/ui/compositing/scene_host.h +FILE: ../../../flutter/lib/ui/dart_runtime_hooks.cc +FILE: ../../../flutter/lib/ui/dart_runtime_hooks.h +FILE: ../../../flutter/lib/ui/dart_ui.cc +FILE: ../../../flutter/lib/ui/dart_ui.h +FILE: ../../../flutter/lib/ui/dart_wrapper.h +FILE: ../../../flutter/lib/ui/geometry.dart +FILE: ../../../flutter/lib/ui/hash_codes.dart +FILE: ../../../flutter/lib/ui/hooks.dart +FILE: ../../../flutter/lib/ui/isolate_name_server.dart +FILE: ../../../flutter/lib/ui/isolate_name_server/isolate_name_server.cc +FILE: ../../../flutter/lib/ui/isolate_name_server/isolate_name_server.h +FILE: ../../../flutter/lib/ui/isolate_name_server/isolate_name_server_natives.cc +FILE: ../../../flutter/lib/ui/isolate_name_server/isolate_name_server_natives.h +FILE: ../../../flutter/lib/ui/lerp.dart +FILE: ../../../flutter/lib/ui/natives.dart +FILE: ../../../flutter/lib/ui/painting.dart +FILE: ../../../flutter/lib/ui/painting/canvas.cc +FILE: ../../../flutter/lib/ui/painting/canvas.h FILE: ../../../flutter/lib/ui/painting/codec.cc FILE: ../../../flutter/lib/ui/painting/codec.h +FILE: ../../../flutter/lib/ui/painting/engine_layer.cc +FILE: ../../../flutter/lib/ui/painting/engine_layer.h FILE: ../../../flutter/lib/ui/painting/frame_info.cc FILE: ../../../flutter/lib/ui/painting/frame_info.h +FILE: ../../../flutter/lib/ui/painting/gradient.cc +FILE: ../../../flutter/lib/ui/painting/gradient.h +FILE: ../../../flutter/lib/ui/painting/image.cc +FILE: ../../../flutter/lib/ui/painting/image.h +FILE: ../../../flutter/lib/ui/painting/image_encoding.cc +FILE: ../../../flutter/lib/ui/painting/image_encoding.h +FILE: ../../../flutter/lib/ui/painting/image_filter.cc +FILE: ../../../flutter/lib/ui/painting/image_filter.h +FILE: ../../../flutter/lib/ui/painting/image_shader.cc +FILE: ../../../flutter/lib/ui/painting/image_shader.h +FILE: ../../../flutter/lib/ui/painting/matrix.cc +FILE: ../../../flutter/lib/ui/painting/matrix.h +FILE: ../../../flutter/lib/ui/painting/paint.cc +FILE: ../../../flutter/lib/ui/painting/paint.h +FILE: ../../../flutter/lib/ui/painting/path.cc +FILE: ../../../flutter/lib/ui/painting/path.h +FILE: ../../../flutter/lib/ui/painting/path_measure.cc +FILE: ../../../flutter/lib/ui/painting/path_measure.h +FILE: ../../../flutter/lib/ui/painting/picture.cc +FILE: ../../../flutter/lib/ui/painting/picture.h +FILE: ../../../flutter/lib/ui/painting/picture_recorder.cc +FILE: ../../../flutter/lib/ui/painting/picture_recorder.h +FILE: ../../../flutter/lib/ui/painting/rrect.cc +FILE: ../../../flutter/lib/ui/painting/rrect.h +FILE: ../../../flutter/lib/ui/painting/shader.cc +FILE: ../../../flutter/lib/ui/painting/shader.h FILE: ../../../flutter/lib/ui/painting/vertices.cc FILE: ../../../flutter/lib/ui/painting/vertices.h +FILE: ../../../flutter/lib/ui/plugins.dart +FILE: ../../../flutter/lib/ui/plugins/callback_cache.cc +FILE: ../../../flutter/lib/ui/plugins/callback_cache.h +FILE: ../../../flutter/lib/ui/pointer.dart +FILE: ../../../flutter/lib/ui/semantics.dart +FILE: ../../../flutter/lib/ui/semantics/custom_accessibility_action.cc +FILE: ../../../flutter/lib/ui/semantics/custom_accessibility_action.h +FILE: ../../../flutter/lib/ui/semantics/semantics_node.cc +FILE: ../../../flutter/lib/ui/semantics/semantics_node.h +FILE: ../../../flutter/lib/ui/semantics/semantics_update.cc +FILE: ../../../flutter/lib/ui/semantics/semantics_update.h +FILE: ../../../flutter/lib/ui/semantics/semantics_update_builder.cc +FILE: ../../../flutter/lib/ui/semantics/semantics_update_builder.h +FILE: ../../../flutter/lib/ui/snapshot_delegate.h +FILE: ../../../flutter/lib/ui/text.dart +FILE: ../../../flutter/lib/ui/text/asset_manager_font_provider.cc +FILE: ../../../flutter/lib/ui/text/asset_manager_font_provider.h FILE: ../../../flutter/lib/ui/text/font_collection.cc FILE: ../../../flutter/lib/ui/text/font_collection.h -FILE: ../../../flutter/shell/gpu/gpu_surface_software.cc -FILE: ../../../flutter/shell/gpu/gpu_surface_software.h -FILE: ../../../flutter/shell/platform/android/android_external_texture_gl.cc -FILE: ../../../flutter/shell/platform/android/android_external_texture_gl.h -FILE: ../../../flutter/shell/platform/android/android_surface_software.cc -FILE: ../../../flutter/shell/platform/android/android_surface_software.h -FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java -FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterActivityEvents.java -FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterFragmentActivity.java -FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/legacy/FlutterPluginRegistry.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/legacy/PluginRegistry.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/BasicMessageChannel.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/BinaryCodec.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/BinaryMessenger.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/EventChannel.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/FlutterException.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/JSONMessageCodec.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/JSONMethodCodec.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/MessageCodec.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/MethodCall.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/MethodChannel.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/MethodCodec.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/StandardMethodCodec.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/StringCodec.java -FILE: ../../../flutter/shell/platform/android/io/flutter/util/PathUtils.java -FILE: ../../../flutter/shell/platform/android/io/flutter/util/Preconditions.java -FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java -FILE: ../../../flutter/shell/platform/android/io/flutter/view/TextureRegistry.java -FILE: ../../../flutter/shell/platform/android/platform_view_android_jni.cc -FILE: ../../../flutter/shell/platform/android/platform_view_android_jni.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterHeadlessDartRunner.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterNavigationController.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterTexture.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterChannels.mm -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterCodecs.mm -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterHeadlessDartRunner.mm -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterNavigationController.mm -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterUmbrellaImport.m -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/flutter_codecs_unittest.mm -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/flutter_standard_codec_unittest.mm -FILE: ../../../flutter/shell/platform/darwin/ios/ios_external_texture_gl.h -FILE: ../../../flutter/shell/platform/darwin/ios/ios_external_texture_gl.mm -FILE: ../../../flutter/shell/platform/darwin/ios/ios_gl_context.h -FILE: ../../../flutter/shell/platform/darwin/ios/ios_gl_context.mm -FILE: ../../../flutter/shell/platform/darwin/ios/ios_surface.h -FILE: ../../../flutter/shell/platform/darwin/ios/ios_surface.mm -FILE: ../../../flutter/shell/platform/darwin/ios/ios_surface_gl.h -FILE: ../../../flutter/shell/platform/darwin/ios/ios_surface_gl.mm -FILE: ../../../flutter/shell/platform/darwin/ios/ios_surface_software.h -FILE: ../../../flutter/shell/platform/darwin/ios/ios_surface_software.mm -FILE: ../../../flutter/shell/platform/embedder/embedder.cc -FILE: ../../../flutter/shell/platform/embedder/embedder_include.c -FILE: ../../../flutter/shell/platform/embedder/platform_view_embedder.cc -FILE: ../../../flutter/shell/platform/embedder/platform_view_embedder.h -FILE: ../../../flutter/third_party/txt/src/txt/platform.cc -FILE: ../../../flutter/third_party/txt/src/txt/platform.h -FILE: ../../../flutter/third_party/txt/src/txt/platform_android.cc -FILE: ../../../flutter/third_party/txt/src/txt/platform_mac.mm -FILE: ../../../flutter/vulkan/skia_vulkan_header.h -FILE: ../../../flutter/vulkan/vulkan_native_surface_magma.cc -FILE: ../../../flutter/vulkan/vulkan_native_surface_magma.h -FILE: ../../../flutter/vulkan/vulkan_provider.cc -FILE: ../../../flutter/vulkan/vulkan_provider.h ----------------------------------------------------------------------------------------------------- -Copyright 2017 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: engine -ORIGIN: ../../../LICENSE -TYPE: LicenseType.bsd -FILE: ../../../flutter/DEPS -FILE: ../../../flutter/lib/io/dart_io.cc -FILE: ../../../flutter/lib/io/dart_io.h -FILE: ../../../flutter/lib/snapshot/libraries.json -FILE: ../../../flutter/lib/ui/dart_runtime_hooks.cc -FILE: ../../../flutter/lib/ui/dart_runtime_hooks.h -FILE: ../../../flutter/lib/ui/dart_ui.cc -FILE: ../../../flutter/lib/ui/dart_ui.h -FILE: ../../../flutter/lib/ui/natives.dart +FILE: ../../../flutter/lib/ui/text/paragraph.cc +FILE: ../../../flutter/lib/ui/text/paragraph.h +FILE: ../../../flutter/lib/ui/text/paragraph_builder.cc +FILE: ../../../flutter/lib/ui/text/paragraph_builder.h +FILE: ../../../flutter/lib/ui/text/paragraph_impl.cc +FILE: ../../../flutter/lib/ui/text/paragraph_impl.h +FILE: ../../../flutter/lib/ui/text/paragraph_impl_txt.cc +FILE: ../../../flutter/lib/ui/text/paragraph_impl_txt.h +FILE: ../../../flutter/lib/ui/text/text_box.cc +FILE: ../../../flutter/lib/ui/text/text_box.h +FILE: ../../../flutter/lib/ui/ui.dart +FILE: ../../../flutter/lib/ui/ui_dart_state.cc +FILE: ../../../flutter/lib/ui/ui_dart_state.h +FILE: ../../../flutter/lib/ui/window.dart +FILE: ../../../flutter/lib/ui/window/platform_message.cc +FILE: ../../../flutter/lib/ui/window/platform_message.h +FILE: ../../../flutter/lib/ui/window/platform_message_response.cc +FILE: ../../../flutter/lib/ui/window/platform_message_response.h +FILE: ../../../flutter/lib/ui/window/platform_message_response_dart.cc +FILE: ../../../flutter/lib/ui/window/platform_message_response_dart.h +FILE: ../../../flutter/lib/ui/window/pointer_data.cc +FILE: ../../../flutter/lib/ui/window/pointer_data.h +FILE: ../../../flutter/lib/ui/window/pointer_data_packet.cc +FILE: ../../../flutter/lib/ui/window/pointer_data_packet.h +FILE: ../../../flutter/lib/ui/window/viewport_metrics.cc +FILE: ../../../flutter/lib/ui/window/viewport_metrics.h +FILE: ../../../flutter/lib/ui/window/window.cc FILE: ../../../flutter/lib/ui/window/window.h -FILE: ../../../flutter/shell/common/skia_event_tracer_impl.cc -FILE: ../../../flutter/shell/platform/android/apk_asset_provider.cc -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/PlatformMessageHandler.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/renderer/OnFirstFrameRenderedListener.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/JSONUtil.java -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Flutter.podspec -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Info.plist -FILE: ../../../flutter/shell/platform/darwin/ios/framework/module.modulemap -FILE: ../../../flutter/shell/platform/darwin/ios/headless_platform_view_ios.mm -FILE: ../../../flutter/shell/platform/embedder/assets/EmbedderInfo.plist -FILE: ../../../flutter/shell/platform/embedder/assets/embedder.modulemap -FILE: ../../../flutter/shell/platform/embedder/fixtures/simple_main.dart -FILE: ../../../flutter/sky/tools/roll/patches/chromium/android_build.patch ----------------------------------------------------------------------------------------------------- -Copyright 2014 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: engine -ORIGIN: ../../../flutter/assets/asset_manager.cc + ../../../LICENSE -TYPE: LicenseType.bsd -FILE: ../../../flutter/assets/asset_manager.cc -FILE: ../../../flutter/assets/asset_manager.h -FILE: ../../../flutter/assets/asset_resolver.h -FILE: ../../../flutter/common/task_runners.cc -FILE: ../../../flutter/common/task_runners.h -FILE: ../../../flutter/flow/skia_gpu_object.cc -FILE: ../../../flutter/flow/skia_gpu_object.h FILE: ../../../flutter/runtime/dart_isolate.cc FILE: ../../../flutter/runtime/dart_isolate.h FILE: ../../../flutter/runtime/dart_isolate_unittests.cc +FILE: ../../../flutter/runtime/dart_service_isolate.cc +FILE: ../../../flutter/runtime/dart_service_isolate.h +FILE: ../../../flutter/runtime/dart_service_isolate_unittests.cc FILE: ../../../flutter/runtime/dart_snapshot.cc FILE: ../../../flutter/runtime/dart_snapshot.h FILE: ../../../flutter/runtime/dart_snapshot_buffer.cc @@ -267,157 +336,258 @@ FILE: ../../../flutter/runtime/dart_snapshot_buffer.h FILE: ../../../flutter/runtime/dart_vm.cc FILE: ../../../flutter/runtime/dart_vm.h FILE: ../../../flutter/runtime/dart_vm_unittests.cc -FILE: ../../../flutter/runtime/service_protocol.cc -FILE: ../../../flutter/runtime/service_protocol.h -FILE: ../../../flutter/shell/common/io_manager.cc -FILE: ../../../flutter/shell/common/io_manager.h -FILE: ../../../flutter/shell/common/run_configuration.cc -FILE: ../../../flutter/shell/common/run_configuration.h -FILE: ../../../flutter/shell/common/shell_unittests.cc -FILE: ../../../flutter/shell/common/thread_host.cc -FILE: ../../../flutter/shell/common/thread_host.h -FILE: ../../../flutter/shell/platform/darwin/common/command_line.h -FILE: ../../../flutter/shell/platform/darwin/common/command_line.mm -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h -FILE: ../../../flutter/shell/platform/embedder/embedder.h -FILE: ../../../flutter/shell/platform/embedder/embedder_engine.cc -FILE: ../../../flutter/shell/platform/embedder/embedder_engine.h ----------------------------------------------------------------------------------------------------- -Copyright 2017 The Flutter Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: engine -ORIGIN: ../../../flutter/assets/directory_asset_bundle.cc + ../../../LICENSE -TYPE: LicenseType.bsd -FILE: ../../../flutter/assets/directory_asset_bundle.cc -FILE: ../../../flutter/assets/directory_asset_bundle.h -FILE: ../../../flutter/assets/zip_asset_store.cc -FILE: ../../../flutter/assets/zip_asset_store.h -FILE: ../../../flutter/common/settings.cc -FILE: ../../../flutter/common/settings.h -FILE: ../../../flutter/flow/export_node.cc -FILE: ../../../flutter/flow/layers/backdrop_filter_layer.cc -FILE: ../../../flutter/flow/layers/backdrop_filter_layer.h -FILE: ../../../flutter/flow/layers/child_scene_layer.cc -FILE: ../../../flutter/flow/layers/child_scene_layer.h -FILE: ../../../flutter/flow/layers/shader_mask_layer.cc -FILE: ../../../flutter/flow/layers/shader_mask_layer.h -FILE: ../../../flutter/flow/raster_cache.cc -FILE: ../../../flutter/flow/raster_cache.h -FILE: ../../../flutter/flow/scene_update_context.cc -FILE: ../../../flutter/flow/scene_update_context.h -FILE: ../../../flutter/lib/ui/painting/image_filter.cc -FILE: ../../../flutter/lib/ui/painting/image_filter.h -FILE: ../../../flutter/lib/ui/semantics.dart -FILE: ../../../flutter/lib/ui/semantics/semantics_node.cc -FILE: ../../../flutter/lib/ui/semantics/semantics_node.h -FILE: ../../../flutter/lib/ui/semantics/semantics_update.cc -FILE: ../../../flutter/lib/ui/semantics/semantics_update.h -FILE: ../../../flutter/lib/ui/semantics/semantics_update_builder.cc -FILE: ../../../flutter/lib/ui/semantics/semantics_update_builder.h -FILE: ../../../flutter/lib/ui/text/text_box.h -FILE: ../../../flutter/lib/ui/window/platform_message.cc -FILE: ../../../flutter/lib/ui/window/platform_message.h -FILE: ../../../flutter/lib/ui/window/platform_message_response.cc -FILE: ../../../flutter/lib/ui/window/platform_message_response.h -FILE: ../../../flutter/lib/ui/window/platform_message_response_dart.cc -FILE: ../../../flutter/lib/ui/window/platform_message_response_dart.h -FILE: ../../../flutter/lib/ui/window/pointer_data.h -FILE: ../../../flutter/lib/ui/window/pointer_data_packet.h -FILE: ../../../flutter/lib/ui/window/viewport_metrics.h FILE: ../../../flutter/runtime/embedder_resources.cc FILE: ../../../flutter/runtime/embedder_resources.h FILE: ../../../flutter/runtime/fixtures/simple_main.dart +FILE: ../../../flutter/runtime/runtime_controller.cc +FILE: ../../../flutter/runtime/runtime_controller.h +FILE: ../../../flutter/runtime/runtime_delegate.cc +FILE: ../../../flutter/runtime/runtime_delegate.h +FILE: ../../../flutter/runtime/service_protocol.cc +FILE: ../../../flutter/runtime/service_protocol.h FILE: ../../../flutter/runtime/start_up.cc FILE: ../../../flutter/runtime/start_up.h FILE: ../../../flutter/runtime/test_font_data.cc FILE: ../../../flutter/runtime/test_font_data.h +FILE: ../../../flutter/shell/common/animator.cc +FILE: ../../../flutter/shell/common/animator.h +FILE: ../../../flutter/shell/common/engine.cc +FILE: ../../../flutter/shell/common/engine.h +FILE: ../../../flutter/shell/common/io_manager.cc +FILE: ../../../flutter/shell/common/io_manager.h +FILE: ../../../flutter/shell/common/isolate_configuration.cc +FILE: ../../../flutter/shell/common/isolate_configuration.h +FILE: ../../../flutter/shell/common/persistent_cache.cc +FILE: ../../../flutter/shell/common/persistent_cache.h +FILE: ../../../flutter/shell/common/platform_view.cc +FILE: ../../../flutter/shell/common/platform_view.h +FILE: ../../../flutter/shell/common/rasterizer.cc +FILE: ../../../flutter/shell/common/rasterizer.h +FILE: ../../../flutter/shell/common/run_configuration.cc +FILE: ../../../flutter/shell/common/run_configuration.h +FILE: ../../../flutter/shell/common/shell.cc +FILE: ../../../flutter/shell/common/shell.h +FILE: ../../../flutter/shell/common/shell_benchmarks.cc +FILE: ../../../flutter/shell/common/shell_unittests.cc +FILE: ../../../flutter/shell/common/skia_event_tracer_impl.cc FILE: ../../../flutter/shell/common/skia_event_tracer_impl.h FILE: ../../../flutter/shell/common/surface.cc FILE: ../../../flutter/shell/common/surface.h +FILE: ../../../flutter/shell/common/switches.cc +FILE: ../../../flutter/shell/common/switches.h +FILE: ../../../flutter/shell/common/thread_host.cc +FILE: ../../../flutter/shell/common/thread_host.h +FILE: ../../../flutter/shell/common/vsync_waiter.cc +FILE: ../../../flutter/shell/common/vsync_waiter.h FILE: ../../../flutter/shell/common/vsync_waiter_fallback.cc +FILE: ../../../flutter/shell/common/vsync_waiter_fallback.h FILE: ../../../flutter/shell/gpu/gpu_surface_gl.cc FILE: ../../../flutter/shell/gpu/gpu_surface_gl.h +FILE: ../../../flutter/shell/gpu/gpu_surface_software.cc +FILE: ../../../flutter/shell/gpu/gpu_surface_software.h FILE: ../../../flutter/shell/gpu/gpu_surface_vulkan.cc FILE: ../../../flutter/shell/gpu/gpu_surface_vulkan.h FILE: ../../../flutter/shell/platform/android/android_context_gl.cc FILE: ../../../flutter/shell/platform/android/android_context_gl.h FILE: ../../../flutter/shell/platform/android/android_environment_gl.cc FILE: ../../../flutter/shell/platform/android/android_environment_gl.h +FILE: ../../../flutter/shell/platform/android/android_external_texture_gl.cc +FILE: ../../../flutter/shell/platform/android/android_external_texture_gl.h FILE: ../../../flutter/shell/platform/android/android_native_window.cc FILE: ../../../flutter/shell/platform/android/android_native_window.h +FILE: ../../../flutter/shell/platform/android/android_shell_holder.cc +FILE: ../../../flutter/shell/platform/android/android_shell_holder.h FILE: ../../../flutter/shell/platform/android/android_surface.cc FILE: ../../../flutter/shell/platform/android/android_surface.h FILE: ../../../flutter/shell/platform/android/android_surface_gl.cc FILE: ../../../flutter/shell/platform/android/android_surface_gl.h +FILE: ../../../flutter/shell/platform/android/android_surface_software.cc +FILE: ../../../flutter/shell/platform/android/android_surface_software.h FILE: ../../../flutter/shell/platform/android/android_surface_vulkan.cc FILE: ../../../flutter/shell/platform/android/android_surface_vulkan.h -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/legacy/InputConnectionAdaptor.java +FILE: ../../../flutter/shell/platform/android/apk_asset_provider.cc +FILE: ../../../flutter/shell/platform/android/apk_asset_provider.h +FILE: ../../../flutter/shell/platform/android/flutter_main.cc +FILE: ../../../flutter/shell/platform/android/flutter_main.h +FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterActivity.java +FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java +FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterActivityEvents.java +FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterApplication.java +FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterFragmentActivity.java +FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/PlatformMessageHandler.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/renderer/OnFirstFrameRenderedListener.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/legacy/AccessibilityBridge.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/legacy/FlutterPluginRegistry.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/legacy/InputConnectionAdaptor.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/legacy/PluginRegistry.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/legacy/TextInputPlugin.java FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/ActivityLifecycleListener.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/BasicMessageChannel.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/BinaryCodec.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/BinaryMessenger.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/EventChannel.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/FlutterException.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/JSONMessageCodec.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/JSONMethodCodec.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/JSONUtil.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/MessageCodec.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/MethodCall.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/MethodChannel.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/MethodCodec.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/StandardMethodCodec.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/StringCodec.java FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformView.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewFactory.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewRegistry.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewRegistryImpl.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java +FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java +FILE: ../../../flutter/shell/platform/android/io/flutter/util/PathUtils.java +FILE: ../../../flutter/shell/platform/android/io/flutter/util/Preconditions.java +FILE: ../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java +FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterCallbackInformation.java +FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterMain.java +FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java +FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterRunArguments.java +FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java +FILE: ../../../flutter/shell/platform/android/io/flutter/view/ResourceCleaner.java +FILE: ../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java +FILE: ../../../flutter/shell/platform/android/io/flutter/view/ResourcePaths.java +FILE: ../../../flutter/shell/platform/android/io/flutter/view/TextureRegistry.java FILE: ../../../flutter/shell/platform/android/io/flutter/view/VsyncWaiter.java +FILE: ../../../flutter/shell/platform/android/library_loader.cc +FILE: ../../../flutter/shell/platform/android/platform_message_response_android.cc +FILE: ../../../flutter/shell/platform/android/platform_message_response_android.h +FILE: ../../../flutter/shell/platform/android/platform_view_android.cc +FILE: ../../../flutter/shell/platform/android/platform_view_android.h +FILE: ../../../flutter/shell/platform/android/platform_view_android_jni.cc +FILE: ../../../flutter/shell/platform/android/platform_view_android_jni.h FILE: ../../../flutter/shell/platform/android/vsync_waiter_android.cc FILE: ../../../flutter/shell/platform/android/vsync_waiter_android.h +FILE: ../../../flutter/shell/platform/darwin/common/buffer_conversions.h FILE: ../../../flutter/shell/platform/darwin/common/buffer_conversions.mm +FILE: ../../../flutter/shell/platform/darwin/common/command_line.h +FILE: ../../../flutter/shell/platform/darwin/common/command_line.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Flutter.podspec FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/Flutter.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterAppDelegate.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterCallbackCache.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterHeadlessDartRunner.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterPlatformViews.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterTexture.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Info.plist +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate_Internal.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache_Internal.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterChannels.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterCodecs.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterHeadlessDartRunner.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterUmbrellaImport.m FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterView.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterView.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/flutter_codecs_unittest.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/flutter_standard_codec_unittest.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.mm FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/platform_message_router.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/platform_message_router.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h +FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm +FILE: ../../../flutter/shell/platform/darwin/ios/framework/module.modulemap +FILE: ../../../flutter/shell/platform/darwin/ios/ios_external_texture_gl.h +FILE: ../../../flutter/shell/platform/darwin/ios/ios_external_texture_gl.mm +FILE: ../../../flutter/shell/platform/darwin/ios/ios_gl_context.h +FILE: ../../../flutter/shell/platform/darwin/ios/ios_gl_context.mm +FILE: ../../../flutter/shell/platform/darwin/ios/ios_gl_render_target.h +FILE: ../../../flutter/shell/platform/darwin/ios/ios_gl_render_target.mm +FILE: ../../../flutter/shell/platform/darwin/ios/ios_surface.h +FILE: ../../../flutter/shell/platform/darwin/ios/ios_surface.mm +FILE: ../../../flutter/shell/platform/darwin/ios/ios_surface_gl.h +FILE: ../../../flutter/shell/platform/darwin/ios/ios_surface_gl.mm +FILE: ../../../flutter/shell/platform/darwin/ios/ios_surface_software.h +FILE: ../../../flutter/shell/platform/darwin/ios/ios_surface_software.mm FILE: ../../../flutter/shell/platform/darwin/ios/platform_view_ios.h FILE: ../../../flutter/shell/platform/darwin/ios/platform_view_ios.mm +FILE: ../../../flutter/shell/platform/embedder/assets/EmbedderInfo.plist +FILE: ../../../flutter/shell/platform/embedder/assets/embedder.modulemap +FILE: ../../../flutter/shell/platform/embedder/embedder.cc +FILE: ../../../flutter/shell/platform/embedder/embedder.h +FILE: ../../../flutter/shell/platform/embedder/embedder_engine.cc +FILE: ../../../flutter/shell/platform/embedder/embedder_engine.h +FILE: ../../../flutter/shell/platform/embedder/embedder_include.c +FILE: ../../../flutter/shell/platform/embedder/embedder_surface.cc +FILE: ../../../flutter/shell/platform/embedder/embedder_surface.h +FILE: ../../../flutter/shell/platform/embedder/embedder_surface_gl.cc +FILE: ../../../flutter/shell/platform/embedder/embedder_surface_gl.h +FILE: ../../../flutter/shell/platform/embedder/embedder_surface_software.cc +FILE: ../../../flutter/shell/platform/embedder/embedder_surface_software.h +FILE: ../../../flutter/shell/platform/embedder/fixtures/simple_main.dart +FILE: ../../../flutter/shell/platform/embedder/platform_view_embedder.cc +FILE: ../../../flutter/shell/platform/embedder/platform_view_embedder.h +FILE: ../../../flutter/shell/version/version.cc +FILE: ../../../flutter/shell/version/version.h FILE: ../../../flutter/sky/packages/flutter_services/lib/empty.dart +FILE: ../../../flutter/sky/tools/roll/patches/chromium/android_build.patch FILE: ../../../flutter/synchronization/pipeline.cc FILE: ../../../flutter/synchronization/pipeline.h FILE: ../../../flutter/synchronization/semaphore.cc FILE: ../../../flutter/synchronization/semaphore.h FILE: ../../../flutter/synchronization/semaphore_unittest.cc +FILE: ../../../flutter/third_party/txt/src/txt/platform.cc +FILE: ../../../flutter/third_party/txt/src/txt/platform.h +FILE: ../../../flutter/third_party/txt/src/txt/platform_android.cc +FILE: ../../../flutter/third_party/txt/src/txt/platform_mac.mm +FILE: ../../../flutter/vulkan/skia_vulkan_header.h FILE: ../../../flutter/vulkan/vulkan_application.cc FILE: ../../../flutter/vulkan/vulkan_application.h FILE: ../../../flutter/vulkan/vulkan_backbuffer.cc @@ -438,8 +608,12 @@ FILE: ../../../flutter/vulkan/vulkan_native_surface.cc FILE: ../../../flutter/vulkan/vulkan_native_surface.h FILE: ../../../flutter/vulkan/vulkan_native_surface_android.cc FILE: ../../../flutter/vulkan/vulkan_native_surface_android.h +FILE: ../../../flutter/vulkan/vulkan_native_surface_magma.cc +FILE: ../../../flutter/vulkan/vulkan_native_surface_magma.h FILE: ../../../flutter/vulkan/vulkan_proc_table.cc FILE: ../../../flutter/vulkan/vulkan_proc_table.h +FILE: ../../../flutter/vulkan/vulkan_provider.cc +FILE: ../../../flutter/vulkan/vulkan_provider.h FILE: ../../../flutter/vulkan/vulkan_surface.cc FILE: ../../../flutter/vulkan/vulkan_surface.h FILE: ../../../flutter/vulkan/vulkan_swapchain.cc @@ -449,492 +623,7 @@ FILE: ../../../flutter/vulkan/vulkan_utilities.h FILE: ../../../flutter/vulkan/vulkan_window.cc FILE: ../../../flutter/vulkan/vulkan_window.h ---------------------------------------------------------------------------------------------------- -Copyright 2016 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: engine -ORIGIN: ../../../flutter/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart + ../../../LICENSE -TYPE: LicenseType.bsd -FILE: ../../../flutter/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart -FILE: ../../../flutter/fml/paths_unittests.cc -FILE: ../../../flutter/lib/ui/isolate_name_server.dart -FILE: ../../../flutter/lib/ui/painting/image_encoding.cc -FILE: ../../../flutter/lib/ui/painting/image_encoding.h -FILE: ../../../flutter/lib/ui/plugins.dart -FILE: ../../../flutter/lib/ui/semantics/custom_accessibility_action.cc -FILE: ../../../flutter/lib/ui/semantics/custom_accessibility_action.h -FILE: ../../../flutter/lib/ui/text/asset_manager_font_provider.cc -FILE: ../../../flutter/lib/ui/text/asset_manager_font_provider.h -FILE: ../../../flutter/shell/platform/android/apk_asset_provider.h -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformView.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewFactory.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewRegistry.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewRegistryImpl.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java -FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java -FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterCallbackInformation.java -FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterRunArguments.java -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterCallbackCache.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache.mm -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache_Internal.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.mm -FILE: ../../../flutter/shell/platform/darwin/ios/headless_platform_view_ios.h ----------------------------------------------------------------------------------------------------- -Copyright 2018 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: engine -ORIGIN: ../../../flutter/fml/platform/android/paths_android.h + ../../../LICENSE -TYPE: LicenseType.bsd -FILE: ../../../flutter/fml/base32.cc -FILE: ../../../flutter/fml/base32.h -FILE: ../../../flutter/fml/base32_unittest.cc -FILE: ../../../flutter/fml/file.cc -FILE: ../../../flutter/fml/file.h -FILE: ../../../flutter/fml/file_unittest.cc -FILE: ../../../flutter/fml/macros.h -FILE: ../../../flutter/fml/mapping.cc -FILE: ../../../flutter/fml/message.cc -FILE: ../../../flutter/fml/message.h -FILE: ../../../flutter/fml/message_unittests.cc -FILE: ../../../flutter/fml/native_library.h -FILE: ../../../flutter/fml/paths.cc -FILE: ../../../flutter/fml/platform/android/paths_android.h -FILE: ../../../flutter/fml/platform/fuchsia/paths_fuchsia.cc -FILE: ../../../flutter/fml/platform/posix/file_posix.cc -FILE: ../../../flutter/fml/platform/posix/native_library_posix.cc -FILE: ../../../flutter/fml/platform/posix/paths_posix.cc -FILE: ../../../flutter/fml/platform/win/errors_win.cc -FILE: ../../../flutter/fml/platform/win/errors_win.h -FILE: ../../../flutter/fml/platform/win/file_win.cc -FILE: ../../../flutter/fml/platform/win/native_library_win.cc -FILE: ../../../flutter/fml/platform/win/wstring_conversion.h -FILE: ../../../flutter/fml/unique_fd.cc -FILE: ../../../flutter/fml/unique_fd.h -FILE: ../../../flutter/fml/unique_object.h -FILE: ../../../flutter/lib/ui/isolate_name_server/isolate_name_server.cc -FILE: ../../../flutter/lib/ui/isolate_name_server/isolate_name_server.h -FILE: ../../../flutter/lib/ui/isolate_name_server/isolate_name_server_natives.cc -FILE: ../../../flutter/lib/ui/isolate_name_server/isolate_name_server_natives.h -FILE: ../../../flutter/lib/ui/plugins/callback_cache.cc -FILE: ../../../flutter/lib/ui/plugins/callback_cache.h -FILE: ../../../flutter/shell/common/isolate_configuration.cc -FILE: ../../../flutter/shell/common/isolate_configuration.h -FILE: ../../../flutter/shell/common/persistent_cache.cc -FILE: ../../../flutter/shell/common/persistent_cache.h -FILE: ../../../flutter/shell/platform/android/android_shell_holder.cc -FILE: ../../../flutter/shell/platform/android/android_shell_holder.h -FILE: ../../../flutter/shell/platform/android/platform_message_response_android.cc -FILE: ../../../flutter/shell/platform/android/platform_message_response_android.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate_Internal.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.mm -FILE: ../../../flutter/shell/platform/embedder/embedder_surface.cc -FILE: ../../../flutter/shell/platform/embedder/embedder_surface.h -FILE: ../../../flutter/shell/platform/embedder/embedder_surface_gl.cc -FILE: ../../../flutter/shell/platform/embedder/embedder_surface_gl.h -FILE: ../../../flutter/shell/platform/embedder/embedder_surface_software.cc -FILE: ../../../flutter/shell/platform/embedder/embedder_surface_software.h -FILE: ../../../flutter/shell/version/version.cc -FILE: ../../../flutter/shell/version/version.h ----------------------------------------------------------------------------------------------------- -Copyright 2018 The Flutter Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: engine -ORIGIN: ../../../flutter/fml/platform/darwin/scoped_block.h + ../../../LICENSE -TYPE: LicenseType.bsd -FILE: ../../../flutter/fml/platform/darwin/scoped_block.h ----------------------------------------------------------------------------------------------------- -Copyright (c) 2013 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: engine -ORIGIN: ../../../flutter/fml/time/time_delta_unittest.cc + ../../../third_party/tonic/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../flutter/fml/export.h -FILE: ../../../flutter/fml/time/time_delta_unittest.cc -FILE: ../../../flutter/fml/time/time_point_unittest.cc ----------------------------------------------------------------------------------------------------- -Copyright 2017 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: engine -ORIGIN: ../../../flutter/lib/ui/painting/image.cc + ../../../LICENSE -TYPE: LicenseType.bsd -FILE: ../../../flutter/lib/ui/painting/image.cc -FILE: ../../../flutter/lib/ui/painting/image.h -FILE: ../../../flutter/shell/common/switches.cc -FILE: ../../../flutter/shell/common/switches.h -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/legacy/AccessibilityBridge.java -FILE: ../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java -FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterMain.java -FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java ----------------------------------------------------------------------------------------------------- -Copyright 2013 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: engine -ORIGIN: ../../../third_party/icu/scripts/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../flutter/flow/compositor_context.cc -FILE: ../../../flutter/flow/compositor_context.h -FILE: ../../../flutter/flow/instrumentation.cc -FILE: ../../../flutter/flow/instrumentation.h -FILE: ../../../flutter/flow/layers/clip_path_layer.cc -FILE: ../../../flutter/flow/layers/clip_path_layer.h -FILE: ../../../flutter/flow/layers/clip_rect_layer.cc -FILE: ../../../flutter/flow/layers/clip_rect_layer.h -FILE: ../../../flutter/flow/layers/clip_rrect_layer.cc -FILE: ../../../flutter/flow/layers/clip_rrect_layer.h -FILE: ../../../flutter/flow/layers/color_filter_layer.cc -FILE: ../../../flutter/flow/layers/color_filter_layer.h -FILE: ../../../flutter/flow/layers/container_layer.cc -FILE: ../../../flutter/flow/layers/container_layer.h -FILE: ../../../flutter/flow/layers/layer.cc -FILE: ../../../flutter/flow/layers/layer.h -FILE: ../../../flutter/flow/layers/layer_tree.cc -FILE: ../../../flutter/flow/layers/layer_tree.h -FILE: ../../../flutter/flow/layers/opacity_layer.cc -FILE: ../../../flutter/flow/layers/opacity_layer.h -FILE: ../../../flutter/flow/layers/performance_overlay_layer.cc -FILE: ../../../flutter/flow/layers/performance_overlay_layer.h -FILE: ../../../flutter/flow/layers/picture_layer.cc -FILE: ../../../flutter/flow/layers/picture_layer.h -FILE: ../../../flutter/flow/layers/transform_layer.cc -FILE: ../../../flutter/flow/layers/transform_layer.h -FILE: ../../../flutter/lib/snapshot/snapshot.dart -FILE: ../../../flutter/lib/snapshot/snapshot.h -FILE: ../../../flutter/lib/snapshot/snapshot_fuchsia.dart -FILE: ../../../flutter/lib/ui/compositing.dart -FILE: ../../../flutter/lib/ui/compositing/scene.cc -FILE: ../../../flutter/lib/ui/compositing/scene.h -FILE: ../../../flutter/lib/ui/compositing/scene_builder.cc -FILE: ../../../flutter/lib/ui/compositing/scene_builder.h -FILE: ../../../flutter/lib/ui/dart_wrapper.h -FILE: ../../../flutter/lib/ui/geometry.dart -FILE: ../../../flutter/lib/ui/hash_codes.dart -FILE: ../../../flutter/lib/ui/hooks.dart -FILE: ../../../flutter/lib/ui/lerp.dart -FILE: ../../../flutter/lib/ui/painting.dart -FILE: ../../../flutter/lib/ui/painting/canvas.cc -FILE: ../../../flutter/lib/ui/painting/canvas.h -FILE: ../../../flutter/lib/ui/painting/gradient.cc -FILE: ../../../flutter/lib/ui/painting/gradient.h -FILE: ../../../flutter/lib/ui/painting/image_shader.cc -FILE: ../../../flutter/lib/ui/painting/image_shader.h -FILE: ../../../flutter/lib/ui/painting/matrix.cc -FILE: ../../../flutter/lib/ui/painting/matrix.h -FILE: ../../../flutter/lib/ui/painting/paint.cc -FILE: ../../../flutter/lib/ui/painting/paint.h -FILE: ../../../flutter/lib/ui/painting/path.cc -FILE: ../../../flutter/lib/ui/painting/path.h -FILE: ../../../flutter/lib/ui/painting/path_measure.cc -FILE: ../../../flutter/lib/ui/painting/path_measure.h -FILE: ../../../flutter/lib/ui/painting/picture.cc -FILE: ../../../flutter/lib/ui/painting/picture.h -FILE: ../../../flutter/lib/ui/painting/picture_recorder.cc -FILE: ../../../flutter/lib/ui/painting/picture_recorder.h -FILE: ../../../flutter/lib/ui/painting/rrect.cc -FILE: ../../../flutter/lib/ui/painting/rrect.h -FILE: ../../../flutter/lib/ui/painting/shader.cc -FILE: ../../../flutter/lib/ui/painting/shader.h -FILE: ../../../flutter/lib/ui/pointer.dart -FILE: ../../../flutter/lib/ui/text.dart -FILE: ../../../flutter/lib/ui/text/paragraph.cc -FILE: ../../../flutter/lib/ui/text/paragraph.h -FILE: ../../../flutter/lib/ui/text/paragraph_builder.cc -FILE: ../../../flutter/lib/ui/text/paragraph_builder.h -FILE: ../../../flutter/lib/ui/text/paragraph_impl.cc -FILE: ../../../flutter/lib/ui/text/paragraph_impl.h -FILE: ../../../flutter/lib/ui/text/paragraph_impl_txt.cc -FILE: ../../../flutter/lib/ui/text/paragraph_impl_txt.h -FILE: ../../../flutter/lib/ui/text/text_box.cc -FILE: ../../../flutter/lib/ui/ui.dart -FILE: ../../../flutter/lib/ui/ui_dart_state.cc -FILE: ../../../flutter/lib/ui/ui_dart_state.h -FILE: ../../../flutter/lib/ui/window.dart -FILE: ../../../flutter/lib/ui/window/pointer_data.cc -FILE: ../../../flutter/lib/ui/window/pointer_data_packet.cc -FILE: ../../../flutter/lib/ui/window/window.cc -FILE: ../../../flutter/runtime/dart_service_isolate.cc -FILE: ../../../flutter/runtime/dart_service_isolate.h -FILE: ../../../flutter/runtime/runtime_controller.cc -FILE: ../../../flutter/runtime/runtime_controller.h -FILE: ../../../flutter/runtime/runtime_delegate.cc -FILE: ../../../flutter/runtime/runtime_delegate.h -FILE: ../../../flutter/shell/common/animator.cc -FILE: ../../../flutter/shell/common/animator.h -FILE: ../../../flutter/shell/common/engine.cc -FILE: ../../../flutter/shell/common/engine.h -FILE: ../../../flutter/shell/common/platform_view.cc -FILE: ../../../flutter/shell/common/platform_view.h -FILE: ../../../flutter/shell/common/rasterizer.cc -FILE: ../../../flutter/shell/common/rasterizer.h -FILE: ../../../flutter/shell/common/shell.cc -FILE: ../../../flutter/shell/common/shell.h -FILE: ../../../flutter/shell/common/vsync_waiter.cc -FILE: ../../../flutter/shell/common/vsync_waiter.h -FILE: ../../../flutter/shell/common/vsync_waiter_fallback.h -FILE: ../../../flutter/shell/platform/android/flutter_main.cc -FILE: ../../../flutter/shell/platform/android/flutter_main.h -FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterActivity.java -FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterApplication.java -FILE: ../../../flutter/shell/platform/android/io/flutter/view/ResourceCleaner.java -FILE: ../../../flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java -FILE: ../../../flutter/shell/platform/android/io/flutter/view/ResourcePaths.java -FILE: ../../../flutter/shell/platform/android/library_loader.cc -FILE: ../../../flutter/shell/platform/android/platform_view_android.cc -FILE: ../../../flutter/shell/platform/android/platform_view_android.h -FILE: ../../../flutter/shell/platform/darwin/common/buffer_conversions.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h -FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm ----------------------------------------------------------------------------------------------------- -Copyright 2015 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: engine -ORIGIN: ../../../third_party/tonic/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../flutter/fml/arraysize.h -FILE: ../../../flutter/fml/build_config.h -FILE: ../../../flutter/fml/closure.h -FILE: ../../../flutter/fml/command_line.cc -FILE: ../../../flutter/fml/command_line.h -FILE: ../../../flutter/fml/command_line_unittest.cc -FILE: ../../../flutter/fml/compiler_specific.h -FILE: ../../../flutter/fml/eintr_wrapper.h -FILE: ../../../flutter/fml/log_level.h -FILE: ../../../flutter/fml/log_settings.cc -FILE: ../../../flutter/fml/log_settings.h -FILE: ../../../flutter/fml/log_settings_state.cc -FILE: ../../../flutter/fml/logging.cc -FILE: ../../../flutter/fml/logging.h -FILE: ../../../flutter/fml/make_copyable.h -FILE: ../../../flutter/fml/memory/ref_counted.h -FILE: ../../../flutter/fml/memory/ref_counted_internal.h -FILE: ../../../flutter/fml/memory/ref_counted_unittest.cc -FILE: ../../../flutter/fml/memory/ref_ptr.h -FILE: ../../../flutter/fml/memory/ref_ptr_internal.h -FILE: ../../../flutter/fml/memory/thread_checker.h -FILE: ../../../flutter/fml/memory/weak_ptr.h -FILE: ../../../flutter/fml/memory/weak_ptr_internal.cc -FILE: ../../../flutter/fml/memory/weak_ptr_internal.h -FILE: ../../../flutter/fml/memory/weak_ptr_unittest.cc -FILE: ../../../flutter/fml/string_view.cc -FILE: ../../../flutter/fml/string_view.h -FILE: ../../../flutter/fml/string_view_unittest.cc -FILE: ../../../flutter/fml/synchronization/thread_annotations.h -FILE: ../../../flutter/fml/synchronization/thread_annotations_unittest.cc -FILE: ../../../flutter/fml/synchronization/thread_checker.h -FILE: ../../../flutter/fml/synchronization/thread_checker_unittest.cc -FILE: ../../../flutter/fml/synchronization/waitable_event.cc -FILE: ../../../flutter/fml/synchronization/waitable_event.h -FILE: ../../../flutter/fml/synchronization/waitable_event_unittest.cc -FILE: ../../../flutter/fml/time/time_delta.h -FILE: ../../../flutter/fml/time/time_point.cc -FILE: ../../../flutter/fml/time/time_point.h -FILE: ../../../flutter/fml/time/time_unittest.cc ----------------------------------------------------------------------------------------------------- -Copyright 2016 The Fuchsia Authors. All rights reserved. +Copyright 2013 The Flutter Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1012,6 +701,7 @@ FILE: ../../../flutter/third_party/txt/src/minikin/WordBreaker.cpp FILE: ../../../flutter/third_party/txt/src/minikin/WordBreaker.h FILE: ../../../flutter/third_party/txt/src/txt/asset_font_manager.cc FILE: ../../../flutter/third_party/txt/src/txt/asset_font_manager.h +FILE: ../../../flutter/third_party/txt/src/txt/font_asset_provider.cc FILE: ../../../flutter/third_party/txt/src/txt/font_asset_provider.h FILE: ../../../flutter/third_party/txt/src/txt/font_collection.cc FILE: ../../../flutter/third_party/txt/src/txt/font_collection.h @@ -1034,6 +724,8 @@ FILE: ../../../flutter/third_party/txt/src/txt/test_font_manager.h FILE: ../../../flutter/third_party/txt/src/txt/text_baseline.h FILE: ../../../flutter/third_party/txt/src/txt/text_decoration.cc FILE: ../../../flutter/third_party/txt/src/txt/text_decoration.h +FILE: ../../../flutter/third_party/txt/src/txt/text_shadow.cc +FILE: ../../../flutter/third_party/txt/src/txt/text_shadow.h FILE: ../../../flutter/third_party/txt/src/txt/text_style.cc FILE: ../../../flutter/third_party/txt/src/txt/text_style.h FILE: ../../../flutter/third_party/txt/src/txt/typeface_font_asset_provider.cc @@ -1246,4 +938,4 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==================================================================================================== -Total license count: 12 +Total license count: 2 diff --git a/ci/licenses_golden/licenses_garnet b/ci/licenses_golden/licenses_garnet deleted file mode 100644 index 1792f6921fe63..0000000000000 --- a/ci/licenses_golden/licenses_garnet +++ /dev/null @@ -1,960 +0,0 @@ -Signature: e493a563f62df99aea315a223aa83d38 - -UNUSED LICENSES: - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -USED LICENSES: - -==================================================================================================== -LIBRARY: garnet -ORIGIN: ../../../LICENSE -TYPE: LicenseType.bsd -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/macros.h ----------------------------------------------------------------------------------------------------- -Copyright 2014 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: garnet -ORIGIN: ../../../garnet/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../garnet/.cargo/config -FILE: ../../../garnet/.dir-locals.el -FILE: ../../../garnet/Cargo.lock -FILE: ../../../garnet/Cargo.toml -FILE: ../../../garnet/manifest/garnet -FILE: ../../../garnet/manifest/minimal -FILE: ../../../garnet/manifest/third_party -FILE: ../../../garnet/public/lib/amber/fidl/amber.fidl -FILE: ../../../garnet/public/lib/auth/fidl/auth_provider.fidl -FILE: ../../../garnet/public/lib/auth/fidl/auth_provider_factory.fidl -FILE: ../../../garnet/public/lib/auth/fidl/token_manager.fidl -FILE: ../../../garnet/public/lib/bluetooth/fidl/common.fidl -FILE: ../../../garnet/public/lib/bluetooth/fidl/control.fidl -FILE: ../../../garnet/public/lib/bluetooth/fidl/gatt.fidl -FILE: ../../../garnet/public/lib/bluetooth/fidl/low_energy.fidl -FILE: ../../../garnet/public/lib/cobalt/fidl/cobalt.fidl -FILE: ../../../garnet/public/lib/cobalt/fidl/cobalt_controller.fidl -FILE: ../../../garnet/public/lib/device_settings/fidl/device_settings.fidl -FILE: ../../../garnet/public/lib/fidl/go/src/fidl/bindings2/test_types.fidl2 -FILE: ../../../garnet/public/lib/fidl/go/src/fidl/compiler/generated/fidl_files/fidl_files.core.go -FILE: ../../../garnet/public/lib/fidl/go/src/fidl/compiler/generated/fidl_types/fidl_types.core.go -FILE: ../../../garnet/public/lib/fidl/rust/fidl/Cargo.toml -FILE: ../../../garnet/public/lib/fidl/rust/fidl/src/endpoints.rs -FILE: ../../../garnet/public/lib/fidl/tools/sublime/FIDL.sublime-syntax -FILE: ../../../garnet/public/lib/fidl/tools/vim/ftdetect/fidl.vim -FILE: ../../../garnet/public/lib/fidl/tools/vim/syntax/fidl.vim -FILE: ../../../garnet/public/lib/fsl/fidl/sized_vmo_transport.fidl -FILE: ../../../garnet/public/lib/fsl/io/fd.cc -FILE: ../../../garnet/public/lib/fsl/io/fd.h -FILE: ../../../garnet/public/lib/fsl/socket/blocking_drain_unittest.cc -FILE: ../../../garnet/public/lib/fsl/socket/strings_unittest.cc -FILE: ../../../garnet/public/lib/fsl/tasks/fd_waiter.cc -FILE: ../../../garnet/public/lib/fsl/tasks/fd_waiter.h -FILE: ../../../garnet/public/lib/fsl/tasks/fd_waiter_unittest.cc -FILE: ../../../garnet/public/lib/fsl/threading/thread.cc -FILE: ../../../garnet/public/lib/fsl/threading/thread.h -FILE: ../../../garnet/public/lib/fsl/threading/thread_unittest.cc -FILE: ../../../garnet/public/lib/fsl/vmo/file_unittest.cc -FILE: ../../../garnet/public/lib/fsl/vmo/sized_vmo.cc -FILE: ../../../garnet/public/lib/fsl/vmo/sized_vmo.h -FILE: ../../../garnet/public/lib/fxl/files/directory_unittest.cc -FILE: ../../../garnet/public/lib/fxl/files/file_descriptor_unittest.cc -FILE: ../../../garnet/public/lib/fxl/files/path_win.cc -FILE: ../../../garnet/public/lib/fxl/files/symlink_win.cc -FILE: ../../../garnet/public/lib/fxl/functional/apply.h -FILE: ../../../garnet/public/lib/fxl/functional/apply_unittest.cc -FILE: ../../../garnet/public/lib/fxl/functional/auto_call_unittest.cc -FILE: ../../../garnet/public/lib/fxl/functional/cancelable_callback.h -FILE: ../../../garnet/public/lib/fxl/functional/cancelable_callback_unittest.cc -FILE: ../../../garnet/public/lib/fxl/fxl_export.h -FILE: ../../../garnet/public/lib/fxl/inttypes.h -FILE: ../../../garnet/public/lib/fxl/log_settings_command_line.cc -FILE: ../../../garnet/public/lib/fxl/log_settings_command_line.h -FILE: ../../../garnet/public/lib/fxl/portable_unistd.h -FILE: ../../../garnet/public/lib/fxl/random/rand_unittest.cc -FILE: ../../../garnet/public/lib/fxl/random/uuid_unittest.cc -FILE: ../../../garnet/public/lib/fxl/strings/join_strings.h -FILE: ../../../garnet/public/lib/fxl/strings/join_strings_unittest.cc -FILE: ../../../garnet/public/lib/fxl/threading/thread.cc -FILE: ../../../garnet/public/lib/fxl/threading/thread.h -FILE: ../../../garnet/public/lib/fxl/threading/thread_unittest.cc -FILE: ../../../garnet/public/lib/fxl/time/stopwatch_unittest.cc -FILE: ../../../garnet/public/lib/fxl/time/time_delta_unittest.cc -FILE: ../../../garnet/public/lib/fxl/time/time_point_unittest.cc -FILE: ../../../garnet/public/lib/images/fidl/image_info.fidl -FILE: ../../../garnet/public/lib/images/fidl/image_pipe.fidl -FILE: ../../../garnet/public/lib/images/fidl/memory_type.fidl -FILE: ../../../garnet/public/lib/mdns/fidl/mdns.fidl -FILE: ../../../garnet/public/lib/media/audio/lpcm_output_stream.cc -FILE: ../../../garnet/public/lib/media/audio/lpcm_output_stream.h -FILE: ../../../garnet/public/lib/media/audio/perceived_level.h -FILE: ../../../garnet/public/lib/media/audio/types.cc -FILE: ../../../garnet/public/lib/media/audio/types.h -FILE: ../../../garnet/public/lib/media/c/audio.h -FILE: ../../../garnet/public/lib/media/fidl/audio_capturer.fidl -FILE: ../../../garnet/public/lib/media/fidl/audio_policy_service.fidl -FILE: ../../../garnet/public/lib/media/fidl/net_media_player.fidl -FILE: ../../../garnet/public/lib/media/fidl/net_media_service.fidl -FILE: ../../../garnet/public/lib/netconnector/cpp/net_stub_responder.h -FILE: ../../../garnet/public/lib/netstack/c/netconfig.h -FILE: ../../../garnet/public/lib/power/fidl/power_manager.fidl -FILE: ../../../garnet/public/lib/svc/cpp/service_namespace.h -FILE: ../../../garnet/public/lib/svc/cpp/service_provider_bridge.cc -FILE: ../../../garnet/public/lib/svc/cpp/service_provider_bridge.h -FILE: ../../../garnet/public/lib/svc/cpp/services.cc -FILE: ../../../garnet/public/lib/svc/cpp/services.h -FILE: ../../../garnet/public/lib/svc/go/src/svc/svcfs/svcfs.go -FILE: ../../../garnet/public/lib/svc/go/src/svc/svcns/svcns.go -FILE: ../../../garnet/public/lib/test_runner/cpp/gtest_main.cc -FILE: ../../../garnet/public/lib/test_runner/cpp/reporting/gtest_listener.cc -FILE: ../../../garnet/public/lib/test_runner/cpp/reporting/gtest_listener.h -FILE: ../../../garnet/public/lib/test_runner/cpp/reporting/reporter.cc -FILE: ../../../garnet/public/lib/test_runner/cpp/reporting/reporter.h -FILE: ../../../garnet/public/lib/test_runner/cpp/test_runner.h -FILE: ../../../garnet/public/lib/test_runner/cpp/test_runner_store_impl.cc -FILE: ../../../garnet/public/lib/test_runner/cpp/test_runner_store_impl.h -FILE: ../../../garnet/public/lib/time_service/fidl/time_service.fidl -FILE: ../../../garnet/public/lib/ui/fun/sketchy/fidl/canvas.fidl -FILE: ../../../garnet/public/lib/ui/fun/sketchy/fidl/ops.fidl -FILE: ../../../garnet/public/lib/ui/fun/sketchy/fidl/resources.fidl -FILE: ../../../garnet/public/lib/ui/fun/sketchy/fidl/types.fidl -FILE: ../../../garnet/public/lib/ui/input/device_state.cc -FILE: ../../../garnet/public/lib/ui/input/device_state.h -FILE: ../../../garnet/public/lib/ui/input/fidl/ime_service.fidl -FILE: ../../../garnet/public/lib/ui/input/fidl/input_device_registry.fidl -FILE: ../../../garnet/public/lib/ui/input/fidl/input_reports.fidl -FILE: ../../../garnet/public/lib/ui/input/fidl/text_editing.fidl -FILE: ../../../garnet/public/lib/ui/input/fidl/text_input.fidl -FILE: ../../../garnet/public/lib/ui/input/fidl/usages.fidl -FILE: ../../../garnet/public/lib/ui/input/input_device_impl.cc -FILE: ../../../garnet/public/lib/ui/input/input_device_impl.h -FILE: ../../../garnet/public/lib/ui/mozart/fidl/presentation_info.fidl -FILE: ../../../garnet/public/lib/ui/presentation/fidl/presentation.fidl -FILE: ../../../garnet/public/lib/ui/scenic/client/host_image_cycler.cc -FILE: ../../../garnet/public/lib/ui/scenic/client/host_image_cycler.h -FILE: ../../../garnet/public/lib/ui/scenic/client/host_memory.cc -FILE: ../../../garnet/public/lib/ui/scenic/client/host_memory.h -FILE: ../../../garnet/public/lib/ui/scenic/client/resources.cc -FILE: ../../../garnet/public/lib/ui/scenic/client/resources.h -FILE: ../../../garnet/public/lib/ui/scenic/client/session.cc -FILE: ../../../garnet/public/lib/ui/scenic/client/session.h -FILE: ../../../garnet/public/lib/ui/scenic/fidl/display_info.fidl -FILE: ../../../garnet/public/lib/ui/scenic/fidl/events.fidl -FILE: ../../../garnet/public/lib/ui/scenic/fidl/hit.fidl -FILE: ../../../garnet/public/lib/ui/scenic/fidl/nodes.fidl -FILE: ../../../garnet/public/lib/ui/scenic/fidl/ops.fidl -FILE: ../../../garnet/public/lib/ui/scenic/fidl/renderer.fidl -FILE: ../../../garnet/public/lib/ui/scenic/fidl/resources.fidl -FILE: ../../../garnet/public/lib/ui/scenic/fidl/shapes.fidl -FILE: ../../../garnet/public/lib/ui/scenic/fidl/types.fidl -FILE: ../../../garnet/public/lib/ui/scenic/fidl_helpers.cc -FILE: ../../../garnet/public/lib/ui/scenic/fidl_helpers.h -FILE: ../../../garnet/public/lib/ui/scenic/types.h -FILE: ../../../garnet/public/lib/ui/sketchy/canvas.cc -FILE: ../../../garnet/public/lib/ui/sketchy/canvas.h -FILE: ../../../garnet/public/lib/ui/sketchy/glm_hack.h -FILE: ../../../garnet/public/lib/ui/sketchy/resources.cc -FILE: ../../../garnet/public/lib/ui/sketchy/resources.h -FILE: ../../../garnet/public/lib/ui/sketchy/types.cc -FILE: ../../../garnet/public/lib/ui/sketchy/types.h -FILE: ../../../garnet/public/lib/wlan/fidl/wlan_mlme.fidl -FILE: ../../../garnet/public/lib/wlan/fidl/wlan_mlme_ext.fidl -FILE: ../../../garnet/public/lib/wlan/fidl/wlan_service.fidl -FILE: ../../../garnet/tools/vboot_reference/futility_cmds.c -FILE: ../../../garnet/tools/vboot_reference/uuid/uuid.cc -FILE: ../../../garnet/tools/vboot_reference/uuid/uuid.h ----------------------------------------------------------------------------------------------------- -Copyright 2017 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: garnet -ORIGIN: ../../../garnet/public/lib/fidl/cpp/bindings/internal/array_internal.cc + ../../../garnet/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/array.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/array_internal.cc -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/array_internal.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/bindings_internal.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/bindings_serialization.cc -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/bindings_serialization.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/buffer.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/connector.cc -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/connector.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/message.cc -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/message_builder.cc -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/message_builder.h ----------------------------------------------------------------------------------------------------- -Copyright 2013 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: garnet -ORIGIN: ../../../garnet/public/lib/fidl/cpp/bindings/internal/array_serialization.h + ../../../garnet/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/binding.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/binding_set.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/interface_ptr.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/interface_ptr_set.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/interface_request.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/array_serialization.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/bounds_checker.cc -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/bounds_checker.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/fixed_buffer.cc -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/fixed_buffer.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/interface_ptr_internal.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/map_data_internal.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/map_internal.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/map_serialization.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/message_header_validator.cc -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/message_header_validator.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/message_internal.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/router.cc -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/router.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/shared_data.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/string_serialization.cc -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/string_serialization.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/template_util.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/validate_params.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/validation_errors.cc -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/validation_errors.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/map.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/message.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/string.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/struct_ptr.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/type_converter.h -FILE: ../../../garnet/public/lib/ui/input/fidl/input_event_constants.fidl -FILE: ../../../garnet/public/lib/ui/input/fidl/input_events.fidl ----------------------------------------------------------------------------------------------------- -Copyright 2014 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: garnet -ORIGIN: ../../../garnet/public/lib/fidl/cpp/bindings/internal/iterator_util.h + ../../../garnet/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/interface_handle.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/iterator_util.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/map_serialization_forward.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/message_validation.cc -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/message_validation.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/union_accessor.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/validation_util.cc -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/validation_util.h -FILE: ../../../garnet/public/lib/icu_data/cpp/constants.h -FILE: ../../../garnet/public/lib/icu_data/cpp/icu_data.cc -FILE: ../../../garnet/public/lib/icu_data/cpp/icu_data.h -FILE: ../../../garnet/public/lib/ui/input/fidl/input_connection.fidl -FILE: ../../../garnet/public/lib/ui/input/fidl/input_dispatcher.fidl -FILE: ../../../garnet/public/lib/ui/view_framework/base_view.cc -FILE: ../../../garnet/public/lib/ui/view_framework/base_view.h -FILE: ../../../garnet/public/lib/ui/view_framework/view_provider_service.cc -FILE: ../../../garnet/public/lib/ui/view_framework/view_provider_service.h -FILE: ../../../garnet/public/lib/ui/views/cpp/formatting.cc -FILE: ../../../garnet/public/lib/ui/views/cpp/formatting.h -FILE: ../../../garnet/public/lib/ui/views/fidl/view_manager.fidl -FILE: ../../../garnet/public/lib/ui/views/fidl/view_provider.fidl -FILE: ../../../garnet/public/lib/ui/views/fidl/view_trees.fidl -FILE: ../../../garnet/public/lib/ui/views/fidl/views.fidl ----------------------------------------------------------------------------------------------------- -Copyright 2015 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: garnet -ORIGIN: ../../../garnet/public/lib/fidl/cpp/bindings/internal/type_converters.cc + ../../../garnet/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../garnet/public/lib/fidl/cpp/binding.h -FILE: ../../../garnet/public/lib/fidl/cpp/binding_set.h -FILE: ../../../garnet/public/lib/fidl/cpp/binding_set_unittest.cc -FILE: ../../../garnet/public/lib/fidl/cpp/binding_unittest.cc -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/type_converters.cc -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/type_converters.h -FILE: ../../../garnet/public/lib/fidl/cpp/clone.cc -FILE: ../../../garnet/public/lib/fidl/cpp/clone.h -FILE: ../../../garnet/public/lib/fidl/cpp/clone_unittest.cc -FILE: ../../../garnet/public/lib/fidl/cpp/coding_traits.cc -FILE: ../../../garnet/public/lib/fidl/cpp/coding_traits.h -FILE: ../../../garnet/public/lib/fidl/cpp/decoder.cc -FILE: ../../../garnet/public/lib/fidl/cpp/decoder.h -FILE: ../../../garnet/public/lib/fidl/cpp/encoder.cc -FILE: ../../../garnet/public/lib/fidl/cpp/encoder.h -FILE: ../../../garnet/public/lib/fidl/cpp/interface_handle.h -FILE: ../../../garnet/public/lib/fidl/cpp/interface_handle_unittest.cc -FILE: ../../../garnet/public/lib/fidl/cpp/interface_ptr.h -FILE: ../../../garnet/public/lib/fidl/cpp/interface_ptr_set.h -FILE: ../../../garnet/public/lib/fidl/cpp/interface_ptr_set_unittest.cc -FILE: ../../../garnet/public/lib/fidl/cpp/interface_ptr_unittest.cc -FILE: ../../../garnet/public/lib/fidl/cpp/interface_request.h -FILE: ../../../garnet/public/lib/fidl/cpp/interface_request_unittest.cc -FILE: ../../../garnet/public/lib/fidl/cpp/internal/header.h -FILE: ../../../garnet/public/lib/fidl/cpp/internal/implementation.h -FILE: ../../../garnet/public/lib/fidl/cpp/internal/message_handler.cc -FILE: ../../../garnet/public/lib/fidl/cpp/internal/message_handler.h -FILE: ../../../garnet/public/lib/fidl/cpp/internal/message_reader.cc -FILE: ../../../garnet/public/lib/fidl/cpp/internal/message_reader.h -FILE: ../../../garnet/public/lib/fidl/cpp/internal/message_reader_unittest.cc -FILE: ../../../garnet/public/lib/fidl/cpp/internal/pending_response.cc -FILE: ../../../garnet/public/lib/fidl/cpp/internal/pending_response.h -FILE: ../../../garnet/public/lib/fidl/cpp/internal/proxy_controller.cc -FILE: ../../../garnet/public/lib/fidl/cpp/internal/proxy_controller.h -FILE: ../../../garnet/public/lib/fidl/cpp/internal/proxy_controller_unittest.cc -FILE: ../../../garnet/public/lib/fidl/cpp/internal/stub.cc -FILE: ../../../garnet/public/lib/fidl/cpp/internal/stub.h -FILE: ../../../garnet/public/lib/fidl/cpp/internal/stub_controller.cc -FILE: ../../../garnet/public/lib/fidl/cpp/internal/stub_controller.h -FILE: ../../../garnet/public/lib/fidl/cpp/internal/stub_controller_unittest.cc -FILE: ../../../garnet/public/lib/fidl/cpp/internal/synchronous_proxy.cc -FILE: ../../../garnet/public/lib/fidl/cpp/internal/synchronous_proxy.h -FILE: ../../../garnet/public/lib/fidl/cpp/internal/weak_stub_controller.cc -FILE: ../../../garnet/public/lib/fidl/cpp/internal/weak_stub_controller.h -FILE: ../../../garnet/public/lib/fidl/cpp/string.cc -FILE: ../../../garnet/public/lib/fidl/cpp/string.h -FILE: ../../../garnet/public/lib/fidl/cpp/string_unittest.cc -FILE: ../../../garnet/public/lib/fidl/cpp/synchronous_interface_ptr.h -FILE: ../../../garnet/public/lib/fidl/cpp/synchronous_interface_ptr_unittest.cc -FILE: ../../../garnet/public/lib/fidl/cpp/traits.h -FILE: ../../../garnet/public/lib/fidl/cpp/vector.h -FILE: ../../../garnet/public/lib/fidl/cpp/vector_unittest.cc -FILE: ../../../garnet/public/lib/fidl/go/src/fidl/bindings2/encoding.go -FILE: ../../../garnet/public/lib/fidl/go/src/fidl/bindings2/encoding_test.go -FILE: ../../../garnet/public/lib/fidl/go/src/fidl/bindings2/message.go -FILE: ../../../garnet/public/lib/fidl/go/src/fidl/bindings2/test_types.go -FILE: ../../../garnet/public/lib/fidl/rust/fidl/src/encoding2.rs -FILE: ../../../garnet/public/lib/fsl/syslogger/init.cc -FILE: ../../../garnet/public/lib/fsl/syslogger/init.h -FILE: ../../../garnet/public/lib/fsl/syslogger/init_unittest.cc -FILE: ../../../garnet/public/lib/fxl/type_converter.h -FILE: ../../../garnet/public/lib/gralloc/fidl/gralloc.fidl -FILE: ../../../garnet/public/lib/images/fidl/encoded_image.fidl -FILE: ../../../garnet/public/lib/logger/fidl/logger.fidl -FILE: ../../../garnet/public/lib/mdns/cpp/service_subscriber.cc -FILE: ../../../garnet/public/lib/mdns/cpp/service_subscriber.h -FILE: ../../../garnet/public/lib/syslog/cpp/logger.cc -FILE: ../../../garnet/public/lib/syslog/cpp/logger.h -FILE: ../../../garnet/public/lib/syslog/cpp/logger_init.cc -FILE: ../../../garnet/public/lib/syslog/cpp/logger_unittest.cc -FILE: ../../../garnet/public/lib/ui/mozart/fidl/commands.fidl -FILE: ../../../garnet/public/lib/ui/mozart/fidl/dummy_system/commands.fidl -FILE: ../../../garnet/public/lib/ui/mozart/fidl/dummy_system/events.fidl -FILE: ../../../garnet/public/lib/ui/mozart/fidl/events.fidl -FILE: ../../../garnet/public/lib/ui/mozart/fidl/mozart.fidl -FILE: ../../../garnet/public/lib/ui/mozart/fidl/session.fidl -FILE: ../../../garnet/public/lib/ui/presentation/fidl/display_usage.fidl -FILE: ../../../garnet/public/lib/ui/views/fidl/commands.fidl -FILE: ../../../garnet/public/lib/ui/views/fidl/events.fidl -FILE: ../../../garnet/public/lib/xi/fidl/xi.fidl ----------------------------------------------------------------------------------------------------- -Copyright 2018 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: garnet -ORIGIN: ../../../garnet/public/lib/media/audio/lpcm_payload.cc + ../../../garnet/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../garnet/public/lib/media/audio/lpcm_payload.cc -FILE: ../../../garnet/public/lib/media/audio/lpcm_payload.h ----------------------------------------------------------------------------------------------------- -Copyright 2017 The Fuchsia Authors.All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: garnet -ORIGIN: ../../../garnet/public/lib/netstack/fidl/netstack.fidl + ../../../LICENSE -TYPE: LicenseType.bsd -FILE: ../../../garnet/public/lib/netstack/fidl/netstack.fidl ----------------------------------------------------------------------------------------------------- -Copyright 2013 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: garnet -ORIGIN: ../../../garnet/public/lib/svc/cpp/service_namespace.cc + ../../../LICENSE -TYPE: LicenseType.bsd -FILE: ../../../garnet/public/lib/svc/cpp/service_namespace.cc ----------------------------------------------------------------------------------------------------- -Copyright 2017 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: garnet -ORIGIN: ../../../third_party/icu/scripts/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../garnet/public/lib/fidl/go/src/fidl/bindings/async_waiter.go -FILE: ../../../garnet/public/lib/fidl/go/src/fidl/bindings/connector.go -FILE: ../../../garnet/public/lib/fidl/go/src/fidl/bindings/decoder.go -FILE: ../../../garnet/public/lib/fidl/go/src/fidl/bindings/encoder.go -FILE: ../../../garnet/public/lib/fidl/go/src/fidl/bindings/interface.go -FILE: ../../../garnet/public/lib/fidl/go/src/fidl/bindings/message.go -FILE: ../../../garnet/public/lib/fidl/go/src/fidl/bindings/router.go -FILE: ../../../garnet/public/lib/fidl/go/src/fidl/bindings/stub.go -FILE: ../../../garnet/public/lib/fidl/go/src/fidl/bindings/util.go -FILE: ../../../garnet/public/lib/netstack/fidl/net_address.fidl -FILE: ../../../garnet/public/lib/network/fidl/http_header.fidl -FILE: ../../../garnet/public/lib/network/fidl/network_error.fidl -FILE: ../../../garnet/public/lib/network/fidl/network_service.fidl -FILE: ../../../garnet/public/lib/network/fidl/url_loader.fidl -FILE: ../../../garnet/public/lib/network/fidl/url_request.fidl -FILE: ../../../garnet/public/lib/network/fidl/url_response.fidl ----------------------------------------------------------------------------------------------------- -Copyright 2015 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: garnet -ORIGIN: ../../../topaz/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/formatting.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/internal/message_validator.cc -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/message_validator.h -FILE: ../../../garnet/public/lib/fidl/cpp/bindings/synchronous_interface_ptr.h -FILE: ../../../garnet/public/lib/fidl/rust/fidl/src/client.rs -FILE: ../../../garnet/public/lib/fidl/rust/fidl/src/encoding.rs -FILE: ../../../garnet/public/lib/fidl/rust/fidl/src/error.rs -FILE: ../../../garnet/public/lib/fidl/rust/fidl/src/interface.rs -FILE: ../../../garnet/public/lib/fidl/rust/fidl/src/lib.rs -FILE: ../../../garnet/public/lib/fidl/rust/fidl/src/message.rs -FILE: ../../../garnet/public/lib/fidl/rust/fidl/src/server.rs -FILE: ../../../garnet/public/lib/fonts/fidl/font_provider.fidl -FILE: ../../../garnet/public/lib/fsl/handles/object_info.cc -FILE: ../../../garnet/public/lib/fsl/handles/object_info.h -FILE: ../../../garnet/public/lib/fsl/handles/object_info_unittest.cc -FILE: ../../../garnet/public/lib/fsl/io/device_watcher.cc -FILE: ../../../garnet/public/lib/fsl/io/device_watcher.h -FILE: ../../../garnet/public/lib/fsl/io/redirection.cc -FILE: ../../../garnet/public/lib/fsl/io/redirection.h -FILE: ../../../garnet/public/lib/fsl/io/redirection_unittest.cc -FILE: ../../../garnet/public/lib/fsl/socket/blocking_drain.cc -FILE: ../../../garnet/public/lib/fsl/socket/blocking_drain.h -FILE: ../../../garnet/public/lib/fsl/socket/files.cc -FILE: ../../../garnet/public/lib/fsl/socket/files.h -FILE: ../../../garnet/public/lib/fsl/socket/files_unittest.cc -FILE: ../../../garnet/public/lib/fsl/socket/socket_drainer.cc -FILE: ../../../garnet/public/lib/fsl/socket/socket_drainer.h -FILE: ../../../garnet/public/lib/fsl/socket/socket_drainer_unittest.cc -FILE: ../../../garnet/public/lib/fsl/socket/strings.cc -FILE: ../../../garnet/public/lib/fsl/socket/strings.h -FILE: ../../../garnet/public/lib/fsl/tasks/incoming_task_queue.cc -FILE: ../../../garnet/public/lib/fsl/tasks/incoming_task_queue.h -FILE: ../../../garnet/public/lib/fsl/tasks/message_loop.cc -FILE: ../../../garnet/public/lib/fsl/tasks/message_loop.h -FILE: ../../../garnet/public/lib/fsl/tasks/message_loop_handler.cc -FILE: ../../../garnet/public/lib/fsl/tasks/message_loop_handler.h -FILE: ../../../garnet/public/lib/fsl/tasks/message_loop_unittest.cc -FILE: ../../../garnet/public/lib/fsl/threading/create_thread.cc -FILE: ../../../garnet/public/lib/fsl/threading/create_thread.h -FILE: ../../../garnet/public/lib/fsl/threading/create_thread_unittest.cc -FILE: ../../../garnet/public/lib/fsl/vmo/file.cc -FILE: ../../../garnet/public/lib/fsl/vmo/file.h -FILE: ../../../garnet/public/lib/fsl/vmo/shared_vmo.cc -FILE: ../../../garnet/public/lib/fsl/vmo/shared_vmo.h -FILE: ../../../garnet/public/lib/fsl/vmo/shared_vmo_unittest.cc -FILE: ../../../garnet/public/lib/fsl/vmo/strings.h -FILE: ../../../garnet/public/lib/fsl/vmo/strings_unittest.cc -FILE: ../../../garnet/public/lib/fsl/vmo/vector.h -FILE: ../../../garnet/public/lib/fsl/vmo/vector_unittest.cc -FILE: ../../../garnet/public/lib/fsl/vmo/vmo.cc -FILE: ../../../garnet/public/lib/fxl/arraysize.h -FILE: ../../../garnet/public/lib/fxl/arraysize_unittest.cc -FILE: ../../../garnet/public/lib/fxl/build_config.h -FILE: ../../../garnet/public/lib/fxl/command_line.cc -FILE: ../../../garnet/public/lib/fxl/command_line.h -FILE: ../../../garnet/public/lib/fxl/command_line_unittest.cc -FILE: ../../../garnet/public/lib/fxl/compiler_specific.h -FILE: ../../../garnet/public/lib/fxl/debug/debugger.cc -FILE: ../../../garnet/public/lib/fxl/debug/debugger.h -FILE: ../../../garnet/public/lib/fxl/files/directory.cc -FILE: ../../../garnet/public/lib/fxl/files/directory.h -FILE: ../../../garnet/public/lib/fxl/files/eintr_wrapper.h -FILE: ../../../garnet/public/lib/fxl/files/file.cc -FILE: ../../../garnet/public/lib/fxl/files/file.h -FILE: ../../../garnet/public/lib/fxl/files/file_descriptor.cc -FILE: ../../../garnet/public/lib/fxl/files/file_descriptor.h -FILE: ../../../garnet/public/lib/fxl/files/file_unittest.cc -FILE: ../../../garnet/public/lib/fxl/files/path.h -FILE: ../../../garnet/public/lib/fxl/files/path_posix.cc -FILE: ../../../garnet/public/lib/fxl/files/path_unittest.cc -FILE: ../../../garnet/public/lib/fxl/files/scoped_temp_dir.cc -FILE: ../../../garnet/public/lib/fxl/files/scoped_temp_dir.h -FILE: ../../../garnet/public/lib/fxl/files/scoped_temp_dir_unittest.cc -FILE: ../../../garnet/public/lib/fxl/files/symlink.h -FILE: ../../../garnet/public/lib/fxl/files/symlink_posix.cc -FILE: ../../../garnet/public/lib/fxl/files/unique_fd.cc -FILE: ../../../garnet/public/lib/fxl/files/unique_fd.h -FILE: ../../../garnet/public/lib/fxl/functional/auto_call.h -FILE: ../../../garnet/public/lib/fxl/functional/closure.h -FILE: ../../../garnet/public/lib/fxl/functional/make_copyable.h -FILE: ../../../garnet/public/lib/fxl/functional/make_copyable_unittest.cc -FILE: ../../../garnet/public/lib/fxl/log_level.h -FILE: ../../../garnet/public/lib/fxl/log_settings.cc -FILE: ../../../garnet/public/lib/fxl/log_settings.h -FILE: ../../../garnet/public/lib/fxl/log_settings_state.cc -FILE: ../../../garnet/public/lib/fxl/log_settings_unittest.cc -FILE: ../../../garnet/public/lib/fxl/logging.cc -FILE: ../../../garnet/public/lib/fxl/logging.h -FILE: ../../../garnet/public/lib/fxl/macros.h -FILE: ../../../garnet/public/lib/fxl/memory/ref_counted.h -FILE: ../../../garnet/public/lib/fxl/memory/ref_counted_internal.h -FILE: ../../../garnet/public/lib/fxl/memory/ref_counted_unittest.cc -FILE: ../../../garnet/public/lib/fxl/memory/ref_ptr.h -FILE: ../../../garnet/public/lib/fxl/memory/ref_ptr_internal.h -FILE: ../../../garnet/public/lib/fxl/memory/unique_object.h -FILE: ../../../garnet/public/lib/fxl/memory/weak_ptr.h -FILE: ../../../garnet/public/lib/fxl/memory/weak_ptr_internal.cc -FILE: ../../../garnet/public/lib/fxl/memory/weak_ptr_internal.h -FILE: ../../../garnet/public/lib/fxl/memory/weak_ptr_unittest.cc -FILE: ../../../garnet/public/lib/fxl/random/rand.cc -FILE: ../../../garnet/public/lib/fxl/random/rand.h -FILE: ../../../garnet/public/lib/fxl/random/uuid.cc -FILE: ../../../garnet/public/lib/fxl/random/uuid.h -FILE: ../../../garnet/public/lib/fxl/strings/ascii.cc -FILE: ../../../garnet/public/lib/fxl/strings/ascii.h -FILE: ../../../garnet/public/lib/fxl/strings/ascii_unittest.cc -FILE: ../../../garnet/public/lib/fxl/strings/concatenate.cc -FILE: ../../../garnet/public/lib/fxl/strings/concatenate.h -FILE: ../../../garnet/public/lib/fxl/strings/concatenate_unittest.cc -FILE: ../../../garnet/public/lib/fxl/strings/split_string.cc -FILE: ../../../garnet/public/lib/fxl/strings/split_string.h -FILE: ../../../garnet/public/lib/fxl/strings/split_string_unittest.cc -FILE: ../../../garnet/public/lib/fxl/strings/string_number_conversions.cc -FILE: ../../../garnet/public/lib/fxl/strings/string_number_conversions.h -FILE: ../../../garnet/public/lib/fxl/strings/string_number_conversions_unittest.cc -FILE: ../../../garnet/public/lib/fxl/strings/string_printf.cc -FILE: ../../../garnet/public/lib/fxl/strings/string_printf.h -FILE: ../../../garnet/public/lib/fxl/strings/string_printf_unittest.cc -FILE: ../../../garnet/public/lib/fxl/strings/string_view.cc -FILE: ../../../garnet/public/lib/fxl/strings/string_view.h -FILE: ../../../garnet/public/lib/fxl/strings/string_view_unittest.cc -FILE: ../../../garnet/public/lib/fxl/strings/trim.cc -FILE: ../../../garnet/public/lib/fxl/strings/trim.h -FILE: ../../../garnet/public/lib/fxl/strings/trim_unittest.cc -FILE: ../../../garnet/public/lib/fxl/strings/utf_codecs.cc -FILE: ../../../garnet/public/lib/fxl/strings/utf_codecs.h -FILE: ../../../garnet/public/lib/fxl/synchronization/sleep.cc -FILE: ../../../garnet/public/lib/fxl/synchronization/sleep.h -FILE: ../../../garnet/public/lib/fxl/synchronization/thread_annotations.h -FILE: ../../../garnet/public/lib/fxl/synchronization/thread_annotations_unittest.cc -FILE: ../../../garnet/public/lib/fxl/synchronization/thread_checker.h -FILE: ../../../garnet/public/lib/fxl/synchronization/thread_checker_unittest.cc -FILE: ../../../garnet/public/lib/fxl/synchronization/waitable_event.cc -FILE: ../../../garnet/public/lib/fxl/synchronization/waitable_event.h -FILE: ../../../garnet/public/lib/fxl/synchronization/waitable_event_unittest.cc -FILE: ../../../garnet/public/lib/fxl/tasks/one_shot_timer.cc -FILE: ../../../garnet/public/lib/fxl/tasks/one_shot_timer.h -FILE: ../../../garnet/public/lib/fxl/tasks/one_shot_timer_unittest.cc -FILE: ../../../garnet/public/lib/fxl/tasks/task_runner.cc -FILE: ../../../garnet/public/lib/fxl/tasks/task_runner.h -FILE: ../../../garnet/public/lib/fxl/time/stopwatch.cc -FILE: ../../../garnet/public/lib/fxl/time/stopwatch.h -FILE: ../../../garnet/public/lib/fxl/time/time_delta.h -FILE: ../../../garnet/public/lib/fxl/time/time_point.cc -FILE: ../../../garnet/public/lib/fxl/time/time_point.h -FILE: ../../../garnet/public/lib/fxl/time/time_printers.cc -FILE: ../../../garnet/public/lib/fxl/time/time_unittest.cc -FILE: ../../../garnet/public/lib/icu_data/fidl/icu_data.fidl -FILE: ../../../garnet/public/lib/media/audio/perceived_level.cc -FILE: ../../../garnet/public/lib/media/fidl/audio_renderer.fidl -FILE: ../../../garnet/public/lib/media/fidl/audio_server.fidl -FILE: ../../../garnet/public/lib/media/fidl/media_capturer.fidl -FILE: ../../../garnet/public/lib/media/fidl/media_metadata.fidl -FILE: ../../../garnet/public/lib/media/fidl/media_player.fidl -FILE: ../../../garnet/public/lib/media/fidl/media_renderer.fidl -FILE: ../../../garnet/public/lib/media/fidl/media_result.fidl -FILE: ../../../garnet/public/lib/media/fidl/media_sink.fidl -FILE: ../../../garnet/public/lib/media/fidl/media_source.fidl -FILE: ../../../garnet/public/lib/media/fidl/media_transport.fidl -FILE: ../../../garnet/public/lib/media/fidl/media_type_converter.fidl -FILE: ../../../garnet/public/lib/media/fidl/media_types.fidl -FILE: ../../../garnet/public/lib/media/fidl/problem.fidl -FILE: ../../../garnet/public/lib/media/fidl/seeking_reader.fidl -FILE: ../../../garnet/public/lib/media/fidl/timeline_controller.fidl -FILE: ../../../garnet/public/lib/media/fidl/timelines.fidl -FILE: ../../../garnet/public/lib/media/fidl/tts_service.fidl -FILE: ../../../garnet/public/lib/media/fidl/video_renderer.fidl -FILE: ../../../garnet/public/lib/media/timeline/timeline.h -FILE: ../../../garnet/public/lib/media/timeline/timeline_function.cc -FILE: ../../../garnet/public/lib/media/timeline/timeline_function.h -FILE: ../../../garnet/public/lib/media/timeline/timeline_rate.cc -FILE: ../../../garnet/public/lib/media/timeline/timeline_rate.h -FILE: ../../../garnet/public/lib/media/transport/fifo_allocator.cc -FILE: ../../../garnet/public/lib/media/transport/fifo_allocator.h -FILE: ../../../garnet/public/lib/media/transport/mapped_shared_buffer.cc -FILE: ../../../garnet/public/lib/media/transport/mapped_shared_buffer.h -FILE: ../../../garnet/public/lib/media/transport/media_packet_consumer_base.cc -FILE: ../../../garnet/public/lib/media/transport/media_packet_consumer_base.h -FILE: ../../../garnet/public/lib/media/transport/media_packet_producer_base.cc -FILE: ../../../garnet/public/lib/media/transport/media_packet_producer_base.h -FILE: ../../../garnet/public/lib/media/transport/shared_buffer_set.cc -FILE: ../../../garnet/public/lib/media/transport/shared_buffer_set.h -FILE: ../../../garnet/public/lib/media/transport/shared_buffer_set_allocator.cc -FILE: ../../../garnet/public/lib/media/transport/shared_buffer_set_allocator.h -FILE: ../../../garnet/public/lib/netconnector/cpp/message_relay.cc -FILE: ../../../garnet/public/lib/netconnector/cpp/message_relay.h -FILE: ../../../garnet/public/lib/netconnector/fidl/netconnector.fidl -FILE: ../../../garnet/public/lib/network/fidl/url_body.fidl -FILE: ../../../garnet/public/lib/syslog/cpp/run_all_unittests.cc -FILE: ../../../garnet/public/lib/test_runner/cpp/scope.cc -FILE: ../../../garnet/public/lib/test_runner/cpp/scope.h -FILE: ../../../garnet/public/lib/test_runner/cpp/test_runner.cc -FILE: ../../../garnet/public/lib/test_runner/fidl/test_runner.fidl -FILE: ../../../garnet/public/lib/tracing/fidl/trace_controller.fidl -FILE: ../../../garnet/public/lib/tracing/fidl/trace_provider.fidl -FILE: ../../../garnet/public/lib/tracing/fidl/trace_registry.fidl -FILE: ../../../garnet/public/lib/ui/geometry/cpp/formatting.cc -FILE: ../../../garnet/public/lib/ui/geometry/cpp/formatting.h -FILE: ../../../garnet/public/lib/ui/geometry/cpp/geometry_util.cc -FILE: ../../../garnet/public/lib/ui/geometry/cpp/geometry_util.h -FILE: ../../../garnet/public/lib/ui/geometry/fidl/geometry.fidl -FILE: ../../../garnet/public/lib/ui/input/cpp/formatting.cc -FILE: ../../../garnet/public/lib/ui/input/cpp/formatting.h -FILE: ../../../garnet/public/lib/ui/presentation/fidl/presenter.fidl -FILE: ../../../garnet/public/lib/ui/view_framework/view_provider_app.cc -FILE: ../../../garnet/public/lib/ui/view_framework/view_provider_app.h -FILE: ../../../garnet/public/lib/ui/views/fidl/view_containers.fidl -FILE: ../../../garnet/public/lib/ui/views/fidl/view_properties.fidl -FILE: ../../../garnet/public/lib/ui/views/fidl/view_token.fidl -FILE: ../../../garnet/public/lib/ui/views/fidl/view_tree_token.fidl -FILE: ../../../garnet/public/lib/zip/create_unzipper.cc -FILE: ../../../garnet/public/lib/zip/create_unzipper.h -FILE: ../../../garnet/public/lib/zip/memory_io.cc -FILE: ../../../garnet/public/lib/zip/memory_io.h -FILE: ../../../garnet/public/lib/zip/unique_unzipper.cc -FILE: ../../../garnet/public/lib/zip/unique_unzipper.h -FILE: ../../../garnet/public/lib/zip/unique_zipper.cc -FILE: ../../../garnet/public/lib/zip/unique_zipper.h -FILE: ../../../garnet/public/lib/zip/unzipper.cc -FILE: ../../../garnet/public/lib/zip/unzipper.h -FILE: ../../../garnet/public/lib/zip/zipper.cc -FILE: ../../../garnet/public/lib/zip/zipper.h ----------------------------------------------------------------------------------------------------- -Copyright 2016 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: icu -ORIGIN: ../../../garnet/public/lib/fxl/third_party/icu/LICENSE -TYPE: LicenseType.unknown -FILE: ../../../garnet/public/lib/fxl/third_party/icu/icu_utf.cc -FILE: ../../../garnet/public/lib/fxl/third_party/icu/icu_utf.h ----------------------------------------------------------------------------------------------------- -ICU License - ICU 1.8.1 and later - -COPYRIGHT AND PERMISSION NOTICE - -Copyright (c) 1995-2009 International Business Machines Corporation and others - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, and/or sell copies of the Software, and to permit persons -to whom the Software is furnished to do so, provided that the above -copyright notice(s) and this permission notice appear in all copies of -the Software and that both the above copyright notice(s) and this -permission notice appear in supporting documentation. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY -SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER -RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF -CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN -CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -Except as contained in this notice, the name of a copyright holder -shall not be used in advertising or otherwise to promote the sale, use -or other dealings in this Software without prior written authorization -of the copyright holder. -==================================================================================================== -Total license count: 12 diff --git a/ci/licenses_golden/licenses_lib b/ci/licenses_golden/licenses_lib deleted file mode 100644 index 53bb313e2d357..0000000000000 --- a/ci/licenses_golden/licenses_lib +++ /dev/null @@ -1,158 +0,0 @@ -Signature: c6853c1bbc8db501fa71fb05acb5f2ba - -UNUSED LICENSES: - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -USED LICENSES: - -==================================================================================================== -LIBRARY: lib -ORIGIN: ../../../garnet/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../lib/tonic/dart_list.cc -FILE: ../../../lib/tonic/dart_list.h ----------------------------------------------------------------------------------------------------- -Copyright 2017 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: lib -ORIGIN: ../../../lib/tonic/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../lib/tonic/converter/dart_converter.cc -FILE: ../../../lib/tonic/converter/dart_converter.h -FILE: ../../../lib/tonic/dart_message_handler.cc -FILE: ../../../lib/tonic/dart_message_handler.h -FILE: ../../../lib/tonic/dart_microtask_queue.cc -FILE: ../../../lib/tonic/dart_microtask_queue.h -FILE: ../../../lib/tonic/dart_sticky_error.cc -FILE: ../../../lib/tonic/dart_sticky_error.h -FILE: ../../../lib/tonic/debugger/dart_debugger.cc -FILE: ../../../lib/tonic/debugger/dart_debugger.h -FILE: ../../../lib/tonic/file_loader/file_loader.cc -FILE: ../../../lib/tonic/file_loader/file_loader.h -FILE: ../../../lib/tonic/logging/dart_error.cc -FILE: ../../../lib/tonic/logging/dart_error.h -FILE: ../../../lib/tonic/logging/dart_invoke.cc -FILE: ../../../lib/tonic/logging/dart_invoke.h -FILE: ../../../lib/tonic/parsers/packages_map.cc -FILE: ../../../lib/tonic/parsers/packages_map.h -FILE: ../../../lib/tonic/scopes/dart_api_scope.h -FILE: ../../../lib/tonic/scopes/dart_isolate_scope.cc -FILE: ../../../lib/tonic/scopes/dart_isolate_scope.h -FILE: ../../../lib/tonic/typed_data/dart_byte_data.h -FILE: ../../../lib/tonic/typed_data/int32_list.h -FILE: ../../../lib/tonic/typed_data/uint8_list.h ----------------------------------------------------------------------------------------------------- -Copyright 2016 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - -==================================================================================================== -LIBRARY: lib -ORIGIN: ../../../lib/tonic/typed_data/dart_byte_data.cc + ../../../lib/tonic/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../lib/tonic/dart_args.h -FILE: ../../../lib/tonic/dart_binding_macros.h -FILE: ../../../lib/tonic/dart_class_library.cc -FILE: ../../../lib/tonic/dart_class_library.h -FILE: ../../../lib/tonic/dart_class_provider.cc -FILE: ../../../lib/tonic/dart_class_provider.h -FILE: ../../../lib/tonic/dart_library_natives.cc -FILE: ../../../lib/tonic/dart_library_natives.h -FILE: ../../../lib/tonic/dart_persistent_value.cc -FILE: ../../../lib/tonic/dart_persistent_value.h -FILE: ../../../lib/tonic/dart_state.cc -FILE: ../../../lib/tonic/dart_state.h -FILE: ../../../lib/tonic/dart_wrappable.cc -FILE: ../../../lib/tonic/dart_wrappable.h -FILE: ../../../lib/tonic/dart_wrapper_info.h -FILE: ../../../lib/tonic/typed_data/dart_byte_data.cc -FILE: ../../../lib/tonic/typed_data/float32_list.cc -FILE: ../../../lib/tonic/typed_data/float32_list.h -FILE: ../../../lib/tonic/typed_data/float64_list.cc -FILE: ../../../lib/tonic/typed_data/float64_list.h -FILE: ../../../lib/tonic/typed_data/int32_list.cc -FILE: ../../../lib/tonic/typed_data/uint8_list.cc ----------------------------------------------------------------------------------------------------- -Copyright 2015 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== -Total license count: 3 diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3391c8bf3c0b7..9082e899c9b5c 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: a76e93473393beb2f2d02656c99b852c +Signature: dcef2b9d9d93b9b2ab1886efff54af73 UNUSED LICENSES: @@ -709,7 +709,7 @@ TYPE: LicenseType.bsd FILE: ../../../third_party/skia/bench/AndroidCodecBench.cpp FILE: ../../../third_party/skia/bench/AndroidCodecBench.h FILE: ../../../third_party/skia/bench/DrawLatticeBench.cpp -FILE: ../../../third_party/skia/bench/EncoderBench.cpp +FILE: ../../../third_party/skia/bench/EncodeBench.cpp FILE: ../../../third_party/skia/bench/GrMipMapBench.cpp FILE: ../../../third_party/skia/bench/HardStopGradientBench_ScaleNumColors.cpp FILE: ../../../third_party/skia/bench/HardStopGradientBench_ScaleNumHardStops.cpp @@ -718,17 +718,10 @@ FILE: ../../../third_party/skia/bench/ImageCacheBudgetBench.cpp FILE: ../../../third_party/skia/bench/PDFBench.cpp FILE: ../../../third_party/skia/bench/QuickRejectBench.cpp FILE: ../../../third_party/skia/bench/ShapesBench.cpp -FILE: ../../../third_party/skia/bench/SkRasterPipelineBench.cpp FILE: ../../../third_party/skia/bench/StreamBench.cpp FILE: ../../../third_party/skia/bench/SwizzleBench.cpp FILE: ../../../third_party/skia/bench/TileImageFilterBench.cpp FILE: ../../../third_party/skia/bench/VertexColorSpaceBench.cpp -FILE: ../../../third_party/skia/experimental/pipe/SkPipe.h -FILE: ../../../third_party/skia/experimental/pipe/SkPipeCanvas.cpp -FILE: ../../../third_party/skia/experimental/pipe/SkPipeCanvas.h -FILE: ../../../third_party/skia/experimental/pipe/SkPipeFormat.h -FILE: ../../../third_party/skia/experimental/pipe/SkPipeReader.cpp -FILE: ../../../third_party/skia/experimental/pipe/SkRefSet.h FILE: ../../../third_party/skia/experimental/svg/model/SkPEG.h FILE: ../../../third_party/skia/experimental/svg/model/SkSVGAttribute.cpp FILE: ../../../third_party/skia/experimental/svg/model/SkSVGAttribute.h @@ -827,13 +820,12 @@ FILE: ../../../third_party/skia/include/codec/SkCodecAnimation.h FILE: ../../../third_party/skia/include/core/SkBlendMode.h FILE: ../../../third_party/skia/include/core/SkClipOp.h FILE: ../../../third_party/skia/include/core/SkColorSpace.h -FILE: ../../../third_party/skia/include/core/SkColorSpaceXform.h FILE: ../../../third_party/skia/include/core/SkICC.h FILE: ../../../third_party/skia/include/core/SkMilestone.h FILE: ../../../third_party/skia/include/core/SkOverdrawCanvas.h FILE: ../../../third_party/skia/include/core/SkRasterHandleAllocator.h FILE: ../../../third_party/skia/include/core/SkSwizzle.h -FILE: ../../../third_party/skia/include/core/SkYUVSizeInfo.h +FILE: ../../../third_party/skia/include/core/SkYUVASizeInfo.h FILE: ../../../third_party/skia/include/effects/SkArithmeticImageFilter.h FILE: ../../../third_party/skia/include/effects/SkOverdrawColorFilter.h FILE: ../../../third_party/skia/include/effects/SkPaintImageFilter.h @@ -868,8 +860,6 @@ FILE: ../../../third_party/skia/samplecode/SampleMegaStroke.cpp FILE: ../../../third_party/skia/samplecode/SamplePathOverstroke.cpp FILE: ../../../third_party/skia/samplecode/SampleSVGFile.cpp FILE: ../../../third_party/skia/src/codec/SkCodecAnimationPriv.h -FILE: ../../../third_party/skia/src/codec/SkRawAdapterCodec.cpp -FILE: ../../../third_party/skia/src/codec/SkRawAdapterCodec.h FILE: ../../../third_party/skia/src/codec/SkRawCodec.cpp FILE: ../../../third_party/skia/src/codec/SkRawCodec.h FILE: ../../../third_party/skia/src/codec/SkStreamBuffer.cpp @@ -971,10 +961,8 @@ FILE: ../../../third_party/skia/src/core/SkClipOpPriv.h FILE: ../../../third_party/skia/src/core/SkColorMatrixFilterRowMajor255.h FILE: ../../../third_party/skia/src/core/SkColorSpace.cpp FILE: ../../../third_party/skia/src/core/SkColorSpacePriv.h -FILE: ../../../third_party/skia/src/core/SkColorSpaceXform.cpp FILE: ../../../third_party/skia/src/core/SkCpu.cpp FILE: ../../../third_party/skia/src/core/SkCpu.h -FILE: ../../../third_party/skia/src/core/SkDeduper.h FILE: ../../../third_party/skia/src/core/SkExchange.h FILE: ../../../third_party/skia/src/core/SkFixed15.h FILE: ../../../third_party/skia/src/core/SkFuzzLogging.h @@ -1000,8 +988,6 @@ FILE: ../../../third_party/skia/src/core/SkNormalMapSource.h FILE: ../../../third_party/skia/src/core/SkNormalSource.cpp FILE: ../../../third_party/skia/src/core/SkNormalSource.h FILE: ../../../third_party/skia/src/core/SkOverdrawCanvas.cpp -FILE: ../../../third_party/skia/src/core/SkPM4f.h -FILE: ../../../third_party/skia/src/core/SkPM4fPriv.h FILE: ../../../third_party/skia/src/core/SkPathMeasurePriv.h FILE: ../../../third_party/skia/src/core/SkRasterPipeline.cpp FILE: ../../../third_party/skia/src/core/SkRasterPipeline.h @@ -1010,7 +996,6 @@ FILE: ../../../third_party/skia/src/core/SkRecordedDrawable.cpp FILE: ../../../third_party/skia/src/core/SkRecordedDrawable.h FILE: ../../../third_party/skia/src/core/SkScaleToSides.h FILE: ../../../third_party/skia/src/core/SkScopeExit.h -FILE: ../../../third_party/skia/src/core/SkSinglyLinkedList.h FILE: ../../../third_party/skia/src/core/SkSpecialImage.cpp FILE: ../../../third_party/skia/src/core/SkSpecialImage.h FILE: ../../../third_party/skia/src/core/SkSpecialSurface.cpp @@ -1298,15 +1283,21 @@ LIBRARY: skcms LIBRARY: skia LIBRARY: vulkan LIBRARY: vulkanmemoryallocator -ORIGIN: ../../../third_party/skia/bench/CompositingImagesBench.cpp + ../../../third_party/skia/LICENSE +LIBRARY: wuffs +ORIGIN: ../../../third_party/skia/bench/ClearBench.cpp + ../../../third_party/skia/LICENSE TYPE: LicenseType.bsd +FILE: ../../../third_party/skia/bench/ClearBench.cpp FILE: ../../../third_party/skia/bench/CompositingImagesBench.cpp FILE: ../../../third_party/skia/bench/CubicMapBench.cpp FILE: ../../../third_party/skia/bench/GrCCFillGeometryBench.cpp FILE: ../../../third_party/skia/bench/ImageCycleBench.cpp FILE: ../../../third_party/skia/bench/JSONBench.cpp +FILE: ../../../third_party/skia/bench/PathOpsBench.cpp FILE: ../../../third_party/skia/bench/PolyUtilsBench.cpp FILE: ../../../third_party/skia/bench/ShaderMaskFilterBench.cpp +FILE: ../../../third_party/skia/experimental/nima/NimaActor.cpp +FILE: ../../../third_party/skia/experimental/nima/NimaActor.h +FILE: ../../../third_party/skia/experimental/pvg/draw_msg.proto FILE: ../../../third_party/skia/fuzz/FuzzCommon.cpp FILE: ../../../third_party/skia/fuzz/FuzzPathMeasure.cpp FILE: ../../../third_party/skia/fuzz/FuzzRegionOp.cpp @@ -1315,11 +1306,17 @@ FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzPathDeserialize.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzRegionDeserialize.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzRegionSetPath.cpp FILE: ../../../third_party/skia/gm/3dgm.cpp +FILE: ../../../third_party/skia/gm/analytic_gradients.cpp FILE: ../../../third_party/skia/gm/androidblendmodes.cpp FILE: ../../../third_party/skia/gm/clockwise.cpp FILE: ../../../third_party/skia/gm/crbug_847759.cpp FILE: ../../../third_party/skia/gm/crbug_884166.cpp FILE: ../../../third_party/skia/gm/crbug_887103.cpp +FILE: ../../../third_party/skia/gm/crbug_892988.cpp +FILE: ../../../third_party/skia/gm/crbug_899512.cpp +FILE: ../../../third_party/skia/gm/drawimageset.cpp +FILE: ../../../third_party/skia/gm/fwidth_squircle.cpp +FILE: ../../../third_party/skia/gm/gradients_degenerate.cpp FILE: ../../../third_party/skia/gm/hugepath.cpp FILE: ../../../third_party/skia/gm/localmatrixshader.cpp FILE: ../../../third_party/skia/gm/makeRasterImage.cpp @@ -1335,15 +1332,21 @@ FILE: ../../../third_party/skia/gm/shadermaskfilter.cpp FILE: ../../../third_party/skia/gm/sharedcorners.cpp FILE: ../../../third_party/skia/gm/skinning.cpp FILE: ../../../third_party/skia/gm/trickycubicstrokes.cpp +FILE: ../../../third_party/skia/gm/unpremul.cpp +FILE: ../../../third_party/skia/gm/wacky_yuv_formats.cpp FILE: ../../../third_party/skia/include/android/SkAnimatedImage.h FILE: ../../../third_party/skia/include/c/sk_colorspace.h FILE: ../../../third_party/skia/include/c/sk_imageinfo.h FILE: ../../../third_party/skia/include/core/SkCanvasVirtualEnforcer.h FILE: ../../../third_party/skia/include/core/SkCoverageMode.h +FILE: ../../../third_party/skia/include/core/SkFontMetrics.h FILE: ../../../third_party/skia/include/core/SkFontParameters.h +FILE: ../../../third_party/skia/include/core/SkFontTypes.h +FILE: ../../../third_party/skia/include/core/SkYUVAIndex.h FILE: ../../../third_party/skia/include/effects/SkOpPathEffect.h FILE: ../../../third_party/skia/include/effects/SkShaderMaskFilter.h FILE: ../../../third_party/skia/include/effects/SkTrimPathEffect.h +FILE: ../../../third_party/skia/include/gpu/GrBackendDrawableInfo.h FILE: ../../../third_party/skia/include/gpu/GrDriverBugWorkarounds.h FILE: ../../../third_party/skia/include/gpu/vk/GrVkMemoryAllocator.h FILE: ../../../third_party/skia/include/private/GrCCClipPath.h @@ -1354,7 +1357,8 @@ FILE: ../../../third_party/skia/include/private/SkMacros.h FILE: ../../../third_party/skia/include/private/SkSafe32.h FILE: ../../../third_party/skia/include/private/SkTo.h FILE: ../../../third_party/skia/include/utils/Sk3D.h -FILE: ../../../third_party/skia/include/utils/SkTextOnPath.h +FILE: ../../../third_party/skia/include/utils/SkAnimCodecPlayer.h +FILE: ../../../third_party/skia/include/utils/SkTextUtils.h FILE: ../../../third_party/skia/infra/cts/run_testlab.go FILE: ../../../third_party/skia/modules/skottie/include/SkottieProperty.h FILE: ../../../third_party/skia/modules/skottie/src/SkottieAdapter.cpp @@ -1370,6 +1374,8 @@ FILE: ../../../third_party/skia/modules/skottie/src/SkottieShapeLayer.cpp FILE: ../../../third_party/skia/modules/skottie/src/SkottieTest.cpp FILE: ../../../third_party/skia/modules/skottie/src/SkottieTextLayer.cpp FILE: ../../../third_party/skia/modules/skottie/src/SkottieTool.cpp +FILE: ../../../third_party/skia/modules/skottie/utils/SkottieUtils.cpp +FILE: ../../../third_party/skia/modules/skottie/utils/SkottieUtils.h FILE: ../../../third_party/skia/modules/sksg/include/SkSGClipEffect.h FILE: ../../../third_party/skia/modules/sksg/include/SkSGColorFilter.h FILE: ../../../third_party/skia/modules/sksg/include/SkSGGeometryTransform.h @@ -1397,11 +1403,11 @@ FILE: ../../../third_party/skia/samplecode/SampleCusp.cpp FILE: ../../../third_party/skia/samplecode/SampleFlutterAnimate.cpp FILE: ../../../third_party/skia/samplecode/SampleGlyphTransform.cpp FILE: ../../../third_party/skia/samplecode/SampleNima.cpp -FILE: ../../../third_party/skia/samplecode/SampleNimaActor.cpp -FILE: ../../../third_party/skia/samplecode/SampleNimaActor.h FILE: ../../../third_party/skia/src/android/SkAnimatedImage.cpp FILE: ../../../third_party/skia/src/c/sk_imageinfo.cpp FILE: ../../../third_party/skia/src/codec/SkEncodedInfo.cpp +FILE: ../../../third_party/skia/src/codec/SkWuffsCodec.cpp +FILE: ../../../third_party/skia/src/codec/SkWuffsCodec.h FILE: ../../../third_party/skia/src/compute/common/cl/find_cl.c FILE: ../../../third_party/skia/src/compute/common/cl/find_cl.h FILE: ../../../third_party/skia/src/compute/common/vk/cache_vk.c @@ -1442,9 +1448,12 @@ FILE: ../../../third_party/skia/src/core/SkCubicMap.cpp FILE: ../../../third_party/skia/src/core/SkCubicMap.h FILE: ../../../third_party/skia/src/core/SkDeferredDisplayList.cpp FILE: ../../../third_party/skia/src/core/SkDeferredDisplayListPriv.h +FILE: ../../../third_party/skia/src/core/SkDraw_text.cpp +FILE: ../../../third_party/skia/src/core/SkFontPriv.h FILE: ../../../third_party/skia/src/core/SkGlyph.cpp FILE: ../../../third_party/skia/src/core/SkIPoint16.h FILE: ../../../third_party/skia/src/core/SkMaskFilterBase.h +FILE: ../../../third_party/skia/src/core/SkPaint_text.cpp FILE: ../../../third_party/skia/src/core/SkPath_serial.cpp FILE: ../../../third_party/skia/src/core/SkPicturePriv.h FILE: ../../../third_party/skia/src/core/SkRRectPriv.h @@ -1459,6 +1468,7 @@ FILE: ../../../third_party/skia/src/core/SkSurfaceCharacterization.cpp FILE: ../../../third_party/skia/src/core/SkTextBlobPriv.h FILE: ../../../third_party/skia/src/core/SkTypeface_remote.cpp FILE: ../../../third_party/skia/src/core/SkTypeface_remote.h +FILE: ../../../third_party/skia/src/core/SkYUVASizeInfo.cpp FILE: ../../../third_party/skia/src/effects/SkOpPE.h FILE: ../../../third_party/skia/src/effects/SkOpPathEffect.cpp FILE: ../../../third_party/skia/src/effects/SkShaderMaskFilter.cpp @@ -1522,11 +1532,7 @@ FILE: ../../../third_party/skia/src/gpu/effects/GrRectBlurEffect.fp FILE: ../../../third_party/skia/src/gpu/effects/GrRectBlurEffect.h FILE: ../../../third_party/skia/src/gpu/effects/GrSkSLFP.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrSkSLFP.h -FILE: ../../../third_party/skia/src/gpu/effects/GrUnpremulInputFragmentProcessor.cpp -FILE: ../../../third_party/skia/src/gpu/effects/GrUnpremulInputFragmentProcessor.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrUnpremulInputFragmentProcessor.h FILE: ../../../third_party/skia/src/gpu/effects/GrYUVtoRGBEffect.cpp -FILE: ../../../third_party/skia/src/gpu/effects/GrYUVtoRGBEffect.fp FILE: ../../../third_party/skia/src/gpu/effects/GrYUVtoRGBEffect.h FILE: ../../../third_party/skia/src/gpu/gradients/GrClampedGradientEffect.cpp FILE: ../../../third_party/skia/src/gpu/gradients/GrClampedGradientEffect.fp @@ -1559,6 +1565,9 @@ FILE: ../../../third_party/skia/src/gpu/gradients/GrTiledGradientEffect.h FILE: ../../../third_party/skia/src/gpu/gradients/GrTwoPointConicalGradientLayout.cpp FILE: ../../../third_party/skia/src/gpu/gradients/GrTwoPointConicalGradientLayout.fp FILE: ../../../third_party/skia/src/gpu/gradients/GrTwoPointConicalGradientLayout.h +FILE: ../../../third_party/skia/src/gpu/gradients/GrUnrolledBinaryGradientColorizer.cpp +FILE: ../../../third_party/skia/src/gpu/gradients/GrUnrolledBinaryGradientColorizer.fp +FILE: ../../../third_party/skia/src/gpu/gradients/GrUnrolledBinaryGradientColorizer.h FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlBuffer.h FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlBuffer.mm FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlCopyManager.h @@ -1577,14 +1586,22 @@ FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlResourceProvider.h FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlResourceProvider.mm FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlSampler.h FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlSampler.mm +FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlStencilAttachment.h +FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlStencilAttachment.mm FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlTextureRenderTarget.h FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlTextureRenderTarget.mm FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlUniformHandler.h FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlUniformHandler.mm FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlVaryingHandler.h FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlVaryingHandler.mm +FILE: ../../../third_party/skia/src/gpu/ops/GrAAFillRRectOp.cpp +FILE: ../../../third_party/skia/src/gpu/ops/GrAAFillRRectOp.h FILE: ../../../third_party/skia/src/gpu/ops/GrClearStencilClipOp.cpp FILE: ../../../third_party/skia/src/gpu/ops/GrDebugMarkerOp.cpp +FILE: ../../../third_party/skia/src/gpu/ops/GrDrawableOp.cpp +FILE: ../../../third_party/skia/src/gpu/ops/GrDrawableOp.h +FILE: ../../../third_party/skia/src/gpu/ops/GrQuadPerEdgeAA.cpp +FILE: ../../../third_party/skia/src/gpu/ops/GrQuadPerEdgeAA.h FILE: ../../../third_party/skia/src/gpu/text/GrAtlasManager.cpp FILE: ../../../third_party/skia/src/gpu/text/GrAtlasManager.h FILE: ../../../third_party/skia/src/gpu/text/GrSDFMaskFilter.cpp @@ -1595,10 +1612,16 @@ FILE: ../../../third_party/skia/src/gpu/vk/GrVkImageLayout.h FILE: ../../../third_party/skia/src/gpu/vk/GrVkPipelineLayout.cpp FILE: ../../../third_party/skia/src/gpu/vk/GrVkPipelineLayout.h FILE: ../../../third_party/skia/src/gpu/vk/GrVkTypesPriv.cpp +FILE: ../../../third_party/skia/src/image/SkImage_GpuBase.cpp +FILE: ../../../third_party/skia/src/image/SkImage_GpuBase.h +FILE: ../../../third_party/skia/src/image/SkImage_GpuYUVA.cpp +FILE: ../../../third_party/skia/src/image/SkImage_GpuYUVA.h FILE: ../../../third_party/skia/src/image/SkImage_Lazy.h +FILE: ../../../third_party/skia/src/opts/SkBitmapProcState_opts.h FILE: ../../../third_party/skia/src/opts/SkOpts_hsw.cpp FILE: ../../../third_party/skia/src/opts/SkRasterPipeline_opts.h FILE: ../../../third_party/skia/src/pathops/SkPathOpsAsWinding.cpp +FILE: ../../../third_party/skia/src/pathops/SkPathOpsTCurve.h FILE: ../../../third_party/skia/src/pdf/SkClusterator.cpp FILE: ../../../third_party/skia/src/pdf/SkClusterator.h FILE: ../../../third_party/skia/src/pdf/SkPDFTag.cpp @@ -1613,9 +1636,11 @@ FILE: ../../../third_party/skia/src/sksl/SkSLPipelineStageCodeGenerator.cpp FILE: ../../../third_party/skia/src/sksl/ir/SkSLAppendStage.h FILE: ../../../third_party/skia/src/sksl/ir/SkSLVariableReference.cpp FILE: ../../../third_party/skia/src/utils/Sk3D.cpp +FILE: ../../../third_party/skia/src/utils/SkAnimCodecPlayer.cpp +FILE: ../../../third_party/skia/src/utils/SkCallableTraits.h FILE: ../../../third_party/skia/src/utils/SkJSON.cpp FILE: ../../../third_party/skia/src/utils/SkJSON.h -FILE: ../../../third_party/skia/src/utils/SkTextOnPath.cpp +FILE: ../../../third_party/skia/src/utils/SkTextUtils.cpp FILE: ../../../third_party/skia/src/utils/mac/SkUniqueCFRef.h FILE: ../../../third_party/skia/src/utils/win/SkDWriteNTDDI_VERSION.h FILE: ../../../third_party/skia/third_party/skcms/skcms.cc @@ -1625,6 +1650,7 @@ FILE: ../../../third_party/skia/third_party/skcms/src/Transform_inl.h FILE: ../../../third_party/skia/third_party/vulkan/SkiaVulkan.h FILE: ../../../third_party/skia/third_party/vulkanmemoryallocator/GrVulkanMemoryAllocator.cpp FILE: ../../../third_party/skia/third_party/vulkanmemoryallocator/GrVulkanMemoryAllocator.h +FILE: ../../../third_party/skia/third_party/wuffs/wuffs.c ---------------------------------------------------------------------------------------------------- Copyright 2018 Google Inc. @@ -1967,10 +1993,12 @@ FILE: ../../../third_party/skia/animations/text#1.xml FILE: ../../../third_party/skia/bench/microbench.json FILE: ../../../third_party/skia/bench/skpbench.json FILE: ../../../third_party/skia/docker/skia-release/Dockerfile +FILE: ../../../third_party/skia/docker/skia-wasm-release/Dockerfile FILE: ../../../third_party/skia/docker/skia-with-swift-shader-base/Dockerfile FILE: ../../../third_party/skia/docker/skia-with-swift-shader-base/build-with-swift-shader-and-run FILE: ../../../third_party/skia/docs/SkAutoCanvasRestore_Reference.bmh FILE: ../../../third_party/skia/docs/SkBitmap_Reference.bmh +FILE: ../../../third_party/skia/docs/SkBlendMode_Overview.bmh FILE: ../../../third_party/skia/docs/SkBlendMode_Reference.bmh FILE: ../../../third_party/skia/docs/SkCanvas_Reference.bmh FILE: ../../../third_party/skia/docs/SkColor4f_Reference.bmh @@ -1985,6 +2013,7 @@ FILE: ../../../third_party/skia/docs/SkImage_Reference.bmh FILE: ../../../third_party/skia/docs/SkMatrix_Reference.bmh FILE: ../../../third_party/skia/docs/SkMemoryStream_Reference.bmh FILE: ../../../third_party/skia/docs/SkPaint_Reference.bmh +FILE: ../../../third_party/skia/docs/SkPath_Overview.bmh FILE: ../../../third_party/skia/docs/SkPath_Reference.bmh FILE: ../../../third_party/skia/docs/SkPicture_Reference.bmh FILE: ../../../third_party/skia/docs/SkPixmap_Reference.bmh @@ -2003,10 +2032,23 @@ FILE: ../../../third_party/skia/docs/overview.bmh FILE: ../../../third_party/skia/docs/status.json FILE: ../../../third_party/skia/docs/undocumented.bmh FILE: ../../../third_party/skia/docs/usingBookmaker.bmh -FILE: ../../../third_party/skia/experimental/canvaskit/canvas-kit/example.html +FILE: ../../../third_party/skia/experimental/canvaskit/canvaskit/example.html +FILE: ../../../third_party/skia/experimental/canvaskit/canvaskit/node.example.js +FILE: ../../../third_party/skia/experimental/canvaskit/canvaskit/package.json +FILE: ../../../third_party/skia/experimental/canvaskit/cpu.js FILE: ../../../third_party/skia/experimental/canvaskit/externs.js +FILE: ../../../third_party/skia/experimental/canvaskit/gpu.js FILE: ../../../third_party/skia/experimental/canvaskit/helper.js +FILE: ../../../third_party/skia/experimental/canvaskit/htmlcanvas/canvas2d.js FILE: ../../../third_party/skia/experimental/canvaskit/interface.js +FILE: ../../../third_party/skia/experimental/canvaskit/karma.bench.conf.js +FILE: ../../../third_party/skia/experimental/canvaskit/karma.conf.js +FILE: ../../../third_party/skia/experimental/canvaskit/package.json +FILE: ../../../third_party/skia/experimental/canvaskit/perf/animation.bench.js +FILE: ../../../third_party/skia/experimental/canvaskit/perf/assets/confetti.json +FILE: ../../../third_party/skia/experimental/canvaskit/perf/assets/drinks.json +FILE: ../../../third_party/skia/experimental/canvaskit/perf/assets/lego_loader.json +FILE: ../../../third_party/skia/experimental/canvaskit/perf/assets/onboarding.json FILE: ../../../third_party/skia/experimental/docs/animationCommon.js FILE: ../../../third_party/skia/experimental/docs/backend.js FILE: ../../../third_party/skia/experimental/docs/canvasBackend.js @@ -2023,6 +2065,7 @@ FILE: ../../../third_party/skia/infra/bots/assets/android_ndk_linux/VERSION FILE: ../../../third_party/skia/infra/bots/assets/android_ndk_windows/VERSION FILE: ../../../third_party/skia/infra/bots/assets/android_sdk_linux/VERSION FILE: ../../../third_party/skia/infra/bots/assets/armhf_sysroot/VERSION +FILE: ../../../third_party/skia/infra/bots/assets/bloaty/VERSION FILE: ../../../third_party/skia/infra/bots/assets/cast_toolchain/VERSION FILE: ../../../third_party/skia/infra/bots/assets/chromebook_arm_gles/VERSION FILE: ../../../third_party/skia/infra/bots/assets/chromebook_x86_64_gles/VERSION @@ -2054,8 +2097,6 @@ FILE: ../../../third_party/skia/infra/bots/assets/win_toolchain_2015/VERSION FILE: ../../../third_party/skia/infra/bots/assets/win_vulkan_sdk/VERSION FILE: ../../../third_party/skia/infra/bots/calmbench.isolate FILE: ../../../third_party/skia/infra/bots/cfg.json -FILE: ../../../third_party/skia/infra/bots/ct/blacklists/get_images_from_skps_100k_c37e844a6f8708-eee762104c75bd.json -FILE: ../../../third_party/skia/infra/bots/ct/blacklists/get_images_from_skps_100k_fad657e-276e633.json FILE: ../../../third_party/skia/infra/bots/empty.isolate FILE: ../../../third_party/skia/infra/bots/infrabots.isolate FILE: ../../../third_party/skia/infra/bots/ios_bin.isolate @@ -2064,11 +2105,11 @@ FILE: ../../../third_party/skia/infra/bots/isolate_gcloud_linux.isolate FILE: ../../../third_party/skia/infra/bots/isolate_go.isolate FILE: ../../../third_party/skia/infra/bots/jobs.json FILE: ../../../third_party/skia/infra/bots/perf_skia_bundled.isolate -FILE: ../../../third_party/skia/infra/bots/recipe_modules/binary_size/examples/full.expected/binary_size.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-arm-Release-Android_API26.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-arm-Release-Android_ASAN.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-arm-Release-Chromebook_GLES.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-universal-devrel-Android_SKQP.json +FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-arm-Release-Flutter_Android.json +FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86-devrel-Android_SKQP.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Debug-Chromebook_GLES.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Debug-Coverage.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Debug-MSAN.json @@ -2077,19 +2118,19 @@ FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.ex FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Debug-SafeStack.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Release-ASAN.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Release-Fast.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Release-Mini.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Release-NoDEPS.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Release-Static.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Release-SwiftShader.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Release-Vulkan.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-EMCC-asmjs-Debug-PathKit.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-EMCC-asmjs-Release-PathKit.json +FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-EMCC-wasm-Debug-CanvasKit.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-EMCC-wasm-Debug-PathKit.json +FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-EMCC-wasm-Release-CanvasKit_CPU.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-EMCC-wasm-Release-PathKit.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-GCC-arm-Release-Chromecast.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-GCC-loongson3a-Release.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-GCC-x86_64-Release-ANGLE.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-GCC-x86_64-Release-Flutter_Android.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-GCC-x86_64-Release-NoGPU.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-GCC-x86_64-Release-Shared.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Mac-Clang-arm64-Debug-Android_Vulkan.json @@ -2103,6 +2144,7 @@ FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.ex FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Win-Clang-x86_64-Debug-OpenCL.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Win-Clang-x86_64-Release-Vulkan.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Housekeeper-PerCommit-CheckGeneratedFiles.json +FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Test-Debian9-Clang-GCE-CPU-AVX2-universal-devrel-All-Android_SKQP.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/builder_name_schema/builder_name_schema.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/builder_name_schema/examples/full.expected/test.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full.expected/Build-Debian9-Clang-x86_64-Release-NoDEPS.json @@ -2113,8 +2155,6 @@ FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full.expected/flutter_trybot.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full.expected/parent_revision_trybot.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full.expected/trybot.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/ct/examples/full.expected/failed_gsutil.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/ct/examples/full.expected/test.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/doxygen/examples/full.expected/doxygen.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/env/examples/full.expected/test.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/Perf-Android-Clang-GalaxyS7_G930FD-GPU-MaliT880-arm64-Debug-All-Android.json @@ -2152,35 +2192,13 @@ FILE: ../../../third_party/skia/infra/bots/recipe_modules/gsutil/examples/full.e FILE: ../../../third_party/skia/infra/bots/recipe_modules/gsutil/examples/full.expected/failed_one_upload.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/gsutil/examples/full.expected/gsutil_tests.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/infra/examples/full.expected/infra_tests.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/isolate/examples/full.expected/always-use-exparchive.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/isolate/examples/full.expected/basic.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/isolate/examples/full.expected/discover.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/isolate/examples/full.expected/exparchive-batch-bmiss.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/isolate/examples/full.expected/exparchive-batch-emiss.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/isolate/examples/full.expected/exparchive-batch.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/isolate/examples/full.expected/exparchive-miss.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/isolate/examples/full.expected/exparchive-multi-miss.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/isolate/examples/full.expected/exparchive-multi.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/isolate/examples/full.expected/exparchive.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/isolate/examples/full.expected/extra.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/isolate/examples/full.expected/missing.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/isolate/examples/full.expected/none.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/run/examples/full.expected/test.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/skia_swarming/examples/full.expected/test.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/swarming/examples/full.expected/basic.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/swarming/examples/full.expected/show_isolated_out_in_collect_step.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/swarming/examples/full.expected/show_shards_in_collect_step.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/swarming/examples/full.expected/swarming_expired_new.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/swarming/examples/full.expected/swarming_expired_old.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/swarming/examples/full.expected/swarming_timeout_new.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/swarming/examples/full.expected/swarming_timeout_old.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/swarming/examples/full.expected/trybot.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/swarming_client/examples/full.expected/basic.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/vars/examples/full.expected/Build-Debian9-Clang-x86_64-Release-SKNX_NO_SIMD.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/vars/examples/full.expected/Housekeeper-Weekly-RecreateSKPs.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/vars/examples/full.expected/win_test.json FILE: ../../../third_party/skia/infra/bots/recipes/android_compile.expected/android_compile_nontrybot.json FILE: ../../../third_party/skia/infra/bots/recipes/android_compile.expected/android_compile_trybot.json +FILE: ../../../third_party/skia/infra/bots/recipes/android_compile.expected/android_compile_trybot_failure.json FILE: ../../../third_party/skia/infra/bots/recipes/bookmaker.expected/nightly_bookmaker.json FILE: ../../../third_party/skia/infra/bots/recipes/bookmaker.expected/nightly_failed_extract_fiddles.json FILE: ../../../third_party/skia/infra/bots/recipes/bookmaker.expected/nightly_failed_fiddlecli.json @@ -2197,21 +2215,9 @@ FILE: ../../../third_party/skia/infra/bots/recipes/compile.expected/Build-Debian FILE: ../../../third_party/skia/infra/bots/recipes/compile.expected/Build-Debian9-GCC-x86_64-Release-Flutter_Android.json FILE: ../../../third_party/skia/infra/bots/recipes/compile.expected/Build-Mac-Clang-x86_64-Debug-CommandBuffer.json FILE: ../../../third_party/skia/infra/bots/recipes/compile.expected/Build-Win-Clang-x86-Debug.json +FILE: ../../../third_party/skia/infra/bots/recipes/compute_buildstats.expected/normal_bot.json +FILE: ../../../third_party/skia/infra/bots/recipes/compute_buildstats.expected/trybot.json FILE: ../../../third_party/skia/infra/bots/recipes/compute_test.expected/Test-Debian9-Clang-NUC7i5BNK-GPU-IntelIris640-x86_64-Debug-All-OpenCL.json -FILE: ../../../third_party/skia/infra/bots/recipes/ct_skps.expected/CT_10k_SKPs_UnknownBuilder.json -FILE: ../../../third_party/skia/infra/bots/recipes/ct_skps.expected/CT_CPU_BENCH_10k_SKPs.json -FILE: ../../../third_party/skia/infra/bots/recipes/ct_skps.expected/CT_DM_100k_SKPs.json -FILE: ../../../third_party/skia/infra/bots/recipes/ct_skps.expected/CT_DM_10k_SKPs.json -FILE: ../../../third_party/skia/infra/bots/recipes/ct_skps.expected/CT_DM_10k_SKPs_Trybot.json -FILE: ../../../third_party/skia/infra/bots/recipes/ct_skps.expected/CT_DM_1m_SKPs.json -FILE: ../../../third_party/skia/infra/bots/recipes/ct_skps.expected/CT_DM_1m_SKPs_2slaves_failure.json -FILE: ../../../third_party/skia/infra/bots/recipes/ct_skps.expected/CT_DM_1m_SKPs_slave3_failure.json -FILE: ../../../third_party/skia/infra/bots/recipes/ct_skps.expected/CT_DM_SKPs_UnknownBuilder.json -FILE: ../../../third_party/skia/infra/bots/recipes/ct_skps.expected/CT_GPU_BENCH_10k_SKPs.json -FILE: ../../../third_party/skia/infra/bots/recipes/ct_skps.expected/CT_GPU_BENCH_1k_SKPs.json -FILE: ../../../third_party/skia/infra/bots/recipes/ct_skps.expected/CT_IMG_DECODE_100k_SKPs.json -FILE: ../../../third_party/skia/infra/bots/recipes/ct_skps.expected/CT_IMG_DECODE_10k_SKPs.json -FILE: ../../../third_party/skia/infra/bots/recipes/ct_skps.expected/CT_IMG_DECODE_10k_SKPs_Trybot.json FILE: ../../../third_party/skia/infra/bots/recipes/housekeeper.expected/Housekeeper-PerCommit-Trybot.json FILE: ../../../third_party/skia/infra/bots/recipes/housekeeper.expected/Housekeeper-PerCommit.json FILE: ../../../third_party/skia/infra/bots/recipes/infra.expected/infra_tests.json @@ -2229,10 +2235,13 @@ FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Mac-Clang- FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Mac-Clang-MacMini7.1-GPU-IntelIris5100-x86_64-Release-All-CommandBuffer.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Ubuntu17-GCC-Golo-GPU-QuadroP400-x86_64-Release-All-Valgrind_AbandonGpuContext_SK_CPU_LIMIT_SSE41.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-ANGLE.json -FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Win10-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Release-All-ANGLE.json -FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Win10-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Release-All-Vulkan.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-iOS-Clang-iPadPro-GPU-PowerVRGT7800-arm64-Release-All.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/trybot.json +FILE: ../../../third_party/skia/infra/bots/recipes/perf_canvaskit.expected/Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-CanvasKit.json +FILE: ../../../third_party/skia/infra/bots/recipes/perf_canvaskit.expected/pathkit_trybot.json +FILE: ../../../third_party/skia/infra/bots/recipes/perf_pathkit.expected/Perf-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Release-All-PathKit.json +FILE: ../../../third_party/skia/infra/bots/recipes/perf_pathkit.expected/Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-PathKit.json +FILE: ../../../third_party/skia/infra/bots/recipes/perf_pathkit.expected/pathkit_trybot.json FILE: ../../../third_party/skia/infra/bots/recipes/recreate_skps.expected/Housekeeper-Nightly-RecreateSKPs_Canary.json FILE: ../../../third_party/skia/infra/bots/recipes/recreate_skps.expected/Housekeeper-Weekly-RecreateSKPs.json FILE: ../../../third_party/skia/infra/bots/recipes/recreate_skps.expected/failed_upload.json @@ -2283,8 +2292,6 @@ FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clan FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-ReleaseAndAbandonGpuContext.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-NUC5i7RYH-CPU-AVX2-x86_64-Debug-All-NativeFonts_GDI.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-NUC5i7RYH-GPU-IntelIris6100-x86_64-Release-All-ANGLE.json -FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Debug-All-ANGLE.json -FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Debug-All-Vulkan.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-NUCD34010WYKH-GPU-IntelHD4400-x86_64-Release-All-ANGLE.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-ShuttleA-GPU-GTX660-x86_64-Release-All-Vulkan.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-ShuttleC-GPU-GTX960-x86_64-Debug-All-ANGLE.json @@ -2297,14 +2304,20 @@ FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/failed_get_hash FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/failed_pull.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/failed_push.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/internal_bot_2.json +FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/internal_bot_5.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/trybot.json +FILE: ../../../third_party/skia/infra/bots/recipes/test_canvaskit.expected/Test-Debian9-EMCC-GCE-GPU-WEBGL1-wasm-Debug-All-CanvasKit.json +FILE: ../../../third_party/skia/infra/bots/recipes/test_canvaskit.expected/canvaskit_trybot.json FILE: ../../../third_party/skia/infra/bots/recipes/test_lottie_web.expected/Test-Debian9-none-GCE-CPU-AVX2-x86_64-Debug-All-LottieWeb.json FILE: ../../../third_party/skia/infra/bots/recipes/test_lottie_web.expected/lottie_web_trybot.json FILE: ../../../third_party/skia/infra/bots/recipes/test_pathkit.expected/Test-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Debug-All-PathKit.json FILE: ../../../third_party/skia/infra/bots/recipes/test_pathkit.expected/Test-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Release-All-PathKit.json FILE: ../../../third_party/skia/infra/bots/recipes/test_pathkit.expected/Test-Debian9-EMCC-GCE-CPU-AVX2-wasm-Debug-All-PathKit.json FILE: ../../../third_party/skia/infra/bots/recipes/test_pathkit.expected/pathkit_trybot.json +FILE: ../../../third_party/skia/infra/bots/recipes/test_skqp_emulator.expected/Test-Debian9-Clang-GCE-CPU-Emulator-x86-devrel-All-Android_SKQP.json FILE: ../../../third_party/skia/infra/bots/recipes/update_go_deps.expected/Housekeeper-Nightly-UpdateGoDEPS.json +FILE: ../../../third_party/skia/infra/bots/recipes/upload_buildstats_results.expected/normal_bot.json +FILE: ../../../third_party/skia/infra/bots/recipes/upload_buildstats_results.expected/trybot.json FILE: ../../../third_party/skia/infra/bots/recipes/upload_calmbench_results.expected/normal_bot.json FILE: ../../../third_party/skia/infra/bots/recipes/upload_calmbench_results.expected/trybot.json FILE: ../../../third_party/skia/infra/bots/recipes/upload_dm_results.expected/alternate_bucket.json @@ -2332,14 +2345,21 @@ FILE: ../../../third_party/skia/infra/lottiecap/docker/lottie-web-puppeteer/Dock FILE: ../../../third_party/skia/infra/pathkit/docker/emsdk-base/Dockerfile FILE: ../../../third_party/skia/infra/pathkit/docker/gold-karma-chrome-tests/Dockerfile FILE: ../../../third_party/skia/infra/pathkit/docker/karma-chrome-tests/Dockerfile +FILE: ../../../third_party/skia/infra/pathkit/docker/perf-karma-chrome-tests/Dockerfile FILE: ../../../third_party/skia/infra/project-config/cr-buildbucket.cfg FILE: ../../../third_party/skia/infra/project-config/project.cfg FILE: ../../../third_party/skia/infra/project-config/refs.cfg +FILE: ../../../third_party/skia/infra/skqp/docker/android-skqp/Dockerfile FILE: ../../../third_party/skia/modules/pathkit/chaining.js FILE: ../../../third_party/skia/modules/pathkit/externs.js FILE: ../../../third_party/skia/modules/pathkit/helper.js +FILE: ../../../third_party/skia/modules/pathkit/karma.bench.conf.js FILE: ../../../third_party/skia/modules/pathkit/karma.conf.js FILE: ../../../third_party/skia/modules/pathkit/package.json +FILE: ../../../third_party/skia/modules/pathkit/perf/effects.bench.js +FILE: ../../../third_party/skia/modules/pathkit/perf/path.bench.js +FILE: ../../../third_party/skia/modules/pathkit/perf/pathops.bench.js +FILE: ../../../third_party/skia/modules/pathkit/perf/perfReporter.js FILE: ../../../third_party/skia/public.bzl FILE: ../../../third_party/skia/site/METADATA FILE: ../../../third_party/skia/site/dev/METADATA @@ -2738,8 +2758,6 @@ FILE: ../../../third_party/skia/gm/pathreverse.cpp FILE: ../../../third_party/skia/gm/points.cpp FILE: ../../../third_party/skia/gm/poly2poly.cpp FILE: ../../../third_party/skia/gm/quadpaths.cpp -FILE: ../../../third_party/skia/gm/shadertext.cpp -FILE: ../../../third_party/skia/gm/shadertext2.cpp FILE: ../../../third_party/skia/gm/shadertext3.cpp FILE: ../../../third_party/skia/gm/shadows.cpp FILE: ../../../third_party/skia/gm/strokefill.cpp @@ -2750,8 +2768,6 @@ FILE: ../../../third_party/skia/gm/texteffects.cpp FILE: ../../../third_party/skia/gm/tilemodes.cpp FILE: ../../../third_party/skia/gm/tilemodes_scaled.cpp FILE: ../../../third_party/skia/gm/tinybitmap.cpp -FILE: ../../../third_party/skia/gm/verttext.cpp -FILE: ../../../third_party/skia/gm/verttext2.cpp FILE: ../../../third_party/skia/gm/xfermodes.cpp FILE: ../../../third_party/skia/include/core/SkData.h FILE: ../../../third_party/skia/include/core/SkImageEncoder.h @@ -2834,10 +2850,6 @@ FILE: ../../../third_party/skia/src/core/SkAAClip.h FILE: ../../../third_party/skia/src/core/SkAdvancedTypefaceMetrics.h FILE: ../../../third_party/skia/src/core/SkBitmapProcState.cpp FILE: ../../../third_party/skia/src/core/SkBitmapProcState_matrix.h -FILE: ../../../third_party/skia/src/core/SkBitmapProcState_procs.h -FILE: ../../../third_party/skia/src/core/SkBitmapProcState_sample.h -FILE: ../../../third_party/skia/src/core/SkBitmapProcState_shaderproc.h -FILE: ../../../third_party/skia/src/core/SkBlitMask.h FILE: ../../../third_party/skia/src/core/SkBlitRow.h FILE: ../../../third_party/skia/src/core/SkBlitRow_D32.cpp FILE: ../../../third_party/skia/src/core/SkClipStack.cpp @@ -2918,7 +2930,6 @@ FILE: ../../../third_party/skia/src/gpu/ops/GrAAHairLinePathRenderer.h FILE: ../../../third_party/skia/src/gpu/ops/GrDefaultPathRenderer.cpp FILE: ../../../third_party/skia/src/gpu/ops/GrDefaultPathRenderer.h FILE: ../../../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp -FILE: ../../../third_party/skia/src/opts/SkBlitRow_opts_none.cpp FILE: ../../../third_party/skia/src/pdf/SkPDFConvertType1FontStream.cpp FILE: ../../../third_party/skia/src/pdf/SkPDFDevice.cpp FILE: ../../../third_party/skia/src/pdf/SkPDFDevice.h @@ -2933,7 +2944,6 @@ FILE: ../../../third_party/skia/src/pdf/SkPDFTypes.cpp FILE: ../../../third_party/skia/src/pdf/SkPDFUtils.cpp FILE: ../../../third_party/skia/src/pdf/SkPDFUtils.h FILE: ../../../third_party/skia/src/ports/SkGlobalInitialization_default.cpp -FILE: ../../../third_party/skia/src/ports/SkGlobalInitialization_default_imagefilters.cpp FILE: ../../../third_party/skia/src/ports/SkImageEncoder_WIC.cpp FILE: ../../../third_party/skia/src/ports/SkMemory_malloc.cpp FILE: ../../../third_party/skia/src/ports/SkScalerContext_win_dw.cpp @@ -3073,6 +3083,7 @@ FILE: ../../../third_party/skia/include/gpu/GrResourceKey.h FILE: ../../../third_party/skia/include/gpu/gl/GrGLAssembleInterface.h FILE: ../../../third_party/skia/include/ports/SkFontMgr_indirect.h FILE: ../../../third_party/skia/include/ports/SkRemotableFontMgr.h +FILE: ../../../third_party/skia/include/private/SkHalf.h FILE: ../../../third_party/skia/samplecode/SampleHT.cpp FILE: ../../../third_party/skia/samplecode/SampleIdentityScale.cpp FILE: ../../../third_party/skia/samplecode/SampleRectanizer.cpp @@ -3081,7 +3092,6 @@ FILE: ../../../third_party/skia/src/c/sk_surface.cpp FILE: ../../../third_party/skia/src/core/SkBBHFactory.cpp FILE: ../../../third_party/skia/src/core/SkBitmapCache.cpp FILE: ../../../third_party/skia/src/core/SkBitmapCache.h -FILE: ../../../third_party/skia/src/core/SkBlitMask_D32.cpp FILE: ../../../third_party/skia/src/core/SkCachedData.cpp FILE: ../../../third_party/skia/src/core/SkCachedData.h FILE: ../../../third_party/skia/src/core/SkCanvasPriv.h @@ -3092,7 +3102,6 @@ FILE: ../../../third_party/skia/src/core/SkDrawable.cpp FILE: ../../../third_party/skia/src/core/SkFont.cpp FILE: ../../../third_party/skia/src/core/SkForceCPlusPlusLinking.cpp FILE: ../../../third_party/skia/src/core/SkHalf.cpp -FILE: ../../../third_party/skia/src/core/SkHalf.h FILE: ../../../third_party/skia/src/core/SkImageGenerator.cpp FILE: ../../../third_party/skia/src/core/SkMaskCache.cpp FILE: ../../../third_party/skia/src/core/SkMaskCache.h @@ -3178,8 +3187,6 @@ FILE: ../../../third_party/skia/src/gpu/ops/GrSmallPathRenderer.h FILE: ../../../third_party/skia/src/image/SkReadPixelsRec.h FILE: ../../../third_party/skia/src/image/SkSurface_Gpu.h FILE: ../../../third_party/skia/src/opts/SkBitmapProcState_matrix_neon.h -FILE: ../../../third_party/skia/src/opts/SkBlitMask_opts_arm.cpp -FILE: ../../../third_party/skia/src/opts/SkBlitMask_opts_none.cpp FILE: ../../../third_party/skia/src/pathops/SkOpBuilder.cpp FILE: ../../../third_party/skia/src/pathops/SkOpSpan.cpp FILE: ../../../third_party/skia/src/pathops/SkPathOpsTSect.cpp @@ -3355,8 +3362,6 @@ FILE: ../../../third_party/skia/src/image/SkSurface.cpp FILE: ../../../third_party/skia/src/image/SkSurface_Base.h FILE: ../../../third_party/skia/src/image/SkSurface_Gpu.cpp FILE: ../../../third_party/skia/src/image/SkSurface_Raster.cpp -FILE: ../../../third_party/skia/src/opts/SkBitmapProcState_arm_neon.cpp -FILE: ../../../third_party/skia/src/opts/SkBlitRow_opts_arm_neon.h FILE: ../../../third_party/skia/src/pathops/SkAddIntersections.cpp FILE: ../../../third_party/skia/src/pathops/SkAddIntersections.h FILE: ../../../third_party/skia/src/pathops/SkDCubicLineIntersection.cpp @@ -3383,7 +3388,6 @@ FILE: ../../../third_party/skia/src/pathops/SkPathOpsCurve.h FILE: ../../../third_party/skia/src/pathops/SkPathOpsLine.cpp FILE: ../../../third_party/skia/src/pathops/SkPathOpsLine.h FILE: ../../../third_party/skia/src/pathops/SkPathOpsOp.cpp -FILE: ../../../third_party/skia/src/pathops/SkPathOpsPoint.cpp FILE: ../../../third_party/skia/src/pathops/SkPathOpsPoint.h FILE: ../../../third_party/skia/src/pathops/SkPathOpsQuad.cpp FILE: ../../../third_party/skia/src/pathops/SkPathOpsQuad.h @@ -3578,6 +3582,9 @@ FILE: ../../../third_party/skia/include/ports/SkFontMgr_empty.h FILE: ../../../third_party/skia/include/ports/SkFontMgr_fontconfig.h FILE: ../../../third_party/skia/include/private/SkAtomics.h FILE: ../../../third_party/skia/include/private/SkMutex.h +FILE: ../../../third_party/skia/include/private/SkNx.h +FILE: ../../../third_party/skia/include/private/SkNx_neon.h +FILE: ../../../third_party/skia/include/private/SkNx_sse.h FILE: ../../../third_party/skia/include/private/SkSemaphore.h FILE: ../../../third_party/skia/include/private/SkSpinlock.h FILE: ../../../third_party/skia/include/private/SkTHash.h @@ -3602,6 +3609,8 @@ FILE: ../../../third_party/skia/src/c/sk_c_from_to.h FILE: ../../../third_party/skia/src/c/sk_paint.cpp FILE: ../../../third_party/skia/src/c/sk_types_priv.h FILE: ../../../third_party/skia/src/codec/SkAndroidCodec.cpp +FILE: ../../../third_party/skia/src/codec/SkAndroidCodecAdapter.cpp +FILE: ../../../third_party/skia/src/codec/SkAndroidCodecAdapter.h FILE: ../../../third_party/skia/src/codec/SkBmpCodec.cpp FILE: ../../../third_party/skia/src/codec/SkBmpCodec.h FILE: ../../../third_party/skia/src/codec/SkBmpMaskCodec.cpp @@ -3637,8 +3646,6 @@ FILE: ../../../third_party/skia/src/codec/SkSwizzler.cpp FILE: ../../../third_party/skia/src/codec/SkSwizzler.h FILE: ../../../third_party/skia/src/codec/SkWbmpCodec.cpp FILE: ../../../third_party/skia/src/codec/SkWbmpCodec.h -FILE: ../../../third_party/skia/src/codec/SkWebpAdapterCodec.cpp -FILE: ../../../third_party/skia/src/codec/SkWebpAdapterCodec.h FILE: ../../../third_party/skia/src/codec/SkWebpCodec.cpp FILE: ../../../third_party/skia/src/codec/SkWebpCodec.h FILE: ../../../third_party/skia/src/core/Sk4px.h @@ -3656,13 +3663,11 @@ FILE: ../../../third_party/skia/src/core/SkLocalMatrixImageFilter.cpp FILE: ../../../third_party/skia/src/core/SkMiniRecorder.cpp FILE: ../../../third_party/skia/src/core/SkMiniRecorder.h FILE: ../../../third_party/skia/src/core/SkNextID.h -FILE: ../../../third_party/skia/src/core/SkNx.h FILE: ../../../third_party/skia/src/core/SkOpts.cpp FILE: ../../../third_party/skia/src/core/SkOpts.h FILE: ../../../third_party/skia/src/core/SkPathPriv.h FILE: ../../../third_party/skia/src/core/SkPictureCommon.h FILE: ../../../third_party/skia/src/core/SkPictureImageGenerator.cpp -FILE: ../../../third_party/skia/src/core/SkPictureImageGenerator.h FILE: ../../../third_party/skia/src/core/SkPixmap.cpp FILE: ../../../third_party/skia/src/core/SkPixmapPriv.h FILE: ../../../third_party/skia/src/core/SkPoint3.cpp @@ -3820,13 +3825,8 @@ FILE: ../../../third_party/skia/src/opts/Sk4px_NEON.h FILE: ../../../third_party/skia/src/opts/Sk4px_SSE2.h FILE: ../../../third_party/skia/src/opts/Sk4px_none.h FILE: ../../../third_party/skia/src/opts/SkBlitMask_opts.h -FILE: ../../../third_party/skia/src/opts/SkBlitMask_opts_arm_neon.cpp -FILE: ../../../third_party/skia/src/opts/SkBlitMask_opts_arm_neon.h FILE: ../../../third_party/skia/src/opts/SkBlitRow_opts.h FILE: ../../../third_party/skia/src/opts/SkColor_opts_neon.h -FILE: ../../../third_party/skia/src/opts/SkMorphologyImageFilter_opts.h -FILE: ../../../third_party/skia/src/opts/SkNx_neon.h -FILE: ../../../third_party/skia/src/opts/SkNx_sse.h FILE: ../../../third_party/skia/src/opts/SkOpts_sse41.cpp FILE: ../../../third_party/skia/src/opts/SkOpts_ssse3.cpp FILE: ../../../third_party/skia/src/opts/SkXfermode_opts.h @@ -3950,7 +3950,6 @@ FILE: ../../../third_party/skia/gm/dropshadowimagefilter.cpp FILE: ../../../third_party/skia/gm/dstreadshuffle.cpp FILE: ../../../third_party/skia/gm/fontcache.cpp FILE: ../../../third_party/skia/gm/fontmgr.cpp -FILE: ../../../third_party/skia/gm/gm_expectations.h FILE: ../../../third_party/skia/gm/gradientDirtyLaundry.cpp FILE: ../../../third_party/skia/gm/gradient_matrix.cpp FILE: ../../../third_party/skia/gm/gradients_no_texture.cpp @@ -4022,7 +4021,6 @@ FILE: ../../../third_party/skia/samplecode/SampleStringArt.cpp FILE: ../../../third_party/skia/samplecode/SampleUnpremul.cpp FILE: ../../../third_party/skia/src/core/SkBitmapDevice.cpp FILE: ../../../third_party/skia/src/core/SkBitmapDevice.h -FILE: ../../../third_party/skia/src/core/SkBitmapProcState_matrix_template.h FILE: ../../../third_party/skia/src/core/SkDataTable.cpp FILE: ../../../third_party/skia/src/core/SkDiscardableMemory.h FILE: ../../../third_party/skia/src/core/SkDocument.cpp @@ -4366,7 +4364,6 @@ FILE: ../../../third_party/skia/src/core/SkDrawShadowInfo.cpp FILE: ../../../third_party/skia/src/core/SkDrawShadowInfo.h FILE: ../../../third_party/skia/src/core/SkDraw_vertices.cpp FILE: ../../../third_party/skia/src/core/SkExecutor.cpp -FILE: ../../../third_party/skia/src/core/SkFDot6Constants.cpp FILE: ../../../third_party/skia/src/core/SkFontMgrPriv.h FILE: ../../../third_party/skia/src/core/SkGaussFilter.cpp FILE: ../../../third_party/skia/src/core/SkGaussFilter.h @@ -4376,7 +4373,6 @@ FILE: ../../../third_party/skia/src/core/SkMaskBlurFilter.h FILE: ../../../third_party/skia/src/core/SkRasterClipStack.h FILE: ../../../third_party/skia/src/core/SkSafeMath.h FILE: ../../../third_party/skia/src/core/SkSpriteBlitter_RGB565.cpp -FILE: ../../../third_party/skia/src/core/SkUnPreMultiplyPriv.h FILE: ../../../third_party/skia/src/core/SkVertices.cpp FILE: ../../../third_party/skia/src/core/SkVptr.h FILE: ../../../third_party/skia/src/core/SkWritePixelsRec.h @@ -4476,9 +4472,6 @@ FILE: ../../../third_party/skia/src/gpu/vk/GrVkBufferView.cpp FILE: ../../../third_party/skia/src/gpu/vk/GrVkBufferView.h FILE: ../../../third_party/skia/src/gpu/vk/GrVkSemaphore.cpp FILE: ../../../third_party/skia/src/gpu/vk/GrVkSemaphore.h -FILE: ../../../third_party/skia/src/jumper/SkJumper.cpp -FILE: ../../../third_party/skia/src/jumper/SkJumper.h -FILE: ../../../third_party/skia/src/jumper/SkJumper_misc.h FILE: ../../../third_party/skia/src/opts/SkUtils_opts.h FILE: ../../../third_party/skia/src/pdf/SkKeyedImage.cpp FILE: ../../../third_party/skia/src/pdf/SkKeyedImage.h @@ -4487,8 +4480,6 @@ FILE: ../../../third_party/skia/src/pdf/SkPDFGradientShader.h FILE: ../../../third_party/skia/src/ports/SkFontMgr_custom_directory.cpp FILE: ../../../third_party/skia/src/ports/SkFontMgr_custom_embedded.cpp FILE: ../../../third_party/skia/src/ports/SkFontMgr_custom_empty.cpp -FILE: ../../../third_party/skia/src/ports/SkGlobalInitialization_none.cpp -FILE: ../../../third_party/skia/src/ports/SkGlobalInitialization_none_imagefilters.cpp FILE: ../../../third_party/skia/src/ports/SkOSFile_ios.h FILE: ../../../third_party/skia/src/sfnt/SkOTTable_fvar.h FILE: ../../../third_party/skia/src/shaders/SkShaderBase.h @@ -4580,7 +4571,6 @@ FILE: ../../../third_party/skia/include/effects/SkMorphologyImageFilter.h FILE: ../../../third_party/skia/include/effects/SkOffsetImageFilter.h FILE: ../../../third_party/skia/src/core/SkImageFilter.cpp FILE: ../../../third_party/skia/src/core/SkUtilsArm.cpp -FILE: ../../../third_party/skia/src/core/SkUtilsArm.h FILE: ../../../third_party/skia/src/effects/imagefilters/SkColorFilterImageFilter.cpp FILE: ../../../third_party/skia/src/effects/imagefilters/SkLightingImageFilter.cpp FILE: ../../../third_party/skia/src/effects/imagefilters/SkMagnifierImageFilter.cpp @@ -4589,12 +4579,6 @@ FILE: ../../../third_party/skia/src/effects/imagefilters/SkMergeImageFilter.cpp FILE: ../../../third_party/skia/src/effects/imagefilters/SkMorphologyImageFilter.cpp FILE: ../../../third_party/skia/src/effects/imagefilters/SkOffsetImageFilter.cpp FILE: ../../../third_party/skia/src/images/SkImageEncoderFns.h -FILE: ../../../third_party/skia/src/opts/SkBitmapProcState_filter_neon.h -FILE: ../../../third_party/skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp -FILE: ../../../third_party/skia/src/opts/SkBitmapProcState_opts_SSSE3.h -FILE: ../../../third_party/skia/src/opts/SkBlitRow_opts_SSE2.cpp -FILE: ../../../third_party/skia/src/opts/SkBlitRow_opts_arm.cpp -FILE: ../../../third_party/skia/src/opts/SkBlitRow_opts_arm_neon.cpp ---------------------------------------------------------------------------------------------------- Copyright 2012 The Android Open Source Project @@ -4634,6 +4618,8 @@ FILE: ../../../third_party/skia/fuzz/FuzzEncoders.cpp FILE: ../../../third_party/skia/fuzz/FuzzPolyUtils.cpp FILE: ../../../third_party/skia/include/private/GrSkSLFPFactoryCache.h FILE: ../../../third_party/skia/modules/pathkit/pathkit_wasm_bindings.cpp +FILE: ../../../third_party/skia/src/core/SkPicture_none.cpp +FILE: ../../../third_party/skia/src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp ---------------------------------------------------------------------------------------------------- Copyright 2018 Google LLC @@ -4705,10 +4691,12 @@ ORIGIN: ../../../third_party/skia/fuzz/oss_fuzz/FuzzAPIImageFilter.cpp + ../../. TYPE: LicenseType.bsd FILE: ../../../third_party/skia/fuzz/FuzzCommon.h FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzAPIImageFilter.cpp +FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzAndroidCodec.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzAnimatedImage.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzDrawFunctions.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzGradients.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzImage.cpp +FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzIncrementalImage.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzJPEGEncoder.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzJSON.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp @@ -4716,6 +4704,7 @@ FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzNullCanvas.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzPNGEncoder.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzPathMeasure.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzPathop.cpp +FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzPolyUtils.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzWEBPEncoder.cpp @@ -4826,6 +4815,7 @@ FILE: ../../../third_party/skia/include/effects/SkDashPathEffect.h FILE: ../../../third_party/skia/include/effects/SkDiscretePathEffect.h FILE: ../../../third_party/skia/include/effects/SkGradientShader.h FILE: ../../../third_party/skia/include/effects/SkTableMaskFilter.h +FILE: ../../../third_party/skia/include/private/SkColorData.h FILE: ../../../third_party/skia/include/private/SkFixed.h FILE: ../../../third_party/skia/include/private/SkFloatingPoint.h FILE: ../../../third_party/skia/include/private/SkNoncopyable.h @@ -4854,7 +4844,6 @@ FILE: ../../../third_party/skia/src/core/SkBlurMask.h FILE: ../../../third_party/skia/src/core/SkBuffer.cpp FILE: ../../../third_party/skia/src/core/SkBuffer.h FILE: ../../../third_party/skia/src/core/SkColor.cpp -FILE: ../../../third_party/skia/src/core/SkColorData.h FILE: ../../../third_party/skia/src/core/SkColorFilter.cpp FILE: ../../../third_party/skia/src/core/SkCoreBlitters.h FILE: ../../../third_party/skia/src/core/SkDebug.cpp @@ -4866,7 +4855,6 @@ FILE: ../../../third_party/skia/src/core/SkEdge.cpp FILE: ../../../third_party/skia/src/core/SkEdge.h FILE: ../../../third_party/skia/src/core/SkEndian.h FILE: ../../../third_party/skia/src/core/SkFDot6.h -FILE: ../../../third_party/skia/src/core/SkFDot6Constants.h FILE: ../../../third_party/skia/src/core/SkGeometry.cpp FILE: ../../../third_party/skia/src/core/SkGeometry.h FILE: ../../../third_party/skia/src/core/SkGlyph.h @@ -5147,6 +5135,10 @@ LIBRARY: skia ORIGIN: ../../../third_party/skia/include/docs/SkPDFDocument.h + ../../../third_party/skia/LICENSE TYPE: LicenseType.bsd FILE: ../../../third_party/skia/include/docs/SkPDFDocument.h +FILE: ../../../third_party/skia/src/gpu/GrPathRendering_none.cpp +FILE: ../../../third_party/skia/src/pdf/SkPDFGlyphUse.h +FILE: ../../../third_party/skia/src/pdf/SkPDFSubsetFont.cpp +FILE: ../../../third_party/skia/src/pdf/SkPDFSubsetFont.h FILE: ../../../third_party/skia/src/utils/SkUTF.cpp FILE: ../../../third_party/skia/src/utils/SkUTF.h ---------------------------------------------------------------------------------------------------- @@ -5241,6 +5233,7 @@ FILE: ../../../third_party/skia/src/gpu/GrRectanizer.h FILE: ../../../third_party/skia/src/gpu/GrRectanizer_pow2.cpp FILE: ../../../third_party/skia/src/gpu/GrRenderTargetOpList.cpp FILE: ../../../third_party/skia/src/gpu/GrRenderTargetOpList.h +FILE: ../../../third_party/skia/src/gpu/GrVertexWriter.h FILE: ../../../third_party/skia/src/gpu/SkGpuDevice.h FILE: ../../../third_party/skia/src/gpu/SkGr.cpp FILE: ../../../third_party/skia/src/ports/SkDebug_win.cpp @@ -5281,7 +5274,8 @@ TYPE: LicenseType.bsd FILE: ../../../third_party/skia/include/gpu/GrDriverBugWorkaroundsAutogen.h FILE: ../../../third_party/skia/include/utils/SkTraceEventPhase.h FILE: ../../../third_party/skia/infra/lottiecap/gold/lottie-web-aggregator.go -FILE: ../../../third_party/skia/infra/pathkit/gold/pathkit_aggregator.go +FILE: ../../../third_party/skia/infra/pathkit/gold/wasm_gold_aggregator.go +FILE: ../../../third_party/skia/infra/pathkit/perf/wasm_perf_aggregator.go ---------------------------------------------------------------------------------------------------- Copyright 2018 The Chromium Authors. All rights reserved. @@ -5347,41 +5341,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== -==================================================================================================== -LIBRARY: skia -ORIGIN: ../../../third_party/skia/infra/bots/ct/ct_skps.isolate + ../../../LICENSE -TYPE: LicenseType.bsd -FILE: ../../../third_party/skia/infra/bots/ct/ct_skps.isolate ----------------------------------------------------------------------------------------------------- -Copyright (c) 2015 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - ==================================================================================================== LIBRARY: skia ORIGIN: ../../../third_party/skia/infra/bots/gen_tasks.go + ../../../LICENSE @@ -5460,7 +5419,6 @@ LIBRARY: skia ORIGIN: ../../../third_party/skia/src/codec/SkColorTable.cpp + ../../../third_party/skia/LICENSE TYPE: LicenseType.bsd FILE: ../../../third_party/skia/src/codec/SkColorTable.cpp -FILE: ../../../third_party/skia/src/core/SkBitmapProcState_filter.h FILE: ../../../third_party/skia/src/core/SkCubicClipper.cpp FILE: ../../../third_party/skia/src/core/SkCubicClipper.h FILE: ../../../third_party/skia/src/core/SkEdgeClipper.cpp @@ -5471,7 +5429,6 @@ FILE: ../../../third_party/skia/src/core/SkQuadClipper.h FILE: ../../../third_party/skia/src/images/SkImageEncoder.cpp FILE: ../../../third_party/skia/src/opts/SkBitmapProcState_opts_SSE2.cpp FILE: ../../../third_party/skia/src/opts/SkBitmapProcState_opts_SSE2.h -FILE: ../../../third_party/skia/src/opts/SkBlitRow_opts_SSE2.h FILE: ../../../third_party/skia/src/opts/opts_check_x86.cpp ---------------------------------------------------------------------------------------------------- Copyright 2009 The Android Open Source Project @@ -5688,9 +5645,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== LIBRARY: skia -ORIGIN: ../../../third_party/skia/src/core/SkFlattenablePriv.h + ../../../third_party/skia/LICENSE +ORIGIN: ../../../third_party/skia/src/core/SkGlyphRun.cpp + ../../../third_party/skia/LICENSE TYPE: LicenseType.bsd -FILE: ../../../third_party/skia/src/core/SkFlattenablePriv.h FILE: ../../../third_party/skia/src/core/SkGlyphRun.cpp FILE: ../../../third_party/skia/src/core/SkGlyphRun.h FILE: ../../../third_party/skia/src/core/SkGlyphRunPainter.cpp @@ -6060,4 +6016,4 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ==================================================================================================== -Total license count: 54 +Total license count: 53 diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index d19a9cf160cda..a06c935614ec2 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 1a325f5834d49b7daa016a4f2b01be3d +Signature: 688d05f1b8d8726e65b28a27ccc7dfcb UNUSED LICENSES: @@ -466,8 +466,19 @@ FILE: ../../../third_party/dart/third_party/observatory_pub_packages/packages/qu FILE: ../../../third_party/dart/third_party/observatory_pub_packages/packages/quiver/lib/src/time/util.dart FILE: ../../../third_party/dart/third_party/observatory_pub_packages/packages/quiver/lib/strings.dart FILE: ../../../third_party/dart/third_party/observatory_pub_packages/packages/quiver/lib/time.dart -FILE: ../../../third_party/vulkan/src/vulkan/vk_platform.h -FILE: ../../../third_party/vulkan/src/vulkan/vulkan.h +FILE: ../../../third_party/vulkan/include/vulkan/vk_platform.h +FILE: ../../../third_party/vulkan/include/vulkan/vulkan.h +FILE: ../../../third_party/vulkan/include/vulkan/vulkan_android.h +FILE: ../../../third_party/vulkan/include/vulkan/vulkan_core.h +FILE: ../../../third_party/vulkan/include/vulkan/vulkan_fuchsia.h +FILE: ../../../third_party/vulkan/include/vulkan/vulkan_ios.h +FILE: ../../../third_party/vulkan/include/vulkan/vulkan_macos.h +FILE: ../../../third_party/vulkan/include/vulkan/vulkan_vi.h +FILE: ../../../third_party/vulkan/include/vulkan/vulkan_wayland.h +FILE: ../../../third_party/vulkan/include/vulkan/vulkan_win32.h +FILE: ../../../third_party/vulkan/include/vulkan/vulkan_xcb.h +FILE: ../../../third_party/vulkan/include/vulkan/vulkan_xlib.h +FILE: ../../../third_party/vulkan/include/vulkan/vulkan_xlib_xrandr.h ---------------------------------------------------------------------------------------------------- Apache License Version 2.0, January 2004 @@ -4432,6 +4443,7 @@ ORIGIN: ../../../third_party/dart/LICENSE TYPE: LicenseType.bsd FILE: ../../../third_party/dart/.gitconfig FILE: ../../../third_party/dart/.mailmap +FILE: ../../../third_party/dart/.vpython FILE: ../../../third_party/dart/client/idea/.idea/.name FILE: ../../../third_party/dart/client/idea/.idea/inspectionProfiles/Project_Default.xml FILE: ../../../third_party/dart/client/idea/.idea/vcs.xml @@ -4493,7 +4505,6 @@ FILE: ../../../third_party/dart/runtime/bin/builtin.h FILE: ../../../third_party/dart/runtime/bin/builtin_gen_snapshot.cc FILE: ../../../third_party/dart/runtime/bin/builtin_in.cc FILE: ../../../third_party/dart/runtime/bin/builtin_natives.cc -FILE: ../../../third_party/dart/runtime/bin/builtin_nolib.cc FILE: ../../../third_party/dart/runtime/bin/common_patch.dart FILE: ../../../third_party/dart/runtime/bin/crypto.cc FILE: ../../../third_party/dart/runtime/bin/crypto.h @@ -4656,8 +4667,6 @@ FILE: ../../../third_party/dart/runtime/vm/allocation.cc FILE: ../../../third_party/dart/runtime/vm/allocation_test.cc FILE: ../../../third_party/dart/runtime/vm/assert_test.cc FILE: ../../../third_party/dart/runtime/vm/ast.h -FILE: ../../../third_party/dart/runtime/vm/ast_printer_test.cc -FILE: ../../../third_party/dart/runtime/vm/ast_test.cc FILE: ../../../third_party/dart/runtime/vm/base_isolate.h FILE: ../../../third_party/dart/runtime/vm/benchmark_test.cc FILE: ../../../third_party/dart/runtime/vm/benchmark_test.h @@ -4675,7 +4684,6 @@ FILE: ../../../third_party/dart/runtime/vm/bootstrap.cc FILE: ../../../third_party/dart/runtime/vm/bootstrap.h FILE: ../../../third_party/dart/runtime/vm/bootstrap_natives.cc FILE: ../../../third_party/dart/runtime/vm/bootstrap_natives.h -FILE: ../../../third_party/dart/runtime/vm/bootstrap_nocore.cc FILE: ../../../third_party/dart/runtime/vm/class_finalizer.h FILE: ../../../third_party/dart/runtime/vm/class_finalizer_test.cc FILE: ../../../third_party/dart/runtime/vm/class_table.cc @@ -4705,7 +4713,6 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/backend/inliner.h FILE: ../../../third_party/dart/runtime/vm/compiler/cha.cc FILE: ../../../third_party/dart/runtime/vm/compiler/cha.h FILE: ../../../third_party/dart/runtime/vm/compiler/cha_test.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/code_generator_test.cc FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/flow_graph_builder.cc FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/flow_graph_builder.h FILE: ../../../third_party/dart/runtime/vm/compiler/intrinsifier.cc @@ -5276,7 +5283,6 @@ FILE: ../../../third_party/dart/runtime/observatory/lib/src/models/objects/sourc FILE: ../../../third_party/dart/runtime/observatory/lib/src/models/objects/target.dart FILE: ../../../third_party/dart/runtime/observatory/lib/src/models/objects/thread.dart FILE: ../../../third_party/dart/runtime/observatory/lib/src/models/objects/timeline_event.dart -FILE: ../../../third_party/dart/runtime/observatory/lib/src/models/objects/token_stream.dart FILE: ../../../third_party/dart/runtime/observatory/lib/src/models/objects/type_arguments.dart FILE: ../../../third_party/dart/runtime/observatory/lib/src/models/objects/unknown.dart FILE: ../../../third_party/dart/runtime/observatory/lib/src/models/objects/vm.dart @@ -5365,7 +5371,6 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/backend/flow_graph_compiler_ FILE: ../../../third_party/dart/runtime/vm/compiler/backend/il_dbc.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/redundancy_elimination.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/redundancy_elimination.h -FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/flow_graph_builder_test.cc FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/kernel_to_il.cc FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/kernel_to_il.h @@ -5464,6 +5469,8 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/assembler/disassembler_kbc.c FILE: ../../../third_party/dart/runtime/vm/compiler/assembler/disassembler_kbc.h FILE: ../../../third_party/dart/runtime/vm/compiler/backend/code_statistics.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/code_statistics.h +FILE: ../../../third_party/dart/runtime/vm/compiler/backend/loops.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/backend/loops.h FILE: ../../../third_party/dart/runtime/vm/compiler/compiler_pass.cc FILE: ../../../third_party/dart/runtime/vm/compiler/compiler_pass.h FILE: ../../../third_party/dart/runtime/vm/compiler/compiler_state.h @@ -5542,17 +5549,12 @@ FILE: ../../../third_party/dart/runtime/lib/object.cc FILE: ../../../third_party/dart/runtime/lib/string.cc FILE: ../../../third_party/dart/runtime/platform/c99_support_win.h FILE: ../../../third_party/dart/runtime/platform/inttypes_support_win.h -FILE: ../../../third_party/dart/runtime/vm/ast.cc -FILE: ../../../third_party/dart/runtime/vm/ast_printer.cc -FILE: ../../../third_party/dart/runtime/vm/ast_printer.h FILE: ../../../third_party/dart/runtime/vm/bitfield.h FILE: ../../../third_party/dart/runtime/vm/code_patcher_ia32_test.cc FILE: ../../../third_party/dart/runtime/vm/code_patcher_x64_test.cc FILE: ../../../third_party/dart/runtime/vm/compiler/assembler/disassembler.cc FILE: ../../../third_party/dart/runtime/vm/compiler/assembler/disassembler.h FILE: ../../../third_party/dart/runtime/vm/compiler/assembler/disassembler_test.cc -FILE: ../../../third_party/dart/runtime/vm/compiler_stats.cc -FILE: ../../../third_party/dart/runtime/vm/compiler_stats.h FILE: ../../../third_party/dart/runtime/vm/cpu_ia32.cc FILE: ../../../third_party/dart/runtime/vm/custom_isolate_test.cc FILE: ../../../third_party/dart/runtime/vm/dart.h @@ -5589,7 +5591,6 @@ FILE: ../../../third_party/dart/runtime/vm/native_entry_test.cc FILE: ../../../third_party/dart/runtime/vm/native_entry_test.h FILE: ../../../third_party/dart/runtime/vm/object_store_test.cc FILE: ../../../third_party/dart/runtime/vm/os.h -FILE: ../../../third_party/dart/runtime/vm/parser_test.cc FILE: ../../../third_party/dart/runtime/vm/port.h FILE: ../../../third_party/dart/runtime/vm/resolver.cc FILE: ../../../third_party/dart/runtime/vm/resolver.h @@ -5889,7 +5890,6 @@ FILE: ../../../third_party/dart/runtime/observatory/lib/src/elements/sentinel_va FILE: ../../../third_party/dart/runtime/observatory/lib/src/elements/sentinel_view.dart FILE: ../../../third_party/dart/runtime/observatory/lib/src/elements/source_inset.dart FILE: ../../../third_party/dart/runtime/observatory/lib/src/elements/stack_trace_tree_config.dart -FILE: ../../../third_party/dart/runtime/observatory/lib/src/elements/token_stream_ref.dart FILE: ../../../third_party/dart/runtime/observatory/lib/src/elements/type_arguments_ref.dart FILE: ../../../third_party/dart/runtime/observatory/lib/src/elements/unknown_ref.dart FILE: ../../../third_party/dart/runtime/observatory/lib/src/elements/vm_view.dart @@ -6194,8 +6194,6 @@ FILE: ../../../third_party/dart/runtime/platform/math.h FILE: ../../../third_party/dart/runtime/platform/memory_sanitizer.h FILE: ../../../third_party/dart/runtime/platform/safe_stack.h FILE: ../../../third_party/dart/runtime/tools/verbose_gc_to_bmu.dart -FILE: ../../../third_party/dart/runtime/vm/ast_transformer.cc -FILE: ../../../third_party/dart/runtime/vm/ast_transformer.h FILE: ../../../third_party/dart/runtime/vm/bit_set_test.cc FILE: ../../../third_party/dart/runtime/vm/code_patcher_arm64.cc FILE: ../../../third_party/dart/runtime/vm/code_patcher_arm64_test.cc @@ -7724,16 +7722,19 @@ FILE: ../../../third_party/harfbuzz/.editorconfig FILE: ../../../third_party/harfbuzz/THANKS FILE: ../../../third_party/harfbuzz/TODO FILE: ../../../third_party/harfbuzz/appveyor.yml +FILE: ../../../third_party/harfbuzz/azure-pipelines.yml FILE: ../../../third_party/harfbuzz/docs/HarfBuzz.png FILE: ../../../third_party/harfbuzz/docs/HarfBuzz.svg FILE: ../../../third_party/harfbuzz/docs/harfbuzz-docs.xml FILE: ../../../third_party/harfbuzz/docs/usermanual-buffers-language-script-and-direction.xml FILE: ../../../third_party/harfbuzz/docs/usermanual-clusters.xml FILE: ../../../third_party/harfbuzz/docs/usermanual-fonts-and-faces.xml +FILE: ../../../third_party/harfbuzz/docs/usermanual-getting-started.xml FILE: ../../../third_party/harfbuzz/docs/usermanual-glyph-information.xml FILE: ../../../third_party/harfbuzz/docs/usermanual-hello-harfbuzz.xml FILE: ../../../third_party/harfbuzz/docs/usermanual-install-harfbuzz.xml FILE: ../../../third_party/harfbuzz/docs/usermanual-opentype-features.xml +FILE: ../../../third_party/harfbuzz/docs/usermanual-shaping-concepts.xml FILE: ../../../third_party/harfbuzz/docs/usermanual-what-is-harfbuzz.xml FILE: ../../../third_party/harfbuzz/docs/version.xml.in FILE: ../../../third_party/harfbuzz/harfbuzz.doap @@ -7746,6 +7747,9 @@ FILE: ../../../third_party/harfbuzz/src/harfbuzz.pc.in FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-arabic-table.hh FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-indic-table.cc FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-use-table.cc +FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-vowel-constraints.cc +FILE: ../../../third_party/harfbuzz/src/hb-ot-tag-table.hh +FILE: ../../../third_party/harfbuzz/src/hb-unicode-emoji-table.hh ---------------------------------------------------------------------------------------------------- HarfBuzz is licensed under the so-called "Old MIT" license. Details follow. For parts of HarfBuzz that are licensed under different licenses see individual @@ -7828,23 +7832,37 @@ FILE: ../../../third_party/harfbuzz/src/dump-indic-data.cc FILE: ../../../third_party/harfbuzz/src/dump-khmer-data.cc FILE: ../../../third_party/harfbuzz/src/dump-myanmar-data.cc FILE: ../../../third_party/harfbuzz/src/dump-use-data.cc +FILE: ../../../third_party/harfbuzz/src/hb-aat-map.hh FILE: ../../../third_party/harfbuzz/src/hb-iter-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-iter.hh FILE: ../../../third_party/harfbuzz/src/hb-map-private.hh FILE: ../../../third_party/harfbuzz/src/hb-map.cc FILE: ../../../third_party/harfbuzz/src/hb-map.h +FILE: ../../../third_party/harfbuzz/src/hb-map.hh +FILE: ../../../third_party/harfbuzz/src/hb-null.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-face.cc FILE: ../../../third_party/harfbuzz/src/hb-ot-hdmx-table.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-name-language.cc +FILE: ../../../third_party/harfbuzz/src/hb-ot-name-language.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-name.cc FILE: ../../../third_party/harfbuzz/src/hb-ot-os2-unicode-ranges.hh FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-khmer-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-khmer.hh FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-myanmar-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-myanmar.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-vowel-constraints.hh FILE: ../../../third_party/harfbuzz/src/hb-static.cc FILE: ../../../third_party/harfbuzz/src/hb-subset-glyf.cc FILE: ../../../third_party/harfbuzz/src/hb-subset-glyf.hh FILE: ../../../third_party/harfbuzz/src/hb-subset-input.cc +FILE: ../../../third_party/harfbuzz/src/hb-subset-input.hh FILE: ../../../third_party/harfbuzz/src/hb-subset-plan.cc FILE: ../../../third_party/harfbuzz/src/hb-subset-plan.hh FILE: ../../../third_party/harfbuzz/src/hb-subset-private.hh FILE: ../../../third_party/harfbuzz/src/hb-subset.cc FILE: ../../../third_party/harfbuzz/src/hb-subset.h +FILE: ../../../third_party/harfbuzz/src/hb-subset.hh +FILE: ../../../third_party/harfbuzz/src/test-name-table.cc FILE: ../../../third_party/harfbuzz/src/test-unicode-ranges.cc ---------------------------------------------------------------------------------------------------- Copyright © 2018 Google, Inc. @@ -7875,9 +7893,11 @@ LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-aat-layout-common-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-aat-layout-common-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-aat-layout-common.hh FILE: ../../../third_party/harfbuzz/src/hb-aat-layout-morx-table.hh FILE: ../../../third_party/harfbuzz/src/hb-aat-layout-private.hh FILE: ../../../third_party/harfbuzz/src/hb-aat-layout.cc +FILE: ../../../third_party/harfbuzz/src/hb-aat-layout.hh FILE: ../../../third_party/harfbuzz/src/hb-debug.hh FILE: ../../../third_party/harfbuzz/src/hb-dsalgs.hh FILE: ../../../third_party/harfbuzz/src/hb-ot-kern-table.hh @@ -7944,13 +7964,47 @@ ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ==================================================================================================== +==================================================================================================== +LIBRARY: harfbuzz +ORIGIN: ../../../third_party/harfbuzz/src/hb-aat-map.cc +TYPE: LicenseType.unknown +FILE: ../../../third_party/harfbuzz/src/hb-aat-map.cc +FILE: ../../../third_party/harfbuzz/src/hb-ot-map.cc +---------------------------------------------------------------------------------------------------- +Copyright © 2009,2010 Red Hat, Inc. +Copyright © 2010,2011,2013 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +==================================================================================================== + ==================================================================================================== LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-atomic-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-atomic-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-atomic.hh FILE: ../../../third_party/harfbuzz/src/hb-mutex-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-mutex.hh FILE: ../../../third_party/harfbuzz/src/hb-object-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-object.hh ---------------------------------------------------------------------------------------------------- Copyright © 2007 Chris Wilson Copyright © 2009,2010 Red Hat, Inc. @@ -7982,6 +8036,7 @@ LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-blob-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-blob-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-blob.hh ---------------------------------------------------------------------------------------------------- Copyright © 2009 Red Hat, Inc. Copyright © 2018 Google, Inc. @@ -8113,6 +8168,7 @@ ORIGIN: ../../../third_party/harfbuzz/src/hb-buffer-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-buffer-private.hh FILE: ../../../third_party/harfbuzz/src/hb-buffer.cc +FILE: ../../../third_party/harfbuzz/src/hb-buffer.hh ---------------------------------------------------------------------------------------------------- Copyright © 1998-2004 David Turner and Werner Lemberg Copyright © 2004,2007,2009,2010 Red Hat, Inc. @@ -8199,6 +8255,57 @@ ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ==================================================================================================== +==================================================================================================== +LIBRARY: harfbuzz +ORIGIN: ../../../third_party/harfbuzz/src/hb-cache.hh +TYPE: LicenseType.unknown +FILE: ../../../third_party/harfbuzz/src/hb-cache.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-arabic-fallback.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-indic-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-indic.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-fallback-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-fallback.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-normalize-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-normalize.hh +FILE: ../../../third_party/harfbuzz/src/hb-set-digest-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-set-digest.hh +FILE: ../../../third_party/harfbuzz/src/hb-set.cc +FILE: ../../../third_party/harfbuzz/src/hb-set.h +FILE: ../../../third_party/harfbuzz/src/hb-shape-plan-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-shape-plan.cc +FILE: ../../../third_party/harfbuzz/src/hb-shape-plan.h +FILE: ../../../third_party/harfbuzz/src/hb-shape-plan.hh +FILE: ../../../third_party/harfbuzz/src/hb-shaper-impl-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-shaper-impl.hh +FILE: ../../../third_party/harfbuzz/src/hb-shaper-list.hh +FILE: ../../../third_party/harfbuzz/src/hb-shaper-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-shaper.cc +FILE: ../../../third_party/harfbuzz/src/hb-shaper.hh +FILE: ../../../third_party/harfbuzz/src/hb-warning.cc +---------------------------------------------------------------------------------------------------- +Copyright © 2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +==================================================================================================== + ==================================================================================================== LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-common.cc @@ -8235,6 +8342,7 @@ ORIGIN: ../../../third_party/harfbuzz/src/hb-common.h TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-common.h FILE: ../../../third_party/harfbuzz/src/hb-private.hh +FILE: ../../../third_party/harfbuzz/src/hb.hh ---------------------------------------------------------------------------------------------------- Copyright © 2007,2008,2009 Red Hat, Inc. Copyright © 2011,2012 Google, Inc. @@ -8382,7 +8490,9 @@ LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-face-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-face-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-face.hh FILE: ../../../third_party/harfbuzz/src/hb-font-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-font.hh FILE: ../../../third_party/harfbuzz/src/hb-glib.cc FILE: ../../../third_party/harfbuzz/src/hb-glib.h FILE: ../../../third_party/harfbuzz/src/hb-icu.h @@ -8639,6 +8749,7 @@ LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-machinery-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-machinery-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-machinery.hh ---------------------------------------------------------------------------------------------------- Copyright © 2007,2008,2009,2010 Red Hat, Inc. Copyright © 2012,2018 Google, Inc. @@ -8669,6 +8780,7 @@ LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-open-file-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-open-file-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-open-file.hh ---------------------------------------------------------------------------------------------------- Copyright © 2007,2008,2009 Red Hat, Inc. Copyright © 2012 Google, Inc. @@ -8699,6 +8811,7 @@ LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-open-type-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-open-type-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-open-type.hh ---------------------------------------------------------------------------------------------------- Copyright © 2007,2008,2009,2010 Red Hat, Inc. Copyright © 2012 Google, Inc. @@ -8816,6 +8929,69 @@ ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ==================================================================================================== +==================================================================================================== +LIBRARY: harfbuzz +ORIGIN: ../../../third_party/harfbuzz/src/hb-ot-color.h +TYPE: LicenseType.unknown +FILE: ../../../third_party/harfbuzz/src/hb-ot-color.h +---------------------------------------------------------------------------------------------------- +Copyright © 2016 Google, Inc. +Copyright © 2018 Khaled Hosny +Copyright © 2018 Ebrahim Byagowi + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +==================================================================================================== + +==================================================================================================== +LIBRARY: harfbuzz +ORIGIN: ../../../third_party/harfbuzz/src/hb-ot-face.hh +TYPE: LicenseType.unknown +FILE: ../../../third_party/harfbuzz/src/hb-ot-face.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-layout-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-layout.hh +---------------------------------------------------------------------------------------------------- +Copyright © 2007,2008,2009 Red Hat, Inc. +Copyright © 2012,2013 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +==================================================================================================== + ==================================================================================================== LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-ot-font.cc @@ -8982,6 +9158,7 @@ LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-ot-layout-common-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-ot-layout-common-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-layout-common.hh ---------------------------------------------------------------------------------------------------- Copyright © 2007,2008,2009 Red Hat, Inc. Copyright © 2010,2012 Google, Inc. @@ -9073,6 +9250,7 @@ LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-ot-layout-gsubgpos-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-ot-layout-gsubgpos-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-layout-gsubgpos.hh ---------------------------------------------------------------------------------------------------- Copyright © 2007,2008,2009,2010 Red Hat, Inc. Copyright © 2010,2012 Google, Inc. @@ -9098,36 +9276,6 @@ ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ==================================================================================================== -==================================================================================================== -LIBRARY: harfbuzz -ORIGIN: ../../../third_party/harfbuzz/src/hb-ot-layout-private.hh -TYPE: LicenseType.unknown -FILE: ../../../third_party/harfbuzz/src/hb-ot-layout-private.hh ----------------------------------------------------------------------------------------------------- -Copyright © 2007,2008,2009 Red Hat, Inc. -Copyright © 2012,2013 Google, Inc. - - This is part of HarfBuzz, a text shaping library. - -Permission is hereby granted, without written agreement and without -license or royalty fees, to use, copy, modify, and distribute this -software and its documentation for any purpose, provided that the -above copyright notice and the following two paragraphs appear in -all copies of this software. - -IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR -DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES -ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN -IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. - -THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS -ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO -PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -==================================================================================================== - ==================================================================================================== LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-ot-layout.cc @@ -9195,6 +9343,7 @@ LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-ot-map-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-ot-map-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-map.hh ---------------------------------------------------------------------------------------------------- Copyright © 2009,2010 Red Hat, Inc. Copyright © 2010,2011,2012,2013 Google, Inc. @@ -9220,36 +9369,6 @@ ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ==================================================================================================== -==================================================================================================== -LIBRARY: harfbuzz -ORIGIN: ../../../third_party/harfbuzz/src/hb-ot-map.cc -TYPE: LicenseType.unknown -FILE: ../../../third_party/harfbuzz/src/hb-ot-map.cc ----------------------------------------------------------------------------------------------------- -Copyright © 2009,2010 Red Hat, Inc. -Copyright © 2010,2011,2013 Google, Inc. - - This is part of HarfBuzz, a text shaping library. - -Permission is hereby granted, without written agreement and without -license or royalty fees, to use, copy, modify, and distribute this -software and its documentation for any purpose, provided that the -above copyright notice and the following two paragraphs appear in -all copies of this software. - -IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR -DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES -ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN -IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. - -THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS -ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO -PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -==================================================================================================== - ==================================================================================================== LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-ot-math-table.hh @@ -9283,25 +9402,11 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ==================================================================================================== LIBRARY: harfbuzz -ORIGIN: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-arabic-fallback.hh +ORIGIN: ../../../third_party/harfbuzz/src/hb-ot-name.h TYPE: LicenseType.unknown -FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-arabic-fallback.hh -FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-indic-private.hh -FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-fallback-private.hh -FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-normalize-private.hh -FILE: ../../../third_party/harfbuzz/src/hb-set-digest-private.hh -FILE: ../../../third_party/harfbuzz/src/hb-set.cc -FILE: ../../../third_party/harfbuzz/src/hb-set.h -FILE: ../../../third_party/harfbuzz/src/hb-shape-plan-private.hh -FILE: ../../../third_party/harfbuzz/src/hb-shape-plan.cc -FILE: ../../../third_party/harfbuzz/src/hb-shape-plan.h -FILE: ../../../third_party/harfbuzz/src/hb-shaper-impl-private.hh -FILE: ../../../third_party/harfbuzz/src/hb-shaper-list.hh -FILE: ../../../third_party/harfbuzz/src/hb-shaper-private.hh -FILE: ../../../third_party/harfbuzz/src/hb-shaper.cc -FILE: ../../../third_party/harfbuzz/src/hb-warning.cc +FILE: ../../../third_party/harfbuzz/src/hb-ot-name.h ---------------------------------------------------------------------------------------------------- -Copyright © 2012 Google, Inc. +Copyright © 2018 Ebrahim Byagowi. This is part of HarfBuzz, a text shaping library. @@ -9329,10 +9434,12 @@ LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-arabic-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-arabic-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-arabic.hh FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-use-machine.hh FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-use-machine.rl FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-use-private.hh FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-use.cc +FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-use.hh ---------------------------------------------------------------------------------------------------- Copyright © 2015 Mozilla Foundation. Copyright © 2015 Google, Inc. @@ -9426,6 +9533,7 @@ LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-complex.hh ---------------------------------------------------------------------------------------------------- Copyright © 2010,2011,2012 Google, Inc. @@ -9455,6 +9563,7 @@ LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-ot-shape-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-ot-shape-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-ot-shape.hh ---------------------------------------------------------------------------------------------------- Copyright © 2010 Google, Inc. @@ -9538,11 +9647,41 @@ ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ==================================================================================================== +==================================================================================================== +LIBRARY: harfbuzz +ORIGIN: ../../../third_party/harfbuzz/src/hb-ot-vorg-table.hh +TYPE: LicenseType.unknown +FILE: ../../../third_party/harfbuzz/src/hb-ot-vorg-table.hh +---------------------------------------------------------------------------------------------------- +Copyright © 2018 Adobe Systems Incorporated. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +==================================================================================================== + ==================================================================================================== LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-set-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-set-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-set.hh ---------------------------------------------------------------------------------------------------- Copyright © 2012,2017 Google, Inc. @@ -9618,6 +9757,7 @@ ORIGIN: ../../../third_party/harfbuzz/src/hb-unicode-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-unicode-private.hh FILE: ../../../third_party/harfbuzz/src/hb-unicode.cc +FILE: ../../../third_party/harfbuzz/src/hb-unicode.hh ---------------------------------------------------------------------------------------------------- Copyright © 2009 Red Hat, Inc. Copyright © 2011 Codethink Limited @@ -9680,6 +9820,7 @@ LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/hb-utf-private.hh TYPE: LicenseType.unknown FILE: ../../../third_party/harfbuzz/src/hb-utf-private.hh +FILE: ../../../third_party/harfbuzz/src/hb-utf.hh ---------------------------------------------------------------------------------------------------- Copyright © 2011,2012,2014 Google, Inc. @@ -9704,6 +9845,35 @@ ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ==================================================================================================== +==================================================================================================== +LIBRARY: harfbuzz +ORIGIN: ../../../third_party/harfbuzz/src/hb-vector.hh +TYPE: LicenseType.unknown +FILE: ../../../third_party/harfbuzz/src/hb-vector.hh +---------------------------------------------------------------------------------------------------- +Copyright © 2017,2018 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +==================================================================================================== + ==================================================================================================== LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/test-buffer-serialize.cc @@ -9733,6 +9903,36 @@ ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ==================================================================================================== +==================================================================================================== +LIBRARY: harfbuzz +ORIGIN: ../../../third_party/harfbuzz/src/test-ot-color.cc +TYPE: LicenseType.unknown +FILE: ../../../third_party/harfbuzz/src/test-ot-color.cc +---------------------------------------------------------------------------------------------------- +Copyright © 2018 Ebrahim Byagowi +Copyright © 2018 Khaled Hosny + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +==================================================================================================== + ==================================================================================================== LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/src/test-size-params.cc @@ -15995,41 +16195,42 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== LIBRARY: rapidjson -ORIGIN: ../../../third_party/rapidjson/rapidjson/error/en.h +ORIGIN: ../../../third_party/rapidjson/include/rapidjson/error/en.h TYPE: LicenseType.mit -FILE: ../../../third_party/rapidjson/rapidjson/allocators.h -FILE: ../../../third_party/rapidjson/rapidjson/document.h -FILE: ../../../third_party/rapidjson/rapidjson/encodedstream.h -FILE: ../../../third_party/rapidjson/rapidjson/encodings.h -FILE: ../../../third_party/rapidjson/rapidjson/error/en.h -FILE: ../../../third_party/rapidjson/rapidjson/error/error.h -FILE: ../../../third_party/rapidjson/rapidjson/filereadstream.h -FILE: ../../../third_party/rapidjson/rapidjson/filewritestream.h -FILE: ../../../third_party/rapidjson/rapidjson/fwd.h -FILE: ../../../third_party/rapidjson/rapidjson/internal/biginteger.h -FILE: ../../../third_party/rapidjson/rapidjson/internal/diyfp.h -FILE: ../../../third_party/rapidjson/rapidjson/internal/dtoa.h -FILE: ../../../third_party/rapidjson/rapidjson/internal/ieee754.h -FILE: ../../../third_party/rapidjson/rapidjson/internal/itoa.h -FILE: ../../../third_party/rapidjson/rapidjson/internal/meta.h -FILE: ../../../third_party/rapidjson/rapidjson/internal/pow10.h -FILE: ../../../third_party/rapidjson/rapidjson/internal/regex.h -FILE: ../../../third_party/rapidjson/rapidjson/internal/stack.h -FILE: ../../../third_party/rapidjson/rapidjson/internal/strfunc.h -FILE: ../../../third_party/rapidjson/rapidjson/internal/strtod.h -FILE: ../../../third_party/rapidjson/rapidjson/internal/swap.h -FILE: ../../../third_party/rapidjson/rapidjson/istreamwrapper.h -FILE: ../../../third_party/rapidjson/rapidjson/memorybuffer.h -FILE: ../../../third_party/rapidjson/rapidjson/memorystream.h -FILE: ../../../third_party/rapidjson/rapidjson/ostreamwrapper.h -FILE: ../../../third_party/rapidjson/rapidjson/pointer.h -FILE: ../../../third_party/rapidjson/rapidjson/prettywriter.h -FILE: ../../../third_party/rapidjson/rapidjson/rapidjson.h -FILE: ../../../third_party/rapidjson/rapidjson/reader.h -FILE: ../../../third_party/rapidjson/rapidjson/schema.h -FILE: ../../../third_party/rapidjson/rapidjson/stream.h -FILE: ../../../third_party/rapidjson/rapidjson/stringbuffer.h -FILE: ../../../third_party/rapidjson/rapidjson/writer.h +FILE: ../../../third_party/rapidjson/include/rapidjson/allocators.h +FILE: ../../../third_party/rapidjson/include/rapidjson/cursorstreamwrapper.h +FILE: ../../../third_party/rapidjson/include/rapidjson/document.h +FILE: ../../../third_party/rapidjson/include/rapidjson/encodedstream.h +FILE: ../../../third_party/rapidjson/include/rapidjson/encodings.h +FILE: ../../../third_party/rapidjson/include/rapidjson/error/en.h +FILE: ../../../third_party/rapidjson/include/rapidjson/error/error.h +FILE: ../../../third_party/rapidjson/include/rapidjson/filereadstream.h +FILE: ../../../third_party/rapidjson/include/rapidjson/filewritestream.h +FILE: ../../../third_party/rapidjson/include/rapidjson/fwd.h +FILE: ../../../third_party/rapidjson/include/rapidjson/internal/biginteger.h +FILE: ../../../third_party/rapidjson/include/rapidjson/internal/diyfp.h +FILE: ../../../third_party/rapidjson/include/rapidjson/internal/dtoa.h +FILE: ../../../third_party/rapidjson/include/rapidjson/internal/ieee754.h +FILE: ../../../third_party/rapidjson/include/rapidjson/internal/itoa.h +FILE: ../../../third_party/rapidjson/include/rapidjson/internal/meta.h +FILE: ../../../third_party/rapidjson/include/rapidjson/internal/pow10.h +FILE: ../../../third_party/rapidjson/include/rapidjson/internal/regex.h +FILE: ../../../third_party/rapidjson/include/rapidjson/internal/stack.h +FILE: ../../../third_party/rapidjson/include/rapidjson/internal/strfunc.h +FILE: ../../../third_party/rapidjson/include/rapidjson/internal/strtod.h +FILE: ../../../third_party/rapidjson/include/rapidjson/internal/swap.h +FILE: ../../../third_party/rapidjson/include/rapidjson/istreamwrapper.h +FILE: ../../../third_party/rapidjson/include/rapidjson/memorybuffer.h +FILE: ../../../third_party/rapidjson/include/rapidjson/memorystream.h +FILE: ../../../third_party/rapidjson/include/rapidjson/ostreamwrapper.h +FILE: ../../../third_party/rapidjson/include/rapidjson/pointer.h +FILE: ../../../third_party/rapidjson/include/rapidjson/prettywriter.h +FILE: ../../../third_party/rapidjson/include/rapidjson/rapidjson.h +FILE: ../../../third_party/rapidjson/include/rapidjson/reader.h +FILE: ../../../third_party/rapidjson/include/rapidjson/schema.h +FILE: ../../../third_party/rapidjson/include/rapidjson/stream.h +FILE: ../../../third_party/rapidjson/include/rapidjson/stringbuffer.h +FILE: ../../../third_party/rapidjson/include/rapidjson/writer.h ---------------------------------------------------------------------------------------------------- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: @@ -16040,10 +16241,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI ==================================================================================================== LIBRARY: rapidjson -ORIGIN: ../../../third_party/rapidjson/rapidjson/msinttypes/inttypes.h +ORIGIN: ../../../third_party/rapidjson/include/rapidjson/msinttypes/inttypes.h TYPE: LicenseType.bsd -FILE: ../../../third_party/rapidjson/rapidjson/msinttypes/inttypes.h -FILE: ../../../third_party/rapidjson/rapidjson/msinttypes/stdint.h +FILE: ../../../third_party/rapidjson/include/rapidjson/msinttypes/inttypes.h +FILE: ../../../third_party/rapidjson/include/rapidjson/msinttypes/stdint.h ---------------------------------------------------------------------------------------------------- Copyright (c) 2006-2013 Alexander Chemeris @@ -17643,4 +17844,4 @@ freely, subject to the following restrictions: misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. ==================================================================================================== -Total license count: 299 +Total license count: 304 diff --git a/common/BUILD.gn b/common/BUILD.gn index c0212e3528920..b9b05073501d2 100644 --- a/common/BUILD.gn +++ b/common/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/common/config.gni b/common/config.gni index dd08c934dc22d..f81be4aac0e7a 100644 --- a/common/config.gni +++ b/common/config.gni @@ -1,4 +1,4 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/common/settings.cc b/common/settings.cc index 9aa8997ba947b..a85d69fc8596c 100644 --- a/common/settings.cc +++ b/common/settings.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,12 @@ namespace blink { +Settings::Settings() = default; + +Settings::Settings(const Settings& other) = default; + +Settings::~Settings() = default; + std::string Settings::ToString() const { std::stringstream stream; stream << "Settings: " << std::endl; diff --git a/common/settings.h b/common/settings.h index 1c0002e7ad7d6..92a8e37109ff2 100644 --- a/common/settings.h +++ b/common/settings.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -22,6 +22,12 @@ using TaskObserverAdd = using TaskObserverRemove = std::function; struct Settings { + Settings(); + + Settings(const Settings& other); + + ~Settings(); + // VM settings std::string vm_snapshot_data_path; std::string vm_snapshot_instr_path; diff --git a/common/task_runners.cc b/common/task_runners.cc index bb62c8e9c04e3..d76bc20f6ae38 100644 --- a/common/task_runners.cc +++ b/common/task_runners.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,6 +19,8 @@ TaskRunners::TaskRunners(std::string label, ui_(std::move(ui)), io_(std::move(io)) {} +TaskRunners::TaskRunners(const TaskRunners& other) = default; + TaskRunners::~TaskRunners() = default; const std::string& TaskRunners::GetLabel() const { diff --git a/common/task_runners.h b/common/task_runners.h index 642a8a158f12d..0bd0c301903ae 100644 --- a/common/task_runners.h +++ b/common/task_runners.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,6 +20,8 @@ class TaskRunners { fml::RefPtr ui, fml::RefPtr io); + TaskRunners(const TaskRunners& other); + ~TaskRunners(); const std::string& GetLabel() const; diff --git a/examples/BUILD.gn b/examples/BUILD.gn deleted file mode 100644 index 3d6d850afbcab..0000000000000 --- a/examples/BUILD.gn +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -group("examples") { - deps = [ - "hello_flutter", - "hello_flutter:hello_flutter_aot", - "spinning_square", - ] -} diff --git a/examples/hello_flutter/lib/main.dart b/examples/hello_flutter/lib/main.dart deleted file mode 100644 index 3de5584342897..0000000000000 --- a/examples/hello_flutter/lib/main.dart +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This example shows how to show the text 'Hello, world.' using using the raw -// interface to the engine. - -import 'dart:ui' as ui; - -void beginFrame(Duration timeStamp) { - final double devicePixelRatio = ui.window.devicePixelRatio; - final ui.Size physicalSize = ui.window.physicalSize; - final ui.Size logicalSize = physicalSize / devicePixelRatio; - - final ui.ParagraphBuilder paragraphBuilder = new ui.ParagraphBuilder(new ui.ParagraphStyle()) - ..addText('Hello, world.'); - final ui.Paragraph paragraph = paragraphBuilder.build() - ..layout(new ui.ParagraphConstraints(width: logicalSize.width)); - - final ui.Rect physicalBounds = ui.Offset.zero & physicalSize; - final ui.PictureRecorder recorder = new ui.PictureRecorder(); - final ui.Canvas canvas = new ui.Canvas(recorder, physicalBounds); - canvas.scale(devicePixelRatio, devicePixelRatio); - canvas.drawRect(ui.Offset.zero & logicalSize, new ui.Paint()..color = const ui.Color(0xFF0000FF)); - canvas.drawParagraph(paragraph, new ui.Offset( - (logicalSize.width - paragraph.maxIntrinsicWidth) / 2.0, - (logicalSize.height - paragraph.height) / 2.0 - )); - final ui.Picture picture = recorder.endRecording(); - - final ui.SceneBuilder sceneBuilder = new ui.SceneBuilder() - // TODO(abarth): We should be able to add a picture without pushing a - // container layer first. - ..pushClipRect(physicalBounds) - ..addPicture(ui.Offset.zero, picture) - ..pop(); - - ui.window.render(sceneBuilder.build()); -} - -// This function is the primary entry point to your application. The engine -// calls main() as soon as it has loaded your code. -void main() { - // The engine calls onBeginFrame whenever it wants us to produce a frame. - ui.window.onBeginFrame = beginFrame; - // Here we kick off the whole process by asking the engine to schedule a new - // frame. The engine will eventually call onBeginFrame when it is time for us - // to actually produce the frame. - ui.window.scheduleFrame(); -} diff --git a/examples/hello_flutter/pubspec.yaml b/examples/hello_flutter/pubspec.yaml deleted file mode 100644 index a22a6ee39a974..0000000000000 --- a/examples/hello_flutter/pubspec.yaml +++ /dev/null @@ -1,3 +0,0 @@ -# Copyright 2017 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. diff --git a/examples/spinning_square/lib/main.dart b/examples/spinning_square/lib/main.dart deleted file mode 100644 index a6dc2099058ae..0000000000000 --- a/examples/spinning_square/lib/main.dart +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This example shows how to perform a simple animation using the raw interface -// to the engine. - -import 'dart:math' as math; -import 'dart:typed_data'; -import 'dart:ui' as ui; - -void beginFrame(Duration timeStamp) { - // The timeStamp argument to beginFrame indicates the timing information we - // should use to clock our animations. It's important to use timeStamp rather - // than reading the system time because we want all the parts of the system to - // coordinate the timings of their animations. If each component read the - // system clock independently, the animations that we processed later would be - // slightly ahead of the animations we processed earlier. - - final double devicePixelRatio = ui.window.devicePixelRatio; - - // PAINT - final ui.Size logicalSize = ui.window.physicalSize / devicePixelRatio; - final ui.Rect paintBounds = ui.Offset.zero & logicalSize; - final ui.PictureRecorder recorder = new ui.PictureRecorder(); - final ui.Canvas canvas = new ui.Canvas(recorder, paintBounds); - canvas.translate(paintBounds.width / 2.0, paintBounds.height / 2.0); - - // Here we determine the rotation according to the timeStamp given to us by - // the engine. - final double t = timeStamp.inMicroseconds / Duration.MICROSECONDS_PER_MILLISECOND / 1800.0; - canvas.rotate(math.PI * (t % 1.0)); - - canvas.drawRect(new ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0), - new ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0)); - final ui.Picture picture = recorder.endRecording(); - - // COMPOSITE - - final Float64List deviceTransform = new Float64List(16) - ..[0] = devicePixelRatio - ..[5] = devicePixelRatio - ..[10] = 1.0 - ..[15] = 1.0; - final ui.SceneBuilder sceneBuilder = new ui.SceneBuilder() - ..pushTransform(deviceTransform) - ..addPicture(ui.Offset.zero, picture) - ..pop(); - ui.window.render(sceneBuilder.build()); - - // After rendering the current frame of the animation, we ask the engine to - // schedule another frame. The engine will call beginFrame again when its time - // to produce the next frame. - ui.window.scheduleFrame(); -} - -void main() { - ui.window.onBeginFrame = beginFrame; - ui.window.scheduleFrame(); -} diff --git a/examples/spinning_square/pubspec.yaml b/examples/spinning_square/pubspec.yaml deleted file mode 100644 index a22a6ee39a974..0000000000000 --- a/examples/spinning_square/pubspec.yaml +++ /dev/null @@ -1,3 +0,0 @@ -# Copyright 2017 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. diff --git a/flow/BUILD.gn b/flow/BUILD.gn index dd4a292dd9d66..799c23caf02d3 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -8,6 +8,8 @@ source_set("flow") { "compositor_context.h", "debug_print.cc", "debug_print.h", + "embedded_views.cc", + "embedded_views.h", "instrumentation.cc", "instrumentation.h", "layers/backdrop_filter_layer.cc", @@ -34,6 +36,8 @@ source_set("flow") { "layers/physical_shape_layer.h", "layers/picture_layer.cc", "layers/picture_layer.h", + "layers/platform_view_layer.cc", + "layers/platform_view_layer.h", "layers/shader_mask_layer.cc", "layers/shader_mask_layer.h", "layers/texture_layer.cc", @@ -63,7 +67,6 @@ source_set("flow") { "$flutter_root/fml", "$flutter_root/synchronization", "//third_party/skia", - "//third_party/skia:gpu", ] if (is_fuchsia) { diff --git a/flow/compositor_context.cc b/flow/compositor_context.cc index aecd3a24cddf7..8dc6883597999 100644 --- a/flow/compositor_context.cc +++ b/flow/compositor_context.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -32,25 +32,25 @@ void CompositorContext::EndFrame(ScopedFrame& frame, std::unique_ptr CompositorContext::AcquireFrame( GrContext* gr_context, SkCanvas* canvas, + ExternalViewEmbedder* view_embedder, const SkMatrix& root_surface_transformation, bool instrumentation_enabled) { - return std::make_unique(*this, // - gr_context, // - canvas, // - root_surface_transformation, // - instrumentation_enabled // - ); + return std::make_unique(*this, gr_context, canvas, view_embedder, + root_surface_transformation, + instrumentation_enabled); } CompositorContext::ScopedFrame::ScopedFrame( CompositorContext& context, GrContext* gr_context, SkCanvas* canvas, + ExternalViewEmbedder* view_embedder, const SkMatrix& root_surface_transformation, bool instrumentation_enabled) : context_(context), gr_context_(gr_context), canvas_(canvas), + view_embedder_(view_embedder), root_surface_transformation_(root_surface_transformation), instrumentation_enabled_(instrumentation_enabled) { context_.BeginFrame(*this, instrumentation_enabled_); @@ -63,7 +63,7 @@ CompositorContext::ScopedFrame::~ScopedFrame() { bool CompositorContext::ScopedFrame::Raster(flow::LayerTree& layer_tree, bool ignore_raster_cache) { layer_tree.Preroll(*this, ignore_raster_cache); - layer_tree.Paint(*this); + layer_tree.Paint(*this, ignore_raster_cache); return true; } diff --git a/flow/compositor_context.h b/flow/compositor_context.h index 522c5359934ff..f3a885ccedd3c 100644 --- a/flow/compositor_context.h +++ b/flow/compositor_context.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,7 @@ #include #include +#include "flutter/flow/embedded_views.h" #include "flutter/flow/instrumentation.h" #include "flutter/flow/raster_cache.h" #include "flutter/flow/texture.h" @@ -26,6 +27,7 @@ class CompositorContext { ScopedFrame(CompositorContext& context, GrContext* gr_context, SkCanvas* canvas, + ExternalViewEmbedder* view_embedder, const SkMatrix& root_surface_transformation, bool instrumentation_enabled); @@ -33,6 +35,8 @@ class CompositorContext { SkCanvas* canvas() { return canvas_; } + ExternalViewEmbedder* view_embedder() { return view_embedder_; } + CompositorContext& context() const { return context_; } const SkMatrix& root_surface_transformation() const { @@ -47,6 +51,7 @@ class CompositorContext { CompositorContext& context_; GrContext* gr_context_; SkCanvas* canvas_; + ExternalViewEmbedder* view_embedder_; const SkMatrix& root_surface_transformation_; const bool instrumentation_enabled_; @@ -60,6 +65,7 @@ class CompositorContext { virtual std::unique_ptr AcquireFrame( GrContext* gr_context, SkCanvas* canvas, + ExternalViewEmbedder* view_embedder, const SkMatrix& root_surface_transformation, bool instrumentation_enabled); diff --git a/flow/debug_print.cc b/flow/debug_print.cc index e2d7fc3f4c882..a41171313540d 100644 --- a/flow/debug_print.cc +++ b/flow/debug_print.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -25,9 +25,8 @@ std::ostream& operator<<(std::ostream& os, const flow::MatrixDecomposition& m) { std::ostream& operator<<(std::ostream& os, const SkMatrix& m) { SkString string; - string.printf( - "[%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f]", - m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8]); + string.printf("[%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f]", + m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8]); os << string.c_str(); return os; } @@ -72,8 +71,9 @@ std::ostream& operator<<(std::ostream& os, const SkPoint& r) { return os; } -std::ostream& operator<<(std::ostream& os, const flow::RasterCacheKey& k) { - os << "Picture: " << k.picture_id() << " matrix: " << k.matrix(); +std::ostream& operator<<(std::ostream& os, + const flow::PictureRasterCacheKey& k) { + os << "Picture: " << k.id() << " matrix: " << k.matrix(); return os; } diff --git a/flow/debug_print.h b/flow/debug_print.h index d58dcbed28bed..34621e314ad2a 100644 --- a/flow/debug_print.h +++ b/flow/debug_print.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,7 +16,7 @@ #define DEF_PRINTER(x) std::ostream& operator<<(std::ostream&, const x&); DEF_PRINTER(flow::MatrixDecomposition); -DEF_PRINTER(flow::RasterCacheKey); +DEF_PRINTER(flow::PictureRasterCacheKey); DEF_PRINTER(SkISize); DEF_PRINTER(SkMatrix); DEF_PRINTER(SkMatrix44); diff --git a/flow/embedded_views.cc b/flow/embedded_views.cc new file mode 100644 index 0000000000000..8dc634ecdd62d --- /dev/null +++ b/flow/embedded_views.cc @@ -0,0 +1,12 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/flow/embedded_views.h" + +namespace flow { + +bool ExternalViewEmbedder::SubmitFrame(GrContext* context) { + return false; +}; +} // namespace flow diff --git a/flow/embedded_views.h b/flow/embedded_views.h new file mode 100644 index 0000000000000..6f2e684c4841e --- /dev/null +++ b/flow/embedded_views.h @@ -0,0 +1,49 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +#ifndef FLUTTER_FLOW_EMBEDDED_VIEWS_H_ +#define FLUTTER_FLOW_EMBEDDED_VIEWS_H_ + +#include + +#include "flutter/fml/memory/ref_counted.h" +#include "third_party/skia/include/core/SkCanvas.h" +#include "third_party/skia/include/core/SkPoint.h" +#include "third_party/skia/include/core/SkSize.h" + +namespace flow { + +class EmbeddedViewParams { + public: + SkPoint offsetPixels; + SkSize sizePoints; +}; + +// This is only used on iOS when running in a non headless mode, +// in this case ViewEmbedded is a reference to the +// FlutterPlatformViewsController which is owned by FlutterViewController. +class ExternalViewEmbedder { + public: + ExternalViewEmbedder() = default; + + virtual void BeginFrame(SkISize frame_size) = 0; + + virtual void PrerollCompositeEmbeddedView(int view_id) = 0; + + virtual std::vector GetCurrentCanvases() = 0; + + // Must be called on the UI thread. + virtual SkCanvas* CompositeEmbeddedView(int view_id, + const EmbeddedViewParams& params) = 0; + + virtual bool SubmitFrame(GrContext* context); + + virtual ~ExternalViewEmbedder() = default; + + FML_DISALLOW_COPY_AND_ASSIGN(ExternalViewEmbedder); +}; + +} // namespace flow + +#endif // FLUTTER_FLOW_EMBEDDED_VIEWS_H_ diff --git a/flow/export_node.cc b/flow/export_node.cc index e837f525f35c4..acf7e42da3215 100644 --- a/flow/export_node.cc +++ b/flow/export_node.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/export_node.h b/flow/export_node.h index c7a3db98aacc6..20be1e45f7bfa 100644 --- a/flow/export_node.h +++ b/flow/export_node.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/instrumentation.cc b/flow/instrumentation.cc index 3b9c95a331481..5b0f37264d7c3 100644 --- a/flow/instrumentation.cc +++ b/flow/instrumentation.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/instrumentation.h b/flow/instrumentation.h index 009786ba37cd1..eac76329ba577 100644 --- a/flow/instrumentation.h +++ b/flow/instrumentation.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/layers/backdrop_filter_layer.cc b/flow/layers/backdrop_filter_layer.cc index 27e48dc0a5966..f45c28b7d2381 100644 --- a/flow/layers/backdrop_filter_layer.cc +++ b/flow/layers/backdrop_filter_layer.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/layers/backdrop_filter_layer.h b/flow/layers/backdrop_filter_layer.h index 348afc5090b90..39bd64c33b23e 100644 --- a/flow/layers/backdrop_filter_layer.h +++ b/flow/layers/backdrop_filter_layer.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/layers/child_scene_layer.cc b/flow/layers/child_scene_layer.cc index 744aee5e87888..162a8d1a4df50 100644 --- a/flow/layers/child_scene_layer.cc +++ b/flow/layers/child_scene_layer.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/layers/child_scene_layer.h b/flow/layers/child_scene_layer.h index b52ceb28b2d4f..89fd367a0e69b 100644 --- a/flow/layers/child_scene_layer.h +++ b/flow/layers/child_scene_layer.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/layers/clip_path_layer.cc b/flow/layers/clip_path_layer.cc index 3c71823c48503..17fd4db739acf 100644 --- a/flow/layers/clip_path_layer.cc +++ b/flow/layers/clip_path_layer.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -50,14 +50,15 @@ void ClipPathLayer::Paint(PaintContext& context) const { TRACE_EVENT0("flutter", "ClipPathLayer::Paint"); FML_DCHECK(needs_painting()); - SkAutoCanvasRestore save(&context.canvas, true); - context.canvas.clipPath(clip_path_, clip_behavior_ != Clip::hardEdge); + SkAutoCanvasRestore save(context.internal_nodes_canvas, true); + context.internal_nodes_canvas->clipPath(clip_path_, + clip_behavior_ != Clip::hardEdge); if (clip_behavior_ == Clip::antiAliasWithSaveLayer) { - context.canvas.saveLayer(paint_bounds(), nullptr); + context.internal_nodes_canvas->saveLayer(paint_bounds(), nullptr); } PaintChildren(context); if (clip_behavior_ == Clip::antiAliasWithSaveLayer) { - context.canvas.restore(); + context.internal_nodes_canvas->restore(); } } diff --git a/flow/layers/clip_path_layer.h b/flow/layers/clip_path_layer.h index 33b043029ba10..7b6de1f60f516 100644 --- a/flow/layers/clip_path_layer.h +++ b/flow/layers/clip_path_layer.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/layers/clip_rect_layer.cc b/flow/layers/clip_rect_layer.cc index 733acfcebd072..cb4ed56daff89 100644 --- a/flow/layers/clip_rect_layer.cc +++ b/flow/layers/clip_rect_layer.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -41,14 +41,15 @@ void ClipRectLayer::Paint(PaintContext& context) const { TRACE_EVENT0("flutter", "ClipRectLayer::Paint"); FML_DCHECK(needs_painting()); - SkAutoCanvasRestore save(&context.canvas, true); - context.canvas.clipRect(paint_bounds(), clip_behavior_ != Clip::hardEdge); + SkAutoCanvasRestore save(context.internal_nodes_canvas, true); + context.internal_nodes_canvas->clipRect(paint_bounds(), + clip_behavior_ != Clip::hardEdge); if (clip_behavior_ == Clip::antiAliasWithSaveLayer) { - context.canvas.saveLayer(paint_bounds(), nullptr); + context.internal_nodes_canvas->saveLayer(paint_bounds(), nullptr); } PaintChildren(context); if (clip_behavior_ == Clip::antiAliasWithSaveLayer) { - context.canvas.restore(); + context.internal_nodes_canvas->restore(); } } diff --git a/flow/layers/clip_rect_layer.h b/flow/layers/clip_rect_layer.h index 576e6a5d029a7..76e10e49bb7ea 100644 --- a/flow/layers/clip_rect_layer.h +++ b/flow/layers/clip_rect_layer.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/layers/clip_rrect_layer.cc b/flow/layers/clip_rrect_layer.cc index 046a0d45404ef..9016c7f5b7bff 100644 --- a/flow/layers/clip_rrect_layer.cc +++ b/flow/layers/clip_rrect_layer.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -48,14 +48,15 @@ void ClipRRectLayer::Paint(PaintContext& context) const { TRACE_EVENT0("flutter", "ClipRRectLayer::Paint"); FML_DCHECK(needs_painting()); - SkAutoCanvasRestore save(&context.canvas, true); - context.canvas.clipRRect(clip_rrect_, clip_behavior_ != Clip::hardEdge); + SkAutoCanvasRestore save(context.internal_nodes_canvas, true); + context.internal_nodes_canvas->clipRRect(clip_rrect_, + clip_behavior_ != Clip::hardEdge); if (clip_behavior_ == Clip::antiAliasWithSaveLayer) { - context.canvas.saveLayer(paint_bounds(), nullptr); + context.internal_nodes_canvas->saveLayer(paint_bounds(), nullptr); } PaintChildren(context); if (clip_behavior_ == Clip::antiAliasWithSaveLayer) { - context.canvas.restore(); + context.internal_nodes_canvas->restore(); } } diff --git a/flow/layers/clip_rrect_layer.h b/flow/layers/clip_rrect_layer.h index 7e8f0934a337f..7b3ac85beb65b 100644 --- a/flow/layers/clip_rrect_layer.h +++ b/flow/layers/clip_rrect_layer.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/layers/color_filter_layer.cc b/flow/layers/color_filter_layer.cc index 287507d179f0f..3b140ad7ceb5e 100644 --- a/flow/layers/color_filter_layer.cc +++ b/flow/layers/color_filter_layer.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/layers/color_filter_layer.h b/flow/layers/color_filter_layer.h index e129bad66f000..358788fdd4486 100644 --- a/flow/layers/color_filter_layer.h +++ b/flow/layers/color_filter_layer.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/layers/container_layer.cc b/flow/layers/container_layer.cc index f398c96ad1afe..f6ca64005fe6b 100644 --- a/flow/layers/container_layer.cc +++ b/flow/layers/container_layer.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,7 +10,7 @@ ContainerLayer::ContainerLayer() {} ContainerLayer::~ContainerLayer() = default; -void ContainerLayer::Add(std::unique_ptr layer) { +void ContainerLayer::Add(std::shared_ptr layer) { layer->set_parent(this); layers_.push_back(std::move(layer)); } diff --git a/flow/layers/container_layer.h b/flow/layers/container_layer.h index 0da0a7185963e..780fd64b46a94 100644 --- a/flow/layers/container_layer.h +++ b/flow/layers/container_layer.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,7 +15,7 @@ class ContainerLayer : public Layer { ContainerLayer(); ~ContainerLayer() override; - void Add(std::unique_ptr layer); + void Add(std::shared_ptr layer); void Preroll(PrerollContext* context, const SkMatrix& matrix) override; @@ -23,7 +23,7 @@ class ContainerLayer : public Layer { void UpdateScene(SceneUpdateContext& context) override; #endif // defined(OS_FUCHSIA) - const std::vector>& layers() const { return layers_; } + const std::vector>& layers() const { return layers_; } protected: void PrerollChildren(PrerollContext* context, @@ -36,7 +36,7 @@ class ContainerLayer : public Layer { #endif // defined(OS_FUCHSIA) private: - std::vector> layers_; + std::vector> layers_; FML_DISALLOW_COPY_AND_ASSIGN(ContainerLayer); }; diff --git a/flow/layers/layer.cc b/flow/layers/layer.cc index c1d91872127ab..c3653ed52d0cf 100644 --- a/flow/layers/layer.cc +++ b/flow/layers/layer.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -26,13 +26,13 @@ Layer::AutoSaveLayer::AutoSaveLayer(const PaintContext& paint_context, const SkRect& bounds, const SkPaint* paint) : paint_context_(paint_context), bounds_(bounds) { - paint_context_.canvas.saveLayer(bounds_, paint); + paint_context_.internal_nodes_canvas->saveLayer(bounds_, paint); } Layer::AutoSaveLayer::AutoSaveLayer(const PaintContext& paint_context, const SkCanvas::SaveLayerRec& layer_rec) : paint_context_(paint_context), bounds_(*layer_rec.fBounds) { - paint_context_.canvas.saveLayer(layer_rec); + paint_context_.internal_nodes_canvas->saveLayer(layer_rec); } Layer::AutoSaveLayer Layer::AutoSaveLayer::Create( @@ -50,9 +50,9 @@ Layer::AutoSaveLayer Layer::AutoSaveLayer::Create( Layer::AutoSaveLayer::~AutoSaveLayer() { if (paint_context_.checkerboard_offscreen_layers) { - DrawCheckerboard(&paint_context_.canvas, bounds_); + DrawCheckerboard(paint_context_.internal_nodes_canvas, bounds_); } - paint_context_.canvas.restore(); + paint_context_.internal_nodes_canvas->restore(); } } // namespace flow diff --git a/flow/layers/layer.h b/flow/layers/layer.h index a52f6e04aa86c..0e53e9281c64c 100644 --- a/flow/layers/layer.h +++ b/flow/layers/layer.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,7 @@ #include #include +#include "flutter/flow/embedded_views.h" #include "flutter/flow/instrumentation.h" #include "flutter/flow/raster_cache.h" #include "flutter/flow/texture.h" @@ -24,6 +25,7 @@ #include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/core/SkRRect.h" #include "third_party/skia/include/core/SkRect.h" +#include "third_party/skia/include/utils/SkNWayCanvas.h" #if defined(OS_FUCHSIA) @@ -40,6 +42,20 @@ enum Clip { none, hardEdge, antiAlias, antiAliasWithSaveLayer }; class ContainerLayer; +struct PrerollContext { + RasterCache* raster_cache; + GrContext* gr_context; + ExternalViewEmbedder* view_embedder; + SkColorSpace* dst_color_space; + SkRect child_paint_bounds; + + // The following allows us to paint in the end of subtree preroll + const Stopwatch& frame_time; + const Stopwatch& engine_time; + TextureRegistry& texture_registry; + const bool checkerboard_offscreen_layers; +}; + // Represents a single composited layer. Created on the UI thread but then // subquently used on the Rasterizer thread. class Layer { @@ -47,20 +63,26 @@ class Layer { Layer(); virtual ~Layer(); - struct PrerollContext { - RasterCache* raster_cache; - GrContext* gr_context; - SkColorSpace* dst_color_space; - SkRect child_paint_bounds; - }; - virtual void Preroll(PrerollContext* context, const SkMatrix& matrix); struct PaintContext { - SkCanvas& canvas; + // When splitting the scene into multiple canvases (e.g when embedding + // a platform view on iOS) during the paint traversal we apply the non leaf + // flow layers to all canvases, and leaf layers just to the "current" + // canvas. Applying the non leaf layers to all canvases ensures that when + // we switch a canvas (when painting a PlatformViewLayer) the next canvas + // has the exact same state as the current canvas. + // The internal_nodes_canvas is a SkNWayCanvas which is used by non leaf + // and applies the operations to all canvases. + // The leaf_nodes_canvas is the "current" canvas and is used by leaf + // layers. + SkCanvas* internal_nodes_canvas; + SkCanvas* leaf_nodes_canvas; + ExternalViewEmbedder* view_embedder; const Stopwatch& frame_time; const Stopwatch& engine_time; TextureRegistry& texture_registry; + const RasterCache* raster_cache; const bool checkerboard_offscreen_layers; }; diff --git a/flow/layers/layer_tree.cc b/flow/layers/layer_tree.cc index 29f9c93b52c19..37b9b0a23b9fb 100644 --- a/flow/layers/layer_tree.cc +++ b/flow/layers/layer_tree.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,6 +7,7 @@ #include "flutter/flow/layers/layer.h" #include "flutter/fml/trace_event.h" #include "third_party/skia/include/core/SkPictureRecorder.h" +#include "third_party/skia/include/utils/SkNWayCanvas.h" namespace flow { @@ -25,12 +26,16 @@ void LayerTree::Preroll(CompositorContext::ScopedFrame& frame, frame.canvas() ? frame.canvas()->imageInfo().colorSpace() : nullptr; frame.context().raster_cache().SetCheckboardCacheImages( checkerboard_raster_cache_images_); - Layer::PrerollContext context = { + PrerollContext context = { ignore_raster_cache ? nullptr : &frame.context().raster_cache(), frame.gr_context(), + frame.view_embedder(), color_space, SkRect::MakeEmpty(), - }; + frame.context().frame_time(), + frame.context().engine_time(), + frame.context().texture_registry(), + checkerboard_offscreen_layers_}; root_layer_->Preroll(&context, frame.root_surface_transformation()); } @@ -60,15 +65,28 @@ void LayerTree::UpdateScene(SceneUpdateContext& context, } #endif -void LayerTree::Paint(CompositorContext::ScopedFrame& frame) const { +void LayerTree::Paint(CompositorContext::ScopedFrame& frame, + bool ignore_raster_cache) const { TRACE_EVENT0("flutter", "LayerTree::Paint"); + SkISize canvas_size = frame.canvas()->getBaseLayerSize(); + SkNWayCanvas internal_nodes_canvas(canvas_size.width(), canvas_size.height()); + internal_nodes_canvas.addCanvas(frame.canvas()); + if (frame.view_embedder() != nullptr) { + auto overlay_canvases = frame.view_embedder()->GetCurrentCanvases(); + for (size_t i = 0; i < overlay_canvases.size(); i++) { + internal_nodes_canvas.addCanvas(overlay_canvases[i]); + } + } + Layer::PaintContext context = { - *frame.canvas(), // - frame.context().frame_time(), // - frame.context().engine_time(), // - frame.context().texture_registry(), // - checkerboard_offscreen_layers_ // - }; + (SkCanvas*)&internal_nodes_canvas, + frame.canvas(), + frame.view_embedder(), + frame.context().frame_time(), + frame.context().engine_time(), + frame.context().texture_registry(), + ignore_raster_cache ? nullptr : &frame.context().raster_cache(), + checkerboard_offscreen_layers_}; if (root_layer_->needs_painting()) root_layer_->Paint(context); @@ -78,30 +96,42 @@ sk_sp LayerTree::Flatten(const SkRect& bounds) { TRACE_EVENT0("flutter", "LayerTree::Flatten"); SkPictureRecorder recorder; - auto canvas = recorder.beginRecording(bounds); + auto* canvas = recorder.beginRecording(bounds); if (!canvas) { return nullptr; } - Layer::PrerollContext preroll_context{ - nullptr, // raster_cache (don't consult the cache) - nullptr, // gr_context (used for the raster cache) - nullptr, // SkColorSpace* dst_color_space - SkRect::MakeEmpty(), // SkRect child_paint_bounds - }; - const Stopwatch unused_stopwatch; TextureRegistry unused_texture_registry; SkMatrix root_surface_transformation; // No root surface transformation. So assume identity. root_surface_transformation.reset(); + PrerollContext preroll_context{ + nullptr, // raster_cache (don't consult the cache) + nullptr, // gr_context (used for the raster cache) + nullptr, // external view embedder + nullptr, // SkColorSpace* dst_color_space + SkRect::MakeEmpty(), // SkRect child_paint_bounds + unused_stopwatch, // frame time (dont care) + unused_stopwatch, // engine time (dont care) + unused_texture_registry, // texture registry (not supported) + false, // checkerboard_offscreen_layers + }; + + SkISize canvas_size = canvas->getBaseLayerSize(); + SkNWayCanvas internal_nodes_canvas(canvas_size.width(), canvas_size.height()); + internal_nodes_canvas.addCanvas(canvas); + Layer::PaintContext paint_context = { - *canvas, // canvas + (SkCanvas*)&internal_nodes_canvas, + canvas, // canvas + nullptr, unused_stopwatch, // frame time (dont care) unused_stopwatch, // engine time (dont care) unused_texture_registry, // texture registry (not supported) + nullptr, // raster cache false // checkerboard offscreen layers }; diff --git a/flow/layers/layer_tree.h b/flow/layers/layer_tree.h index bae883ca207be..f3bfe3a322594 100644 --- a/flow/layers/layer_tree.h +++ b/flow/layers/layer_tree.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -32,13 +32,14 @@ class LayerTree { scenic::ContainerNode& container); #endif - void Paint(CompositorContext::ScopedFrame& frame) const; + void Paint(CompositorContext::ScopedFrame& frame, + bool ignore_raster_cache = false) const; sk_sp Flatten(const SkRect& bounds); Layer* root_layer() const { return root_layer_.get(); } - void set_root_layer(std::unique_ptr root_layer) { + void set_root_layer(std::shared_ptr root_layer) { root_layer_ = std::move(root_layer); } @@ -73,7 +74,7 @@ class LayerTree { private: SkISize frame_size_; // Physical pixels. - std::unique_ptr root_layer_; + std::shared_ptr root_layer_; fml::TimeDelta construction_time_; uint32_t rasterizer_tracing_threshold_; bool checkerboard_raster_cache_images_; diff --git a/flow/layers/opacity_layer.cc b/flow/layers/opacity_layer.cc index 2272e79093864..1a2a3e3e1a453 100644 --- a/flow/layers/opacity_layer.cc +++ b/flow/layers/opacity_layer.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,6 +10,21 @@ OpacityLayer::OpacityLayer() = default; OpacityLayer::~OpacityLayer() = default; +void OpacityLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { + SkMatrix child_matrix = matrix; + child_matrix.postTranslate(offset_.fX, offset_.fY); + ContainerLayer::Preroll(context, child_matrix); + set_paint_bounds(paint_bounds().makeOffset(offset_.fX, offset_.fY)); + if (context->raster_cache && layers().size() == 1) { + Layer* child = layers()[0].get(); + SkMatrix ctm = child_matrix; +#ifndef SUPPORT_FRACTIONAL_TRANSLATION + ctm = RasterCache::GetIntegralTransCTM(ctm); +#endif + context->raster_cache->Prepare(context, child, ctm); + } +} + void OpacityLayer::Paint(PaintContext& context) const { TRACE_EVENT0("flutter", "OpacityLayer::Paint"); FML_DCHECK(needs_painting()); @@ -17,8 +32,45 @@ void OpacityLayer::Paint(PaintContext& context) const { SkPaint paint; paint.setAlpha(alpha_); - Layer::AutoSaveLayer save = - Layer::AutoSaveLayer::Create(context, paint_bounds(), &paint); + SkAutoCanvasRestore save(context.internal_nodes_canvas, true); + context.internal_nodes_canvas->translate(offset_.fX, offset_.fY); + +#ifndef SUPPORT_FRACTIONAL_TRANSLATION + context.internal_nodes_canvas->setMatrix(RasterCache::GetIntegralTransCTM( + context.leaf_nodes_canvas->getTotalMatrix())); +#endif + + // Embedded platform views are changing the canvas in the middle of the paint + // traversal. To make sure we paint on the right canvas, when the embedded + // platform views preview is enabled (context.view_embedded is not null) we + // don't use the cache. + if (context.view_embedder == nullptr && layers().size() == 1 && + context.raster_cache) { + const SkMatrix& ctm = context.leaf_nodes_canvas->getTotalMatrix(); + RasterCacheResult child_cache = + context.raster_cache->Get(layers()[0].get(), ctm); + if (child_cache.is_valid()) { + child_cache.draw(*context.leaf_nodes_canvas, &paint); + return; + } + } + + // Skia may clip the content with saveLayerBounds (although it's not a + // guaranteed clip). So we have to provide a big enough saveLayerBounds. To do + // so, we first remove the offset from paint bounds since it's already in the + // matrix. Then we round out the bounds because of our + // RasterCache::GetIntegralTransCTM optimization. + // + // Note that the following lines are only accessible when the raster cache is + // not available (e.g., when we're using the software backend in golden + // tests). + SkRect saveLayerBounds; + paint_bounds() + .makeOffset(-offset_.fX, -offset_.fY) + .roundOut(&saveLayerBounds); + + Layer::AutoSaveLayer save_layer = + Layer::AutoSaveLayer::Create(context, saveLayerBounds, &paint); PaintChildren(context); } diff --git a/flow/layers/opacity_layer.h b/flow/layers/opacity_layer.h index b27829385046b..5662f85a64980 100644 --- a/flow/layers/opacity_layer.h +++ b/flow/layers/opacity_layer.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,6 +15,9 @@ class OpacityLayer : public ContainerLayer { ~OpacityLayer() override; void set_alpha(int alpha) { alpha_ = alpha; } + void set_offset(const SkPoint& offset) { offset_ = offset; } + + void Preroll(PrerollContext* context, const SkMatrix& matrix) override; void Paint(PaintContext& context) const override; @@ -23,6 +26,7 @@ class OpacityLayer : public ContainerLayer { private: int alpha_; + SkPoint offset_; FML_DISALLOW_COPY_AND_ASSIGN(OpacityLayer); }; diff --git a/flow/layers/performance_overlay_layer.cc b/flow/layers/performance_overlay_layer.cc index 7d871af33b94f..1ec2eeaa3b9bd 100644 --- a/flow/layers/performance_overlay_layer.cc +++ b/flow/layers/performance_overlay_layer.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -73,15 +73,16 @@ void PerformanceOverlayLayer::Paint(PaintContext& context) const { SkScalar y = paint_bounds().y() + padding; SkScalar width = paint_bounds().width() - (padding * 2); SkScalar height = paint_bounds().height() / 2; - SkAutoCanvasRestore save(&context.canvas, true); + SkAutoCanvasRestore save(context.leaf_nodes_canvas, true); - VisualizeStopWatch(context.canvas, context.frame_time, x, y, width, - height - padding, + VisualizeStopWatch(*context.leaf_nodes_canvas, context.frame_time, x, y, + width, height - padding, options_ & kVisualizeRasterizerStatistics, options_ & kDisplayRasterizerStatistics, "GPU"); - VisualizeStopWatch(context.canvas, context.engine_time, x, y + height, width, - height - padding, options_ & kVisualizeEngineStatistics, + VisualizeStopWatch(*context.leaf_nodes_canvas, context.engine_time, x, + y + height, width, height - padding, + options_ & kVisualizeEngineStatistics, options_ & kDisplayEngineStatistics, "UI"); } diff --git a/flow/layers/performance_overlay_layer.h b/flow/layers/performance_overlay_layer.h index 3296a308bddbd..b5f20ecbd7a6b 100644 --- a/flow/layers/performance_overlay_layer.h +++ b/flow/layers/performance_overlay_layer.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/layers/physical_shape_layer.cc b/flow/layers/physical_shape_layer.cc index e10caaa56feed..3e8e1a4118f43 100644 --- a/flow/layers/physical_shape_layer.cc +++ b/flow/layers/physical_shape_layer.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -83,7 +83,7 @@ void PhysicalShapeLayer::Paint(PaintContext& context) const { FML_DCHECK(needs_painting()); if (elevation_ != 0) { - DrawShadow(&context.canvas, path_, shadow_color_, elevation_, + DrawShadow(context.leaf_nodes_canvas, path_, shadow_color_, elevation_, SkColorGetA(color_) != 0xff, device_pixel_ratio_); } @@ -91,20 +91,20 @@ void PhysicalShapeLayer::Paint(PaintContext& context) const { SkPaint paint; paint.setColor(color_); if (clip_behavior_ != Clip::antiAliasWithSaveLayer) { - context.canvas.drawPath(path_, paint); + context.leaf_nodes_canvas->drawPath(path_, paint); } - int saveCount = context.canvas.save(); + int saveCount = context.internal_nodes_canvas->save(); switch (clip_behavior_) { case Clip::hardEdge: - context.canvas.clipPath(path_, false); + context.internal_nodes_canvas->clipPath(path_, false); break; case Clip::antiAlias: - context.canvas.clipPath(path_, true); + context.internal_nodes_canvas->clipPath(path_, true); break; case Clip::antiAliasWithSaveLayer: - context.canvas.clipPath(path_, true); - context.canvas.saveLayer(paint_bounds(), nullptr); + context.internal_nodes_canvas->clipPath(path_, true); + context.internal_nodes_canvas->saveLayer(paint_bounds(), nullptr); break; case Clip::none: break; @@ -115,12 +115,12 @@ void PhysicalShapeLayer::Paint(PaintContext& context) const { // (https://github.com/flutter/flutter/issues/18057#issue-328003931) // using saveLayer, we have to call drawPaint instead of drawPath as // anti-aliased drawPath will always have such artifacts. - context.canvas.drawPaint(paint); + context.leaf_nodes_canvas->drawPaint(paint); } PaintChildren(context); - context.canvas.restoreToCount(saveCount); + context.internal_nodes_canvas->restoreToCount(saveCount); } void PhysicalShapeLayer::DrawShadow(SkCanvas* canvas, diff --git a/flow/layers/physical_shape_layer.h b/flow/layers/physical_shape_layer.h index 344656c662b24..45ba68e86d9b3 100644 --- a/flow/layers/physical_shape_layer.h +++ b/flow/layers/physical_shape_layer.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/layers/picture_layer.cc b/flow/layers/picture_layer.cc index 3cbf15a609ad1..cef3321df4d19 100644 --- a/flow/layers/picture_layer.cc +++ b/flow/layers/picture_layer.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,17 +15,14 @@ PictureLayer::~PictureLayer() = default; void PictureLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { SkPicture* sk_picture = picture(); - if (auto cache = context->raster_cache) { + if (auto* cache = context->raster_cache) { SkMatrix ctm = matrix; ctm.postTranslate(offset_.x(), offset_.y()); #ifndef SUPPORT_FRACTIONAL_TRANSLATION ctm = RasterCache::GetIntegralTransCTM(ctm); #endif - raster_cache_result_ = cache->GetPrerolledImage( - context->gr_context, sk_picture, ctm, context->dst_color_space, - is_complex_, will_change_); - } else { - raster_cache_result_ = RasterCacheResult(); + cache->Prepare(context->gr_context, sk_picture, ctm, + context->dst_color_space, is_complex_, will_change_); } SkRect bounds = sk_picture->cullRect().makeOffset(offset_.x(), offset_.y()); @@ -37,18 +34,22 @@ void PictureLayer::Paint(PaintContext& context) const { FML_DCHECK(picture_.get()); FML_DCHECK(needs_painting()); - SkAutoCanvasRestore save(&context.canvas, true); - context.canvas.translate(offset_.x(), offset_.y()); + SkAutoCanvasRestore save(context.leaf_nodes_canvas, true); + context.leaf_nodes_canvas->translate(offset_.x(), offset_.y()); #ifndef SUPPORT_FRACTIONAL_TRANSLATION - context.canvas.setMatrix( - RasterCache::GetIntegralTransCTM(context.canvas.getTotalMatrix())); + context.leaf_nodes_canvas->setMatrix(RasterCache::GetIntegralTransCTM( + context.leaf_nodes_canvas->getTotalMatrix())); #endif - if (raster_cache_result_.is_valid()) { - raster_cache_result_.draw(context.canvas); - } else { - context.canvas.drawPicture(picture()); + if (context.raster_cache) { + const SkMatrix& ctm = context.leaf_nodes_canvas->getTotalMatrix(); + RasterCacheResult result = context.raster_cache->Get(*picture(), ctm); + if (result.is_valid()) { + result.draw(*context.leaf_nodes_canvas); + return; + } } + context.leaf_nodes_canvas->drawPicture(picture()); } } // namespace flow diff --git a/flow/layers/picture_layer.h b/flow/layers/picture_layer.h index 12e2807c33d23..fc50e8f3bf6dd 100644 --- a/flow/layers/picture_layer.h +++ b/flow/layers/picture_layer.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -39,7 +39,6 @@ class PictureLayer : public Layer { SkiaGPUObject picture_; bool is_complex_ = false; bool will_change_ = false; - RasterCacheResult raster_cache_result_; FML_DISALLOW_COPY_AND_ASSIGN(PictureLayer); }; diff --git a/flow/layers/platform_view_layer.cc b/flow/layers/platform_view_layer.cc new file mode 100644 index 0000000000000..d10bd2ac4f309 --- /dev/null +++ b/flow/layers/platform_view_layer.cc @@ -0,0 +1,42 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/flow/layers/platform_view_layer.h" + +namespace flow { + +PlatformViewLayer::PlatformViewLayer() = default; + +PlatformViewLayer::~PlatformViewLayer() = default; + +void PlatformViewLayer::Preroll(PrerollContext* context, + const SkMatrix& matrix) { + set_paint_bounds(SkRect::MakeXYWH(offset_.x(), offset_.y(), size_.width(), + size_.height())); + + if (context->view_embedder == nullptr) { + FML_LOG(ERROR) << "Trying to embed a platform view but the PrerollContext " + "does not support embedding"; + return; + } + context->view_embedder->PrerollCompositeEmbeddedView(view_id_); +} + +void PlatformViewLayer::Paint(PaintContext& context) const { + if (context.view_embedder == nullptr) { + FML_LOG(ERROR) << "Trying to embed a platform view but the PaintContext " + "does not support embedding"; + return; + } + EmbeddedViewParams params; + SkMatrix transform = context.leaf_nodes_canvas->getTotalMatrix(); + params.offsetPixels = + SkPoint::Make(transform.getTranslateX(), transform.getTranslateY()); + params.sizePoints = size_; + + SkCanvas* canvas = + context.view_embedder->CompositeEmbeddedView(view_id_, params); + context.leaf_nodes_canvas = canvas; +} +} // namespace flow diff --git a/flow/layers/platform_view_layer.h b/flow/layers/platform_view_layer.h new file mode 100644 index 0000000000000..b5fd2b4809909 --- /dev/null +++ b/flow/layers/platform_view_layer.h @@ -0,0 +1,39 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FLOW_LAYERS_PLATFORM_VIEW_LAYER_H_ +#define FLUTTER_FLOW_LAYERS_PLATFORM_VIEW_LAYER_H_ + +#include "flutter/flow/layers/layer.h" +#include "third_party/skia/include/core/SkSurface.h" +#include "third_party/skia/include/gpu/GrBackendSurface.h" +#include "third_party/skia/include/gpu/GrContext.h" +#include "third_party/skia/include/gpu/GrTexture.h" +#include "third_party/skia/include/gpu/GrTypes.h" + +namespace flow { + +class PlatformViewLayer : public Layer { + public: + PlatformViewLayer(); + ~PlatformViewLayer() override; + + void set_offset(const SkPoint& offset) { offset_ = offset; } + void set_size(const SkSize& size) { size_ = size; } + void set_view_id(int64_t view_id) { view_id_ = view_id; } + + void Preroll(PrerollContext* context, const SkMatrix& matrix) override; + void Paint(PaintContext& context) const override; + + private: + SkPoint offset_; + SkSize size_; + int64_t view_id_; + + FML_DISALLOW_COPY_AND_ASSIGN(PlatformViewLayer); +}; + +} // namespace flow + +#endif // FLUTTER_FLOW_LAYERS_PLATFORM_VIEW_LAYER_H_ diff --git a/flow/layers/shader_mask_layer.cc b/flow/layers/shader_mask_layer.cc index 6cb73bbf64855..5c13f56e8b9a1 100644 --- a/flow/layers/shader_mask_layer.cc +++ b/flow/layers/shader_mask_layer.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,8 +21,8 @@ void ShaderMaskLayer::Paint(PaintContext& context) const { SkPaint paint; paint.setBlendMode(blend_mode_); paint.setShader(shader_); - context.canvas.translate(mask_rect_.left(), mask_rect_.top()); - context.canvas.drawRect( + context.leaf_nodes_canvas->translate(mask_rect_.left(), mask_rect_.top()); + context.leaf_nodes_canvas->drawRect( SkRect::MakeWH(mask_rect_.width(), mask_rect_.height()), paint); } diff --git a/flow/layers/shader_mask_layer.h b/flow/layers/shader_mask_layer.h index ed059722fea55..2b4b3f052ae7b 100644 --- a/flow/layers/shader_mask_layer.h +++ b/flow/layers/shader_mask_layer.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/layers/texture_layer.cc b/flow/layers/texture_layer.cc index 52ebdc37dbcab..df845caf80215 100644 --- a/flow/layers/texture_layer.cc +++ b/flow/layers/texture_layer.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -23,7 +23,7 @@ void TextureLayer::Paint(PaintContext& context) const { if (!texture) { return; } - texture->Paint(context.canvas, paint_bounds(), freeze_); + texture->Paint(*context.leaf_nodes_canvas, paint_bounds(), freeze_); } } // namespace flow diff --git a/flow/layers/texture_layer.h b/flow/layers/texture_layer.h index bf2a17fd27ac7..1563745e652b7 100644 --- a/flow/layers/texture_layer.h +++ b/flow/layers/texture_layer.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/layers/transform_layer.cc b/flow/layers/transform_layer.cc index a70cc299dd9a4..410204bed34c3 100644 --- a/flow/layers/transform_layer.cc +++ b/flow/layers/transform_layer.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -36,8 +36,8 @@ void TransformLayer::Paint(PaintContext& context) const { TRACE_EVENT0("flutter", "TransformLayer::Paint"); FML_DCHECK(needs_painting()); - SkAutoCanvasRestore save(&context.canvas, true); - context.canvas.concat(transform_); + SkAutoCanvasRestore save(context.internal_nodes_canvas, true); + context.internal_nodes_canvas->concat(transform_); PaintChildren(context); } diff --git a/flow/layers/transform_layer.h b/flow/layers/transform_layer.h index f8209302aa170..b1fb830bf2b9d 100644 --- a/flow/layers/transform_layer.h +++ b/flow/layers/transform_layer.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/matrix_decomposition.cc b/flow/matrix_decomposition.cc index 0cc035cbba216..c710908dc651c 100644 --- a/flow/matrix_decomposition.cc +++ b/flow/matrix_decomposition.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/matrix_decomposition.h b/flow/matrix_decomposition.h index d65d12a77e674..2cf3c0faa4298 100644 --- a/flow/matrix_decomposition.h +++ b/flow/matrix_decomposition.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/matrix_decomposition_unittests.cc b/flow/matrix_decomposition_unittests.cc index 3b9f8ed815ff6..6c2ba6737372d 100644 --- a/flow/matrix_decomposition_unittests.cc +++ b/flow/matrix_decomposition_unittests.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/paint_utils.cc b/flow/paint_utils.cc index e2ea306c913f5..22b0735b8939f 100644 --- a/flow/paint_utils.cc +++ b/flow/paint_utils.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/paint_utils.h b/flow/paint_utils.h index 63a4b162b1c1c..352dee124fc91 100644 --- a/flow/paint_utils.h +++ b/flow/paint_utils.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index a3aef6e3d1410..cfd587f144a48 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,7 @@ #include +#include "flutter/flow/layers/layer.h" #include "flutter/flow/paint_utils.h" #include "flutter/fml/logging.h" #include "flutter/fml/trace_event.h" @@ -17,13 +18,23 @@ namespace flow { -void RasterCacheResult::draw(SkCanvas& canvas) const { +RasterCacheResult::RasterCacheResult() {} + +RasterCacheResult::RasterCacheResult(const RasterCacheResult& other) = default; + +RasterCacheResult::~RasterCacheResult() = default; + +RasterCacheResult::RasterCacheResult(sk_sp image, + const SkRect& logical_rect) + : image_(std::move(image)), logical_rect_(logical_rect) {} + +void RasterCacheResult::draw(SkCanvas& canvas, const SkPaint* paint) const { SkAutoCanvasRestore auto_restore(&canvas, true); SkIRect bounds = RasterCache::GetDeviceBounds(logical_rect_, canvas.getTotalMatrix()); FML_DCHECK(bounds.size() == image_->dimensions()); canvas.resetMatrix(); - canvas.drawImage(image_, bounds.fLeft, bounds.fTop); + canvas.drawImage(image_, bounds.fLeft, bounds.fTop, paint); } RasterCache::RasterCache(size_t threshold) @@ -77,14 +88,13 @@ static bool IsPictureWorthRasterizing(SkPicture* picture, return picture->approximateOpCount() > 10; } -RasterCacheResult RasterizePicture(SkPicture* picture, - GrContext* context, - const SkMatrix& ctm, - SkColorSpace* dst_color_space, - bool checkerboard) { - TRACE_EVENT0("flutter", "RasterCachePopulate"); - - const SkRect logical_rect = picture->cullRect(); +static RasterCacheResult Rasterize( + GrContext* context, + const SkMatrix& ctm, + SkColorSpace* dst_color_space, + bool checkerboard, + const SkRect& logical_rect, + std::function draw_function) { SkIRect cache_rect = RasterCache::GetDeviceBounds(logical_rect, ctm); const SkImageInfo image_info = @@ -112,7 +122,7 @@ RasterCacheResult RasterizePicture(SkPicture* picture, canvas->clear(SK_ColorTRANSPARENT); canvas->translate(-cache_rect.left(), -cache_rect.top()); canvas->concat(ctm); - canvas->drawPicture(picture); + draw_function(canvas); if (checkerboard) { DrawCheckerboard(canvas, logical_rect); @@ -121,6 +131,18 @@ RasterCacheResult RasterizePicture(SkPicture* picture, return {surface->makeImageSnapshot(), logical_rect}; } +RasterCacheResult RasterizePicture(SkPicture* picture, + GrContext* context, + const SkMatrix& ctm, + SkColorSpace* dst_color_space, + bool checkerboard) { + TRACE_EVENT0("flutter", "RasterCachePopulate"); + + return Rasterize(context, ctm, dst_color_space, checkerboard, + picture->cullRect(), + [=](SkCanvas* canvas) { canvas->drawPicture(picture); }); +} + static inline size_t ClampSize(size_t value, size_t min, size_t max) { if (value > max) { return max; @@ -133,16 +155,46 @@ static inline size_t ClampSize(size_t value, size_t min, size_t max) { return value; } -RasterCacheResult RasterCache::GetPrerolledImage( - GrContext* context, - SkPicture* picture, - const SkMatrix& transformation_matrix, - SkColorSpace* dst_color_space, - bool is_complex, - bool will_change) { +void RasterCache::Prepare(PrerollContext* context, + Layer* layer, + const SkMatrix& ctm) { + LayerRasterCacheKey cache_key(layer, ctm); + Entry& entry = layer_cache_[cache_key]; + entry.access_count = ClampSize(entry.access_count + 1, 0, threshold_); + entry.used_this_frame = true; + if (!entry.image.is_valid()) { + entry.image = Rasterize(context->gr_context, ctm, context->dst_color_space, + checkerboard_images_, layer->paint_bounds(), + [layer, context](SkCanvas* canvas) { + SkISize canvas_size = canvas->getBaseLayerSize(); + SkNWayCanvas internal_nodes_canvas( + canvas_size.width(), canvas_size.height()); + internal_nodes_canvas.addCanvas(canvas); + Layer::PaintContext paintContext = { + (SkCanvas*)&internal_nodes_canvas, + canvas, + nullptr, + context->frame_time, + context->engine_time, + context->texture_registry, + context->raster_cache, + context->checkerboard_offscreen_layers}; + if (layer->needs_painting()) { + layer->Paint(paintContext); + } + }); + } +} + +bool RasterCache::Prepare(GrContext* context, + SkPicture* picture, + const SkMatrix& transformation_matrix, + SkColorSpace* dst_color_space, + bool is_complex, + bool will_change) { if (!IsPictureWorthRasterizing(picture, will_change, is_complex)) { // We only deal with pictures that are worthy of rasterization. - return {}; + return false; } // Decompose the matrix (once) for all subsequent operations. We want to make @@ -151,46 +203,50 @@ RasterCacheResult RasterCache::GetPrerolledImage( if (!matrix.IsValid()) { // The matrix was singular. No point in going further. - return {}; + return false; } - RasterCacheKey cache_key(*picture, transformation_matrix); + PictureRasterCacheKey cache_key(picture->uniqueID(), transformation_matrix); - Entry& entry = cache_[cache_key]; + Entry& entry = picture_cache_[cache_key]; entry.access_count = ClampSize(entry.access_count + 1, 0, threshold_); entry.used_this_frame = true; if (entry.access_count < threshold_ || threshold_ == 0) { // Frame threshold has not yet been reached. - return {}; + return false; } if (!entry.image.is_valid()) { entry.image = RasterizePicture(picture, context, transformation_matrix, dst_color_space, checkerboard_images_); } - - return entry.image; + return true; } -void RasterCache::SweepAfterFrame() { - std::vector::iterator> dead; +RasterCacheResult RasterCache::Get(const SkPicture& picture, + const SkMatrix& ctm) const { + PictureRasterCacheKey cache_key(picture.uniqueID(), ctm); + auto it = picture_cache_.find(cache_key); + return it == picture_cache_.end() ? RasterCacheResult() : it->second.image; +} - for (auto it = cache_.begin(); it != cache_.end(); ++it) { - Entry& entry = it->second; - if (!entry.used_this_frame) { - dead.push_back(it); - } - entry.used_this_frame = false; - } +RasterCacheResult RasterCache::Get(Layer* layer, const SkMatrix& ctm) const { + LayerRasterCacheKey cache_key(layer, ctm); + auto it = layer_cache_.find(cache_key); + return it == layer_cache_.end() ? RasterCacheResult() : it->second.image; +} - for (auto it : dead) { - cache_.erase(it); - } +void RasterCache::SweepAfterFrame() { + using PictureCache = PictureRasterCacheKey::Map; + using LayerCache = LayerRasterCacheKey::Map; + SweepOneCacheAfterFrame(picture_cache_); + SweepOneCacheAfterFrame(layer_cache_); } void RasterCache::Clear() { - cache_.clear(); + picture_cache_.clear(); + layer_cache_.clear(); } void RasterCache::SetCheckboardCacheImages(bool checkerboard) { diff --git a/flow/raster_cache.h b/flow/raster_cache.h index 348ab8000da39..cb4383f41fb52 100644 --- a/flow/raster_cache.h +++ b/flow/raster_cache.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,22 +19,27 @@ namespace flow { class RasterCacheResult { public: - RasterCacheResult() {} + RasterCacheResult(); - RasterCacheResult(sk_sp image, const SkRect& logical_rect) - : image_(std::move(image)), logical_rect_(logical_rect) {} + RasterCacheResult(const RasterCacheResult& other); + + ~RasterCacheResult(); + + RasterCacheResult(sk_sp image, const SkRect& logical_rect); operator bool() const { return static_cast(image_); } bool is_valid() const { return static_cast(image_); }; - void draw(SkCanvas& canvas) const; + void draw(SkCanvas& canvas, const SkPaint* paint = nullptr) const; private: sk_sp image_; SkRect logical_rect_; }; +struct PrerollContext; + class RasterCache { public: explicit RasterCache(size_t threshold = 3); @@ -56,12 +61,23 @@ class RasterCache { return result; } - RasterCacheResult GetPrerolledImage(GrContext* context, - SkPicture* picture, - const SkMatrix& transformation_matrix, - SkColorSpace* dst_color_space, - bool is_complex, - bool will_change); + // Return true if the cache is generated. + // + // We may return false and not generate the cache if + // 1. The picture is not worth rasterizing + // 2. The matrix is singular + // 3. The picture is accessed too few times + bool Prepare(GrContext* context, + SkPicture* picture, + const SkMatrix& transformation_matrix, + SkColorSpace* dst_color_space, + bool is_complex, + bool will_change); + + void Prepare(PrerollContext* context, Layer* layer, const SkMatrix& ctm); + + RasterCacheResult Get(const SkPicture& picture, const SkMatrix& ctm) const; + RasterCacheResult Get(Layer* layer, const SkMatrix& ctm) const; void SweepAfterFrame(); @@ -76,8 +92,26 @@ class RasterCache { RasterCacheResult image; }; + template + static void SweepOneCacheAfterFrame(Cache& cache) { + std::vector dead; + + for (auto it = cache.begin(); it != cache.end(); ++it) { + Entry& entry = it->second; + if (!entry.used_this_frame) { + dead.push_back(it); + } + entry.used_this_frame = false; + } + + for (auto it : dead) { + cache.erase(it); + } + } + const size_t threshold_; - RasterCacheKey::Map cache_; + PictureRasterCacheKey::Map picture_cache_; + LayerRasterCacheKey::Map layer_cache_; bool checkerboard_images_; fml::WeakPtrFactory weak_factory_; diff --git a/flow/raster_cache_key.cc b/flow/raster_cache_key.cc index a75bfecfee8b2..4dfef752f6974 100644 --- a/flow/raster_cache_key.cc +++ b/flow/raster_cache_key.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/raster_cache_key.h b/flow/raster_cache_key.h index 3f20072df8e3b..4a9d1a43cb74f 100644 --- a/flow/raster_cache_key.h +++ b/flow/raster_cache_key.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -14,10 +14,10 @@ namespace flow { +template class RasterCacheKey { public: - RasterCacheKey(const SkPicture& picture, const SkMatrix& ctm) - : picture_id_(picture.uniqueID()), matrix_(ctm) { + RasterCacheKey(ID id, const SkMatrix& ctm) : id_(id), matrix_(ctm) { matrix_[SkMatrix::kMTransX] = SkScalarFraction(ctm.getTranslateX()); matrix_[SkMatrix::kMTransY] = SkScalarFraction(ctm.getTranslateY()); #ifndef SUPPORT_FRACTIONAL_TRANSLATION @@ -25,19 +25,19 @@ class RasterCacheKey { #endif } - uint32_t picture_id() const { return picture_id_; } + ID id() const { return id_; } const SkMatrix& matrix() const { return matrix_; } struct Hash { - std::size_t operator()(RasterCacheKey const& key) const { - return key.picture_id_; + uint32_t operator()(RasterCacheKey const& key) const { + return std::hash()(key.id_); } }; struct Equal { constexpr bool operator()(const RasterCacheKey& lhs, const RasterCacheKey& rhs) const { - return lhs.picture_id_ == rhs.picture_id_ && lhs.matrix_ == rhs.matrix_; + return lhs.id_ == rhs.id_ && lhs.matrix_ == rhs.matrix_; } }; @@ -45,7 +45,7 @@ class RasterCacheKey { using Map = std::unordered_map; private: - uint32_t picture_id_; + ID id_; // ctm where only fractional (0-1) translations are preserved: // matrix_ = ctm; @@ -54,6 +54,13 @@ class RasterCacheKey { SkMatrix matrix_; }; +// The ID is the uint32_t picture uniqueID +using PictureRasterCacheKey = RasterCacheKey; + +class Layer; + +using LayerRasterCacheKey = RasterCacheKey; + } // namespace flow #endif // FLUTTER_FLOW_RASTER_CACHE_KEY_H_ diff --git a/flow/raster_cache_unittests.cc b/flow/raster_cache_unittests.cc index 0033d475b4bcb..3fd73d5bca55e 100644 --- a/flow/raster_cache_unittests.cc +++ b/flow/raster_cache_unittests.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -33,14 +33,14 @@ TEST(RasterCache, ThresholdIsRespected) { sk_sp image; sk_sp srgb = SkColorSpace::MakeSRGB(); - ASSERT_FALSE(cache.GetPrerolledImage(NULL, picture.get(), matrix, srgb.get(), - true, false)); // 1 + ASSERT_FALSE(cache.Prepare(NULL, picture.get(), matrix, srgb.get(), true, + false)); // 1 cache.SweepAfterFrame(); - ASSERT_FALSE(cache.GetPrerolledImage(NULL, picture.get(), matrix, srgb.get(), - true, false)); // 2 + ASSERT_FALSE(cache.Prepare(NULL, picture.get(), matrix, srgb.get(), true, + false)); // 2 cache.SweepAfterFrame(); - ASSERT_TRUE(cache.GetPrerolledImage(NULL, picture.get(), matrix, srgb.get(), - true, false)); // 3 + ASSERT_TRUE(cache.Prepare(NULL, picture.get(), matrix, srgb.get(), true, + false)); // 3 cache.SweepAfterFrame(); } @@ -55,14 +55,14 @@ TEST(RasterCache, ThresholdIsRespectedWhenZero) { sk_sp image; sk_sp srgb = SkColorSpace::MakeSRGB(); - ASSERT_FALSE(cache.GetPrerolledImage(NULL, picture.get(), matrix, srgb.get(), - true, false)); // 1 + ASSERT_FALSE(cache.Prepare(NULL, picture.get(), matrix, srgb.get(), true, + false)); // 1 cache.SweepAfterFrame(); - ASSERT_FALSE(cache.GetPrerolledImage(NULL, picture.get(), matrix, srgb.get(), - true, false)); // 2 + ASSERT_FALSE(cache.Prepare(NULL, picture.get(), matrix, srgb.get(), true, + false)); // 2 cache.SweepAfterFrame(); - ASSERT_FALSE(cache.GetPrerolledImage(NULL, picture.get(), matrix, srgb.get(), - true, false)); // 3 + ASSERT_FALSE(cache.Prepare(NULL, picture.get(), matrix, srgb.get(), true, + false)); // 3 cache.SweepAfterFrame(); } @@ -77,19 +77,19 @@ TEST(RasterCache, SweepsRemoveUnusedFrames) { sk_sp image; sk_sp srgb = SkColorSpace::MakeSRGB(); - ASSERT_FALSE(cache.GetPrerolledImage(NULL, picture.get(), matrix, srgb.get(), - true, false)); // 1 + ASSERT_FALSE(cache.Prepare(NULL, picture.get(), matrix, srgb.get(), true, + false)); // 1 cache.SweepAfterFrame(); - ASSERT_FALSE(cache.GetPrerolledImage(NULL, picture.get(), matrix, srgb.get(), - true, false)); // 2 + ASSERT_FALSE(cache.Prepare(NULL, picture.get(), matrix, srgb.get(), true, + false)); // 2 cache.SweepAfterFrame(); - ASSERT_TRUE(cache.GetPrerolledImage(NULL, picture.get(), matrix, srgb.get(), - true, false)); // 3 + ASSERT_TRUE(cache.Prepare(NULL, picture.get(), matrix, srgb.get(), true, + false)); // 3 cache.SweepAfterFrame(); - ASSERT_TRUE(cache.GetPrerolledImage(NULL, picture.get(), matrix, srgb.get(), - true, false)); // 4 + ASSERT_TRUE(cache.Prepare(NULL, picture.get(), matrix, srgb.get(), true, + false)); // 4 cache.SweepAfterFrame(); cache.SweepAfterFrame(); // Extra frame without a preroll image access. - ASSERT_FALSE(cache.GetPrerolledImage(NULL, picture.get(), matrix, srgb.get(), - true, false)); // 5 + ASSERT_FALSE(cache.Prepare(NULL, picture.get(), matrix, srgb.get(), true, + false)); // 5 } diff --git a/flow/scene_update_context.cc b/flow/scene_update_context.cc index 576bde7fa1aff..89a474bcdff1b 100644 --- a/flow/scene_update_context.cc +++ b/flow/scene_update_context.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -187,9 +187,14 @@ SceneUpdateContext::ExecutePaintTasks(CompositorContext::ScopedFrame& frame) { for (auto& task : paint_tasks_) { FML_DCHECK(task.surface); SkCanvas* canvas = task.surface->GetSkiaSurface()->getCanvas(); - Layer::PaintContext context = {*canvas, frame.context().frame_time(), + Layer::PaintContext context = {canvas, + canvas, + nullptr, + frame.context().frame_time(), frame.context().engine_time(), - frame.context().texture_registry(), false}; + frame.context().texture_registry(), + &frame.context().raster_cache(), + false}; canvas->restoreToCount(1); canvas->save(); canvas->clear(task.background_color); diff --git a/flow/scene_update_context.h b/flow/scene_update_context.h index 8436ad2f263bb..9d52e34fb4550 100644 --- a/flow/scene_update_context.h +++ b/flow/scene_update_context.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/skia_gpu_object.cc b/flow/skia_gpu_object.cc index bf9d9a8ec599f..1f789212e6ba9 100644 --- a/flow/skia_gpu_object.cc +++ b/flow/skia_gpu_object.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/skia_gpu_object.h b/flow/skia_gpu_object.h index 7379b7936ec42..c7d814bfcb5fc 100644 --- a/flow/skia_gpu_object.h +++ b/flow/skia_gpu_object.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/texture.cc b/flow/texture.cc index d5cc3ae228aa7..bef0de01b1cbd 100644 --- a/flow/texture.cc +++ b/flow/texture.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flow/texture.h b/flow/texture.h index 0af62ccbad2a1..414a11dc820e8 100644 --- a/flow/texture.h +++ b/flow/texture.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/flutter_kernel_transformers/BUILD.gn b/flutter_kernel_transformers/BUILD.gn new file mode 100644 index 0000000000000..0411b4b9976c2 --- /dev/null +++ b/flutter_kernel_transformers/BUILD.gn @@ -0,0 +1,23 @@ +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +assert(is_fuchsia || is_fuchsia_host) + +import("//build/dart/dart_library.gni") + +dart_library("flutter_kernel_transformers") { + disable_analysis = true + package_name = "flutter_kernel_transformers" + + sources = [ + "track_widget_constructor_locations.dart", + ] + + deps = [ + "//third_party/dart/pkg/front_end", + "//third_party/dart/pkg/kernel", + "//third_party/dart/pkg/vm", + "//third_party/dart-pkg/pub/meta", + ] +} diff --git a/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart b/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart index 27654bb062baa..47fa4f341f826 100644 --- a/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart +++ b/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/BUILD.gn b/fml/BUILD.gn index 25e065c8b1fe9..0f1a34dec369d 100644 --- a/fml/BUILD.gn +++ b/fml/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2017 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -46,6 +46,10 @@ source_set("fml") { "paths.h", "string_view.cc", "string_view.h", + "synchronization/atomic_object.h", + "synchronization/count_down_latch.cc", + "synchronization/count_down_latch.h", + "synchronization/shared_mutex.h", "synchronization/thread_annotations.h", "synchronization/thread_checker.h", "synchronization/waitable_event.cc", @@ -54,6 +58,7 @@ source_set("fml") { "task_runner.h", "thread.cc", "thread.h", + "thread_local.cc", "thread_local.h", "time/time_delta.h", "time/time_point.cc", @@ -80,6 +85,12 @@ source_set("fml") { libs = [] + if (is_ios || is_mac) { + sources += [ "platform/posix/shared_mutex_posix.cc" ] + } else { + sources += [ "synchronization/shared_mutex_std.cc" ] + } + if (is_ios || is_mac) { sources += [ "platform/darwin/cf_utils.cc", @@ -176,6 +187,7 @@ executable("fml_unittests") { "message_unittests.cc", "paths_unittests.cc", "string_view_unittest.cc", + "synchronization/count_down_latch_unittests.cc", "synchronization/thread_annotations_unittest.cc", "synchronization/thread_checker_unittest.cc", "synchronization/waitable_event_unittest.cc", diff --git a/fml/arraysize.h b/fml/arraysize.h index 8457369884a97..636939812bed7 100644 --- a/fml/arraysize.h +++ b/fml/arraysize.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/base32.cc b/fml/base32.cc index 1836ffe084f4d..957d26ee93b15 100644 --- a/fml/base32.cc +++ b/fml/base32.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/base32.h b/fml/base32.h index c5bfa8f58a754..f85bdf653864f 100644 --- a/fml/base32.h +++ b/fml/base32.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/base32_unittest.cc b/fml/base32_unittest.cc index 4d4ab529dac0b..efd2543396ae0 100644 --- a/fml/base32_unittest.cc +++ b/fml/base32_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/build_config.h b/fml/build_config.h index ca9a91a382c7e..2714f46d1cebf 100644 --- a/fml/build_config.h +++ b/fml/build_config.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/closure.h b/fml/closure.h index f40c0b2d0cbaf..fa0afe0104271 100644 --- a/fml/closure.h +++ b/fml/closure.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/command_line.cc b/fml/command_line.cc index 24012867edc84..27c62086ac14e 100644 --- a/fml/command_line.cc +++ b/fml/command_line.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/command_line.h b/fml/command_line.h index 84b84dfe415cc..e1d06e6e6bed5 100644 --- a/fml/command_line.h +++ b/fml/command_line.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/command_line_unittest.cc b/fml/command_line_unittest.cc index 0cafaa52c899c..c04619e483e28 100644 --- a/fml/command_line_unittest.cc +++ b/fml/command_line_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/compiler_specific.h b/fml/compiler_specific.h index 68fbefe1b9153..ac367f2e70213 100644 --- a/fml/compiler_specific.h +++ b/fml/compiler_specific.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/eintr_wrapper.h b/fml/eintr_wrapper.h index 66c8ae0cd0ea3..0f3f953188fed 100644 --- a/fml/eintr_wrapper.h +++ b/fml/eintr_wrapper.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/export.h b/fml/export.h index 6173bbb71c314..ea9bf883f9ac3 100644 --- a/fml/export.h +++ b/fml/export.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/file.cc b/fml/file.cc index e29abd62cc653..8deb76c91da0f 100644 --- a/fml/file.cc +++ b/fml/file.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -43,4 +43,19 @@ fml::UniqueFD CreateDirectory(const fml::UniqueFD& base_directory, return CreateDirectory(base_directory, components, permission, 0); } +ScopedTemporaryDirectory::ScopedTemporaryDirectory() { + path_ = CreateTemporaryDirectory(); + if (path_ != "") { + dir_fd_ = OpenDirectory(path_.c_str(), false, FilePermission::kRead); + } +} + +ScopedTemporaryDirectory::~ScopedTemporaryDirectory() { + if (path_ != "") { + if (!UnlinkDirectory(path_.c_str())) { + FML_LOG(ERROR) << "Could not remove directory: " << path_; + } + } +} + } // namespace fml diff --git a/fml/file.h b/fml/file.h index 699dd95409dfb..068ddc84c999d 100644 --- a/fml/file.h +++ b/fml/file.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -75,20 +75,9 @@ bool WriteAtomically(const fml::UniqueFD& base_directory, class ScopedTemporaryDirectory { public: - ScopedTemporaryDirectory() { - path_ = CreateTemporaryDirectory(); - if (path_ != "") { - dir_fd_ = OpenDirectory(path_.c_str(), false, FilePermission::kRead); - } - } - - ~ScopedTemporaryDirectory() { - if (path_ != "") { - if (!UnlinkDirectory(path_.c_str())) { - FML_LOG(ERROR) << "Could not remove directory: " << path_; - } - } - } + ScopedTemporaryDirectory(); + + ~ScopedTemporaryDirectory(); const UniqueFD& fd() { return dir_fd_; } diff --git a/fml/file_unittest.cc b/fml/file_unittest.cc index b44dca09f2218..c1ed8f63731c4 100644 --- a/fml/file_unittest.cc +++ b/fml/file_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/icu_util.cc b/fml/icu_util.cc index 28402e84e3f73..a432fcf989974 100644 --- a/fml/icu_util.cc +++ b/fml/icu_util.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/icu_util.h b/fml/icu_util.h index 1d20945ee015d..edde00b813792 100644 --- a/fml/icu_util.h +++ b/fml/icu_util.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/log_level.h b/fml/log_level.h index 737e80db2ff68..2c9a85305b53d 100644 --- a/fml/log_level.h +++ b/fml/log_level.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,6 +16,13 @@ constexpr LogSeverity LOG_ERROR = 2; constexpr LogSeverity LOG_FATAL = 3; constexpr LogSeverity LOG_NUM_SEVERITIES = 4; +// One of the Windows headers defines ERROR to 0. This makes the token +// concatenation in FML_LOG(ERROR) to resolve to LOG_0. We define this back to +// the appropriate log level. +#ifdef _WIN32 +#define LOG_0 LOG_ERROR +#endif + // LOG_DFATAL is LOG_FATAL in debug mode, ERROR in normal mode #ifdef NDEBUG const LogSeverity LOG_DFATAL = LOG_ERROR; diff --git a/fml/log_settings.cc b/fml/log_settings.cc index 80d0e22fc99d6..d70525a72e089 100644 --- a/fml/log_settings.cc +++ b/fml/log_settings.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/log_settings.h b/fml/log_settings.h index ea3381dfbcabb..2cd14e028c313 100644 --- a/fml/log_settings.h +++ b/fml/log_settings.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/log_settings_state.cc b/fml/log_settings_state.cc index 148c0a43e877b..a0936e6b5b382 100644 --- a/fml/log_settings_state.cc +++ b/fml/log_settings_state.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/logging.cc b/fml/logging.cc index 7503c8e700409..3cf7c86964392 100644 --- a/fml/logging.cc +++ b/fml/logging.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -34,7 +34,7 @@ const char* StripDots(const char* path) { } const char* StripPath(const char* path) { - auto p = strrchr(path, '/'); + auto* p = strrchr(path, '/'); if (p) return p + 1; else diff --git a/fml/logging.h b/fml/logging.h index 178f9b91c0129..20cb887cb20df 100644 --- a/fml/logging.h +++ b/fml/logging.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/macros.h b/fml/macros.h index 79a5479bbf979..0158d0e18c73e 100644 --- a/fml/macros.h +++ b/fml/macros.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/make_copyable.h b/fml/make_copyable.h index bb5d043af3607..0c4f0bb938822 100644 --- a/fml/make_copyable.h +++ b/fml/make_copyable.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/mapping.cc b/fml/mapping.cc index 332341f2fbc06..11882b6662bbf 100644 --- a/fml/mapping.cc +++ b/fml/mapping.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -22,4 +22,12 @@ const uint8_t* DataMapping::GetMapping() const { return data_.data(); } +size_t NonOwnedMapping::GetSize() const { + return size_; +} + +const uint8_t* NonOwnedMapping::GetMapping() const { + return data_; +} + } // namespace fml diff --git a/fml/mapping.h b/fml/mapping.h index a2a58851e585c..05894a5c219a4 100644 --- a/fml/mapping.h +++ b/fml/mapping.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -84,9 +84,9 @@ class NonOwnedMapping : public Mapping { NonOwnedMapping(const uint8_t* data, size_t size) : data_(data), size_(size) {} - size_t GetSize() const override { return size_; } + size_t GetSize() const override; - const uint8_t* GetMapping() const override { return data_; } + const uint8_t* GetMapping() const override; private: const uint8_t* const data_; diff --git a/fml/memory/ref_counted.h b/fml/memory/ref_counted.h index 269b8eff4551f..badb45d32b53c 100644 --- a/fml/memory/ref_counted.h +++ b/fml/memory/ref_counted.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/memory/ref_counted_internal.h b/fml/memory/ref_counted_internal.h index 2cef256b3442c..a5c5fe04d6280 100644 --- a/fml/memory/ref_counted_internal.h +++ b/fml/memory/ref_counted_internal.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/memory/ref_counted_unittest.cc b/fml/memory/ref_counted_unittest.cc index 5b6f68e1de6d1..13fc37e257c28 100644 --- a/fml/memory/ref_counted_unittest.cc +++ b/fml/memory/ref_counted_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/memory/ref_ptr.h b/fml/memory/ref_ptr.h index 3c92f5042a1b7..51ebccc5e77bb 100644 --- a/fml/memory/ref_ptr.h +++ b/fml/memory/ref_ptr.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/memory/ref_ptr_internal.h b/fml/memory/ref_ptr_internal.h index a72488cad6a86..b38f943751854 100644 --- a/fml/memory/ref_ptr_internal.h +++ b/fml/memory/ref_ptr_internal.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/memory/thread_checker.h b/fml/memory/thread_checker.h index 8101dd4f8403b..4cfd700636fc2 100644 --- a/fml/memory/thread_checker.h +++ b/fml/memory/thread_checker.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/memory/weak_ptr.h b/fml/memory/weak_ptr.h index e0f5f427b3fd7..09cc10a116b35 100644 --- a/fml/memory/weak_ptr.h +++ b/fml/memory/weak_ptr.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/memory/weak_ptr_internal.cc b/fml/memory/weak_ptr_internal.cc index c06db4672b5d6..02e73afa590c9 100644 --- a/fml/memory/weak_ptr_internal.cc +++ b/fml/memory/weak_ptr_internal.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/memory/weak_ptr_internal.h b/fml/memory/weak_ptr_internal.h index 246a2d851da87..28d1fca6d4f57 100644 --- a/fml/memory/weak_ptr_internal.h +++ b/fml/memory/weak_ptr_internal.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/memory/weak_ptr_unittest.cc b/fml/memory/weak_ptr_unittest.cc index 3e0ecdd834bbc..1d8fd9c390781 100644 --- a/fml/memory/weak_ptr_unittest.cc +++ b/fml/memory/weak_ptr_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/message.cc b/fml/message.cc index 7ee778fc1ffa8..4ef7ab3b32274 100644 --- a/fml/message.cc +++ b/fml/message.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,10 @@ namespace fml { +size_t MessageSerializable::GetSerializableTag() const { + return 0; +}; + Message::Message() = default; Message::~Message() = default; @@ -96,7 +100,7 @@ uint8_t* Message::PrepareDecode(size_t size) { if ((size + size_read_) > buffer_length_) { return nullptr; } - auto buffer = buffer_ + size_read_; + auto* buffer = buffer_ + size_read_; size_read_ += size; return buffer; } diff --git a/fml/message.h b/fml/message.h index 607faee048fa6..f9d6bf804ed85 100644 --- a/fml/message.h +++ b/fml/message.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -47,7 +47,7 @@ class MessageSerializable { virtual bool Deserialize(Message& message) = 0; - virtual size_t GetSerializableTag() const { return 0; }; + virtual size_t GetSerializableTag() const; }; // The traits passed to the encode/decode calls that accept traits should be @@ -88,7 +88,7 @@ class Message { template ::value>> FML_WARN_UNUSED_RESULT bool Encode(const T& value) { - if (auto buffer = PrepareEncode(sizeof(T))) { + if (auto* buffer = PrepareEncode(sizeof(T))) { ::memcpy(buffer, &value, sizeof(T)); return true; } @@ -131,7 +131,7 @@ class Message { template ::value>> FML_WARN_UNUSED_RESULT bool Decode(T& value) { - if (auto buffer = PrepareDecode(sizeof(T))) { + if (auto* buffer = PrepareDecode(sizeof(T))) { ::memcpy(&value, buffer, sizeof(T)); return true; } diff --git a/fml/message_loop.cc b/fml/message_loop.cc index 9c2275e219a00..469d47207566a 100644 --- a/fml/message_loop.cc +++ b/fml/message_loop.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,7 +19,7 @@ FML_THREAD_LOCAL ThreadLocal tls_message_loop([](intptr_t value) { }); MessageLoop& MessageLoop::GetCurrent() { - auto loop = reinterpret_cast(tls_message_loop.Get()); + auto* loop = reinterpret_cast(tls_message_loop.Get()); FML_CHECK(loop != nullptr) << "MessageLoop::EnsureInitializedForCurrentThread was not called on " "this thread prior to message loop use."; diff --git a/fml/message_loop.h b/fml/message_loop.h index 8deaca2aab1a3..6ca54a94c18a3 100644 --- a/fml/message_loop.h +++ b/fml/message_loop.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/message_loop_impl.cc b/fml/message_loop_impl.cc index 8a1d17ba76614..4d2c5bf4ff614 100644 --- a/fml/message_loop_impl.cc +++ b/fml/message_loop_impl.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -145,4 +145,13 @@ void MessageLoopImpl::RunExpiredTasks() { } } +MessageLoopImpl::DelayedTask::DelayedTask(size_t p_order, + fml::closure p_task, + fml::TimePoint p_target_time) + : order(p_order), task(std::move(p_task)), target_time(p_target_time) {} + +MessageLoopImpl::DelayedTask::DelayedTask(const DelayedTask& other) = default; + +MessageLoopImpl::DelayedTask::~DelayedTask() = default; + } // namespace fml diff --git a/fml/message_loop_impl.h b/fml/message_loop_impl.h index 523ea7fa59536..9dab218d0d1db 100644 --- a/fml/message_loop_impl.h +++ b/fml/message_loop_impl.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -57,8 +57,11 @@ class MessageLoopImpl : public fml::RefCountedThreadSafe { DelayedTask(size_t p_order, fml::closure p_task, - fml::TimePoint p_target_time) - : order(p_order), task(std::move(p_task)), target_time(p_target_time) {} + fml::TimePoint p_target_time); + + DelayedTask(const DelayedTask& other); + + ~DelayedTask(); }; struct DelayedTaskCompare { diff --git a/fml/message_loop_unittests.cc b/fml/message_loop_unittests.cc index e52a7bf93cd0c..d751071b9e8c8 100644 --- a/fml/message_loop_unittests.cc +++ b/fml/message_loop_unittests.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/message_unittests.cc b/fml/message_unittests.cc index 284c90512239c..5ac57fffdd80e 100644 --- a/fml/message_unittests.cc +++ b/fml/message_unittests.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/native_library.h b/fml/native_library.h index 6ec79d9ba0281..403fe5f531445 100644 --- a/fml/native_library.h +++ b/fml/native_library.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/paths.cc b/fml/paths.cc index 563595ad147a4..87a4ef27fd0f6 100644 --- a/fml/paths.cc +++ b/fml/paths.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/paths.h b/fml/paths.h index 5bb6f8affe3bd..69408317a24b5 100644 --- a/fml/paths.h +++ b/fml/paths.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/paths_unittests.cc b/fml/paths_unittests.cc index a1df4ea214e0f..41abbd3117587 100644 --- a/fml/paths_unittests.cc +++ b/fml/paths_unittests.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/android/jni_util.cc b/fml/platform/android/jni_util.cc index 86884327beb25..b84a351f1c913 100644 --- a/fml/platform/android/jni_util.cc +++ b/fml/platform/android/jni_util.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/android/jni_util.h b/fml/platform/android/jni_util.h index bfd58ae0cdf20..9fe32242c503c 100644 --- a/fml/platform/android/jni_util.h +++ b/fml/platform/android/jni_util.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/android/jni_weak_ref.cc b/fml/platform/android/jni_weak_ref.cc index ffd2b3c855738..70ff1b27ccab2 100644 --- a/fml/platform/android/jni_weak_ref.cc +++ b/fml/platform/android/jni_weak_ref.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/android/jni_weak_ref.h b/fml/platform/android/jni_weak_ref.h index cab86b429a70a..8162c3f462089 100644 --- a/fml/platform/android/jni_weak_ref.h +++ b/fml/platform/android/jni_weak_ref.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/android/message_loop_android.cc b/fml/platform/android/message_loop_android.cc index 131f4f092258a..c45160d6d6d14 100644 --- a/fml/platform/android/message_loop_android.cc +++ b/fml/platform/android/message_loop_android.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/android/message_loop_android.h b/fml/platform/android/message_loop_android.h index 8d562c70aad7c..b73b06e3db2c7 100644 --- a/fml/platform/android/message_loop_android.h +++ b/fml/platform/android/message_loop_android.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/android/paths_android.cc b/fml/platform/android/paths_android.cc index a6104601cdddc..36f5844a15c3b 100644 --- a/fml/platform/android/paths_android.cc +++ b/fml/platform/android/paths_android.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/android/paths_android.h b/fml/platform/android/paths_android.h index b9ebe2ebf7e64..99c2defdfa867 100644 --- a/fml/platform/android/paths_android.h +++ b/fml/platform/android/paths_android.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/android/scoped_java_ref.cc b/fml/platform/android/scoped_java_ref.cc index f8d68c0f0df79..2900379219206 100644 --- a/fml/platform/android/scoped_java_ref.cc +++ b/fml/platform/android/scoped_java_ref.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/android/scoped_java_ref.h b/fml/platform/android/scoped_java_ref.h index 5bc9f1019b8f2..7fe8828e216c4 100644 --- a/fml/platform/android/scoped_java_ref.h +++ b/fml/platform/android/scoped_java_ref.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/darwin/cf_utils.cc b/fml/platform/darwin/cf_utils.cc index 9fede1f1238b9..e7009992cf68d 100644 --- a/fml/platform/darwin/cf_utils.cc +++ b/fml/platform/darwin/cf_utils.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/darwin/cf_utils.h b/fml/platform/darwin/cf_utils.h index b8e64372e605c..f6be04abaaa71 100644 --- a/fml/platform/darwin/cf_utils.h +++ b/fml/platform/darwin/cf_utils.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/darwin/message_loop_darwin.h b/fml/platform/darwin/message_loop_darwin.h index 6d53e9000f821..94005ae4c931a 100644 --- a/fml/platform/darwin/message_loop_darwin.h +++ b/fml/platform/darwin/message_loop_darwin.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/darwin/message_loop_darwin.mm b/fml/platform/darwin/message_loop_darwin.mm index e258d38519b6b..ca714c81a4bbd 100644 --- a/fml/platform/darwin/message_loop_darwin.mm +++ b/fml/platform/darwin/message_loop_darwin.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/darwin/paths_darwin.mm b/fml/platform/darwin/paths_darwin.mm index 025eec73a103d..72e6f35a80949 100644 --- a/fml/platform/darwin/paths_darwin.mm +++ b/fml/platform/darwin/paths_darwin.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/darwin/platform_version.h b/fml/platform/darwin/platform_version.h index bec2ed7ed6346..0978a40d5ac06 100644 --- a/fml/platform/darwin/platform_version.h +++ b/fml/platform/darwin/platform_version.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/darwin/platform_version.mm b/fml/platform/darwin/platform_version.mm index 152c217c7714f..61274044f7d76 100644 --- a/fml/platform/darwin/platform_version.mm +++ b/fml/platform/darwin/platform_version.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/darwin/scoped_block.h b/fml/platform/darwin/scoped_block.h index 758bb0886da7c..17dee5833cb24 100644 --- a/fml/platform/darwin/scoped_block.h +++ b/fml/platform/darwin/scoped_block.h @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/darwin/scoped_block.mm b/fml/platform/darwin/scoped_block.mm index faad92641dce0..3969ed48861bd 100644 --- a/fml/platform/darwin/scoped_block.mm +++ b/fml/platform/darwin/scoped_block.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/darwin/scoped_nsobject.h b/fml/platform/darwin/scoped_nsobject.h index 525185fa6df0b..c2580f22b7724 100644 --- a/fml/platform/darwin/scoped_nsobject.h +++ b/fml/platform/darwin/scoped_nsobject.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -42,12 +42,10 @@ class scoped_nsprotocol { public: explicit scoped_nsprotocol(NST object = nil) : object_(object) {} - scoped_nsprotocol(const scoped_nsprotocol& that) - : object_([that.object_ retain]) {} + scoped_nsprotocol(const scoped_nsprotocol& that) : object_([that.object_ retain]) {} template - scoped_nsprotocol(const scoped_nsprotocol& that) - : object_([that.get() retain]) {} + scoped_nsprotocol(const scoped_nsprotocol& that) : object_([that.get() retain]) {} ~scoped_nsprotocol() { [object_ release]; } @@ -113,15 +111,12 @@ bool operator!=(C p1, const scoped_nsprotocol& p2) { template class scoped_nsobject : public scoped_nsprotocol { public: - explicit scoped_nsobject(NST* object = nil) - : scoped_nsprotocol(object) {} + explicit scoped_nsobject(NST* object = nil) : scoped_nsprotocol(object) {} - scoped_nsobject(const scoped_nsobject& that) - : scoped_nsprotocol(that) {} + scoped_nsobject(const scoped_nsobject& that) : scoped_nsprotocol(that) {} template - scoped_nsobject(const scoped_nsobject& that) - : scoped_nsprotocol(that) {} + scoped_nsobject(const scoped_nsobject& that) : scoped_nsprotocol(that) {} scoped_nsobject& operator=(const scoped_nsobject& that) { scoped_nsprotocol::operator=(that); @@ -135,12 +130,10 @@ class scoped_nsobject : public scoped_nsprotocol { public: explicit scoped_nsobject(id object = nil) : scoped_nsprotocol(object) {} - scoped_nsobject(const scoped_nsobject& that) - : scoped_nsprotocol(that) {} + scoped_nsobject(const scoped_nsobject& that) : scoped_nsprotocol(that) {} template - scoped_nsobject(const scoped_nsobject& that) - : scoped_nsprotocol(that) {} + scoped_nsobject(const scoped_nsobject& that) : scoped_nsprotocol(that) {} scoped_nsobject& operator=(const scoped_nsobject& that) { scoped_nsprotocol::operator=(that); diff --git a/fml/platform/darwin/scoped_nsobject.mm b/fml/platform/darwin/scoped_nsobject.mm index a82b1ce8a8726..8ff8d2934f57d 100644 --- a/fml/platform/darwin/scoped_nsobject.mm +++ b/fml/platform/darwin/scoped_nsobject.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/fuchsia/paths_fuchsia.cc b/fml/platform/fuchsia/paths_fuchsia.cc index 62a2fb0854c23..1b033079ec776 100644 --- a/fml/platform/fuchsia/paths_fuchsia.cc +++ b/fml/platform/fuchsia/paths_fuchsia.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/linux/message_loop_linux.cc b/fml/platform/linux/message_loop_linux.cc index 251a0a8c3bb80..483efe59af348 100644 --- a/fml/platform/linux/message_loop_linux.cc +++ b/fml/platform/linux/message_loop_linux.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/linux/message_loop_linux.h b/fml/platform/linux/message_loop_linux.h index 26cba078d5dcf..32bdb6442789e 100644 --- a/fml/platform/linux/message_loop_linux.h +++ b/fml/platform/linux/message_loop_linux.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/linux/paths_linux.cc b/fml/platform/linux/paths_linux.cc index a6b178970782e..5749bf2ba7807 100644 --- a/fml/platform/linux/paths_linux.cc +++ b/fml/platform/linux/paths_linux.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/linux/timerfd.cc b/fml/platform/linux/timerfd.cc index d5be484702830..0a2cc5311d846 100644 --- a/fml/platform/linux/timerfd.cc +++ b/fml/platform/linux/timerfd.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/linux/timerfd.h b/fml/platform/linux/timerfd.h index 4a56af5553828..6d5ab1a939434 100644 --- a/fml/platform/linux/timerfd.h +++ b/fml/platform/linux/timerfd.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/posix/file_posix.cc b/fml/platform/posix/file_posix.cc index 99a202586d541..d30a9c2f1d2df 100644 --- a/fml/platform/posix/file_posix.cc +++ b/fml/platform/posix/file_posix.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,7 +19,7 @@ namespace fml { std::string CreateTemporaryDirectory() { char directory_name[] = "/tmp/flutter_XXXXXXXX"; - auto result = ::mkdtemp(directory_name); + auto* result = ::mkdtemp(directory_name); if (result == nullptr) { return ""; } diff --git a/fml/platform/posix/mapping_posix.cc b/fml/platform/posix/mapping_posix.cc index 273eb0e668f2e..bc5adbd107544 100644 --- a/fml/platform/posix/mapping_posix.cc +++ b/fml/platform/posix/mapping_posix.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -69,7 +69,7 @@ FileMapping::FileMapping(const fml::UniqueFD& handle, const auto is_writable = IsWritable(protection); - auto mapping = + auto* mapping = ::mmap(nullptr, stat_buffer.st_size, ToPosixProtectionFlags(protection), is_writable ? MAP_SHARED : MAP_PRIVATE, handle.get(), 0); diff --git a/fml/platform/posix/native_library_posix.cc b/fml/platform/posix/native_library_posix.cc index 16ce46d08a3f7..558061e739673 100644 --- a/fml/platform/posix/native_library_posix.cc +++ b/fml/platform/posix/native_library_posix.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -58,7 +58,7 @@ fml::RefPtr NativeLibrary::CreateForCurrentProcess() { } const uint8_t* NativeLibrary::ResolveSymbol(const char* symbol) { - auto resolved_symbol = static_cast(::dlsym(handle_, symbol)); + auto* resolved_symbol = static_cast(::dlsym(handle_, symbol)); if (resolved_symbol == nullptr) { FML_DLOG(INFO) << "Could not resolve symbol in library: " << symbol; } diff --git a/fml/platform/posix/paths_posix.cc b/fml/platform/posix/paths_posix.cc index 6b93d6f97a8aa..b21f9e4956350 100644 --- a/fml/platform/posix/paths_posix.cc +++ b/fml/platform/posix/paths_posix.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/posix/shared_mutex_posix.cc b/fml/platform/posix/shared_mutex_posix.cc new file mode 100644 index 0000000000000..1435088f09f52 --- /dev/null +++ b/fml/platform/posix/shared_mutex_posix.cc @@ -0,0 +1,34 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/fml/platform/posix/shared_mutex_posix.h" +#include "flutter/fml/logging.h" + +namespace fml { + +SharedMutex* SharedMutex::Create() { + return new SharedMutexPosix(); +} + +SharedMutexPosix::SharedMutexPosix() { + FML_CHECK(pthread_rwlock_init(&rwlock_, nullptr) == 0); +} + +void SharedMutexPosix::Lock() { + pthread_rwlock_wrlock(&rwlock_); +} + +void SharedMutexPosix::LockShared() { + pthread_rwlock_rdlock(&rwlock_); +} + +void SharedMutexPosix::Unlock() { + pthread_rwlock_unlock(&rwlock_); +} + +void SharedMutexPosix::UnlockShared() { + pthread_rwlock_unlock(&rwlock_); +} + +} // namespace fml diff --git a/fml/platform/posix/shared_mutex_posix.h b/fml/platform/posix/shared_mutex_posix.h new file mode 100644 index 0000000000000..a0ab683b47eba --- /dev/null +++ b/fml/platform/posix/shared_mutex_posix.h @@ -0,0 +1,29 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FML_SYNCHRONIZATION_SHARED_MUTEX_POSIX_H_ +#define FLUTTER_FML_SYNCHRONIZATION_SHARED_MUTEX_POSIX_H_ + +#include +#include "flutter/fml/synchronization/shared_mutex.h" + +namespace fml { + +class SharedMutexPosix : public SharedMutex { + public: + virtual void Lock(); + virtual void LockShared(); + virtual void Unlock(); + virtual void UnlockShared(); + + private: + friend SharedMutex* SharedMutex::Create(); + SharedMutexPosix(); + + pthread_rwlock_t rwlock_; +}; + +} // namespace fml + +#endif // FLUTTER_FML_SYNCHRONIZATION_SHARED_MUTEX_POSIX_H_ diff --git a/fml/platform/win/errors_win.cc b/fml/platform/win/errors_win.cc index b19b2b5e52c04..7370ee86ff425 100644 --- a/fml/platform/win/errors_win.cc +++ b/fml/platform/win/errors_win.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/win/errors_win.h b/fml/platform/win/errors_win.h index 2ddf32936f7a3..4ec3c1d4ffe88 100644 --- a/fml/platform/win/errors_win.h +++ b/fml/platform/win/errors_win.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/win/file_win.cc b/fml/platform/win/file_win.cc index cef530e8045e2..dfb3d8dd36f30 100644 --- a/fml/platform/win/file_win.cc +++ b/fml/platform/win/file_win.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/win/mapping_win.cc b/fml/platform/win/mapping_win.cc index aaacdb4b8d76f..0b9427451e08e 100644 --- a/fml/platform/win/mapping_win.cc +++ b/fml/platform/win/mapping_win.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/win/message_loop_win.cc b/fml/platform/win/message_loop_win.cc index 58f1569dd1679..7f529d1deaff5 100644 --- a/fml/platform/win/message_loop_win.cc +++ b/fml/platform/win/message_loop_win.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/win/message_loop_win.h b/fml/platform/win/message_loop_win.h index aeb784b45e490..6317959a9cb3d 100644 --- a/fml/platform/win/message_loop_win.h +++ b/fml/platform/win/message_loop_win.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/win/native_library_win.cc b/fml/platform/win/native_library_win.cc index 1ff997219bfb4..3a741893966eb 100644 --- a/fml/platform/win/native_library_win.cc +++ b/fml/platform/win/native_library_win.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/win/paths_win.cc b/fml/platform/win/paths_win.cc index 156ac70f986b9..56130f7408877 100644 --- a/fml/platform/win/paths_win.cc +++ b/fml/platform/win/paths_win.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/platform/win/wstring_conversion.h b/fml/platform/win/wstring_conversion.h index 35908fe5a222e..8258ba59f722c 100644 --- a/fml/platform/win/wstring_conversion.h +++ b/fml/platform/win/wstring_conversion.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/string_view.cc b/fml/string_view.cc index 52af03b1309f6..5f217c439f50c 100644 --- a/fml/string_view.cc +++ b/fml/string_view.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -84,7 +84,7 @@ size_t StringView::find(StringView s, size_t pos) const { if (s.empty()) return pos; - auto result = std::search(begin() + pos, end(), s.begin(), s.end()); + auto* result = std::search(begin() + pos, end(), s.begin(), s.end()); if (result == end()) return npos; return result - begin(); @@ -94,7 +94,7 @@ size_t StringView::find(char c, size_t pos) const { if (pos > size_) return npos; - auto result = std::find(begin() + pos, end(), c); + auto* result = std::find(begin() + pos, end(), c); if (result == end()) return npos; return result - begin(); @@ -106,8 +106,8 @@ size_t StringView::rfind(StringView s, size_t pos) const { if (s.empty()) return std::min(pos, size_); - auto last = begin() + std::min(size_ - s.size(), pos) + s.size(); - auto result = std::find_end(begin(), last, s.begin(), s.end()); + auto* last = begin() + std::min(size_ - s.size(), pos) + s.size(); + auto* result = std::find_end(begin(), last, s.begin(), s.end()); if (result == last) return npos; return result - begin(); diff --git a/fml/string_view.h b/fml/string_view.h index d4f34a45dfc60..226b84f21479a 100644 --- a/fml/string_view.h +++ b/fml/string_view.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/string_view_unittest.cc b/fml/string_view_unittest.cc index 8dab1500ff7ca..dadf3c669d9fe 100644 --- a/fml/string_view_unittest.cc +++ b/fml/string_view_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/synchronization/atomic_object.h b/fml/synchronization/atomic_object.h new file mode 100644 index 0000000000000..2a06792ff4a24 --- /dev/null +++ b/fml/synchronization/atomic_object.h @@ -0,0 +1,36 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FML_SYNCHRONIZATION_ATOMIC_OBJECT_H_ +#define FLUTTER_FML_SYNCHRONIZATION_ATOMIC_OBJECT_H_ + +#include + +namespace fml { + +// A wrapper for an object instance that can be read or written atomically. +template +class AtomicObject { + public: + AtomicObject() = default; + AtomicObject(T object) : object_(object) {} + + T Load() const { + std::lock_guard lock(mutex_); + return object_; + } + + void Store(const T& object) { + std::lock_guard lock(mutex_); + object_ = object; + } + + private: + mutable std::mutex mutex_; + T object_; +}; + +} // namespace fml + +#endif // FLUTTER_FML_SYNCHRONIZATION_ATOMIC_OBJECT_H_ diff --git a/fml/synchronization/count_down_latch.cc b/fml/synchronization/count_down_latch.cc new file mode 100644 index 0000000000000..6273eacb6ad54 --- /dev/null +++ b/fml/synchronization/count_down_latch.cc @@ -0,0 +1,29 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/fml/synchronization/count_down_latch.h" + +#include "flutter/fml/logging.h" + +namespace fml { + +CountDownLatch::CountDownLatch(size_t count) : count_(count) { + if (count_ == 0) { + waitable_event_.Signal(); + } +} + +CountDownLatch::~CountDownLatch() = default; + +void CountDownLatch::Wait() { + waitable_event_.Wait(); +} + +void CountDownLatch::CountDown() { + if (--count_ == 0) { + waitable_event_.Signal(); + } +} + +} // namespace fml diff --git a/fml/synchronization/count_down_latch.h b/fml/synchronization/count_down_latch.h new file mode 100644 index 0000000000000..2036e82a3f8fd --- /dev/null +++ b/fml/synchronization/count_down_latch.h @@ -0,0 +1,29 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +#include "flutter/fml/macros.h" +#include "flutter/fml/synchronization/waitable_event.h" + +namespace fml { + +class CountDownLatch { + public: + CountDownLatch(size_t count); + + ~CountDownLatch(); + + void Wait(); + + void CountDown(); + + private: + std::atomic_size_t count_; + ManualResetWaitableEvent waitable_event_; + + FML_DISALLOW_COPY_AND_ASSIGN(CountDownLatch); +}; + +} // namespace fml diff --git a/fml/synchronization/count_down_latch_unittests.cc b/fml/synchronization/count_down_latch_unittests.cc new file mode 100644 index 0000000000000..c23fc82638f96 --- /dev/null +++ b/fml/synchronization/count_down_latch_unittests.cc @@ -0,0 +1,39 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include +#include + +#include "flutter/fml/synchronization/count_down_latch.h" +#include "flutter/fml/thread.h" +#include "flutter/testing/testing.h" + +namespace fml { + +TEST(CountDownLatchTest, CanWaitOnZero) { + CountDownLatch latch(0); + latch.Wait(); +} + +TEST(CountDownLatchTest, CanWait) { + fml::Thread thread("test_thread"); + const size_t count = 100; + size_t current_count = 0; + CountDownLatch latch(count); + auto decrement_latch_on_thread = [runner = thread.GetTaskRunner(), &latch, + ¤t_count]() { + runner->PostTask([&latch, ¤t_count]() { + std::this_thread::sleep_for(std::chrono::microseconds(100)); + current_count++; + latch.CountDown(); + }); + }; + for (size_t i = 0; i < count; ++i) { + decrement_latch_on_thread(); + } + latch.Wait(); + ASSERT_EQ(current_count, count); +} + +} // namespace fml diff --git a/fml/synchronization/shared_mutex.h b/fml/synchronization/shared_mutex.h new file mode 100644 index 0000000000000..a5f343d2d5e49 --- /dev/null +++ b/fml/synchronization/shared_mutex.h @@ -0,0 +1,50 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FML_SYNCHRONIZATION_SHARED_MUTEX_H_ +#define FLUTTER_FML_SYNCHRONIZATION_SHARED_MUTEX_H_ + +namespace fml { + +// Interface for a reader/writer lock. +class SharedMutex { + public: + static SharedMutex* Create(); + virtual ~SharedMutex() = default; + + virtual void Lock() = 0; + virtual void LockShared() = 0; + virtual void Unlock() = 0; + virtual void UnlockShared() = 0; +}; + +// RAII wrapper that does a shared acquire of a SharedMutex. +class SharedLock { + public: + explicit SharedLock(SharedMutex& shared_mutex) : shared_mutex_(shared_mutex) { + shared_mutex_.LockShared(); + } + + ~SharedLock() { shared_mutex_.UnlockShared(); } + + private: + SharedMutex& shared_mutex_; +}; + +// RAII wrapper that does an exclusive acquire of a SharedMutex. +class UniqueLock { + public: + explicit UniqueLock(SharedMutex& shared_mutex) : shared_mutex_(shared_mutex) { + shared_mutex_.Lock(); + } + + ~UniqueLock() { shared_mutex_.Unlock(); } + + private: + SharedMutex& shared_mutex_; +}; + +} // namespace fml + +#endif // FLUTTER_FML_SYNCHRONIZATION_SHARED_MUTEX_H_ diff --git a/fml/synchronization/shared_mutex_std.cc b/fml/synchronization/shared_mutex_std.cc new file mode 100644 index 0000000000000..41754446abd1f --- /dev/null +++ b/fml/synchronization/shared_mutex_std.cc @@ -0,0 +1,29 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/fml/synchronization/shared_mutex_std.h" + +namespace fml { + +SharedMutex* SharedMutex::Create() { + return new SharedMutexStd(); +} + +void SharedMutexStd::Lock() { + mutex_.lock(); +} + +void SharedMutexStd::LockShared() { + mutex_.lock_shared(); +} + +void SharedMutexStd::Unlock() { + mutex_.unlock(); +} + +void SharedMutexStd::UnlockShared() { + mutex_.unlock_shared(); +} + +} // namespace fml diff --git a/fml/synchronization/shared_mutex_std.h b/fml/synchronization/shared_mutex_std.h new file mode 100644 index 0000000000000..a9b1b9338a598 --- /dev/null +++ b/fml/synchronization/shared_mutex_std.h @@ -0,0 +1,29 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FML_SYNCHRONIZATION_SHARED_MUTEX_STD_H_ +#define FLUTTER_FML_SYNCHRONIZATION_SHARED_MUTEX_STD_H_ + +#include +#include "flutter/fml/synchronization/shared_mutex.h" + +namespace fml { + +class SharedMutexStd : public SharedMutex { + public: + virtual void Lock(); + virtual void LockShared(); + virtual void Unlock(); + virtual void UnlockShared(); + + private: + friend SharedMutex* SharedMutex::Create(); + SharedMutexStd() = default; + + std::shared_timed_mutex mutex_; +}; + +} // namespace fml + +#endif // FLUTTER_FML_SYNCHRONIZATION_SHARED_MUTEX_STD_H_ diff --git a/fml/synchronization/thread_annotations.h b/fml/synchronization/thread_annotations.h index 1b7bf6ecc6903..f5ae885782b5c 100644 --- a/fml/synchronization/thread_annotations.h +++ b/fml/synchronization/thread_annotations.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/synchronization/thread_annotations_unittest.cc b/fml/synchronization/thread_annotations_unittest.cc index 12769451dcf36..7462614ba608f 100644 --- a/fml/synchronization/thread_annotations_unittest.cc +++ b/fml/synchronization/thread_annotations_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/synchronization/thread_checker.h b/fml/synchronization/thread_checker.h index 13a3e6824d0d3..3501ac5d4a9e5 100644 --- a/fml/synchronization/thread_checker.h +++ b/fml/synchronization/thread_checker.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/synchronization/thread_checker_unittest.cc b/fml/synchronization/thread_checker_unittest.cc index 46203e43adba4..92eb34f166157 100644 --- a/fml/synchronization/thread_checker_unittest.cc +++ b/fml/synchronization/thread_checker_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/synchronization/waitable_event.cc b/fml/synchronization/waitable_event.cc index 04052c60ed79d..7064f5db6903c 100644 --- a/fml/synchronization/waitable_event.cc +++ b/fml/synchronization/waitable_event.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/synchronization/waitable_event.h b/fml/synchronization/waitable_event.h index 60306aaa7897e..33640ded23466 100644 --- a/fml/synchronization/waitable_event.h +++ b/fml/synchronization/waitable_event.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/synchronization/waitable_event_unittest.cc b/fml/synchronization/waitable_event_unittest.cc index 92f40577dc9e5..aa420910d72fe 100644 --- a/fml/synchronization/waitable_event_unittest.cc +++ b/fml/synchronization/waitable_event_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/task_runner.cc b/fml/task_runner.cc index 573c1bb8b7b34..2c4cfe4b638a2 100644 --- a/fml/task_runner.cc +++ b/fml/task_runner.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/task_runner.h b/fml/task_runner.h index 0a196604fac81..04696752c95e3 100644 --- a/fml/task_runner.h +++ b/fml/task_runner.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/thread.cc b/fml/thread.cc index 5690d73d51f17..b6a4802b48728 100644 --- a/fml/thread.cc +++ b/fml/thread.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/thread.h b/fml/thread.h index aced4bbebdb80..19a6e5ec3ba43 100644 --- a/fml/thread.h +++ b/fml/thread.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/thread_local.cc b/fml/thread_local.cc new file mode 100644 index 0000000000000..d0afbc00186a0 --- /dev/null +++ b/fml/thread_local.cc @@ -0,0 +1,69 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/fml/thread_local.h" + +namespace fml { + +#if FML_THREAD_LOCAL_PTHREADS + +ThreadLocal::ThreadLocal() : ThreadLocal(nullptr) {} + +ThreadLocal::ThreadLocal(ThreadLocalDestroyCallback destroy) + : destroy_(destroy) { + auto callback = + reinterpret_cast(&ThreadLocal::ThreadLocalDestroy); + FML_CHECK(pthread_key_create(&_key, callback) == 0); +} + +ThreadLocal::~ThreadLocal() { + // This will NOT call the destroy callbacks on thread local values still + // active in other threads. Those must be cleared manually. The usage + // of this class should be similar to the thread_local keyword but with + // with a static storage specifier + + // Collect the container + delete reinterpret_cast(pthread_getspecific(_key)); + + // Finally, collect the key + FML_CHECK(pthread_key_delete(_key) == 0); +} + +ThreadLocal::Box::Box(ThreadLocalDestroyCallback destroy, intptr_t value) + : destroy_(destroy), value_(value) {} + +ThreadLocal::Box::~Box() = default; + +#else // FML_THREAD_LOCAL_PTHREADS + +ThreadLocal::ThreadLocal() : ThreadLocal(nullptr) {} + +ThreadLocal::ThreadLocal(ThreadLocalDestroyCallback destroy) + : destroy_(destroy), value_(0) {} + +void ThreadLocal::Set(intptr_t value) { + if (value_ == value) { + return; + } + + if (value_ != 0 && destroy_) { + destroy_(value_); + } + + value_ = value; +} + +intptr_t ThreadLocal::Get() { + return value_; +} + +ThreadLocal::~ThreadLocal() { + if (value_ != 0 && destroy_) { + destroy_(value_); + } +} + +#endif // FML_THREAD_LOCAL_PTHREADS + +} // namespace fml diff --git a/fml/thread_local.h b/fml/thread_local.h index a36d80601f6e6..4bf518244a6e9 100644 --- a/fml/thread_local.h +++ b/fml/thread_local.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -31,8 +31,9 @@ class ThreadLocal { private: class Box { public: - Box(ThreadLocalDestroyCallback destroy, intptr_t value) - : destroy_(destroy), value_(value) {} + Box(ThreadLocalDestroyCallback destroy, intptr_t value); + + ~Box(); intptr_t Value() const { return value_; } @@ -60,22 +61,18 @@ class ThreadLocal { static inline void ThreadLocalDestroy(void* value) { FML_CHECK(value != nullptr); - auto box = reinterpret_cast(value); + auto* box = reinterpret_cast(value); box->DestroyValue(); delete box; } public: - ThreadLocal() : ThreadLocal(nullptr) {} + ThreadLocal(); - ThreadLocal(ThreadLocalDestroyCallback destroy) : destroy_(destroy) { - auto callback = - reinterpret_cast(&ThreadLocal::ThreadLocalDestroy); - FML_CHECK(pthread_key_create(&_key, callback) == 0); - } + ThreadLocal(ThreadLocalDestroyCallback destroy); void Set(intptr_t value) { - auto box = reinterpret_cast(pthread_getspecific(_key)); + auto* box = reinterpret_cast(pthread_getspecific(_key)); if (box == nullptr) { box = new Box(destroy_, value); FML_CHECK(pthread_setspecific(_key, box) == 0); @@ -85,22 +82,11 @@ class ThreadLocal { } intptr_t Get() { - auto box = reinterpret_cast(pthread_getspecific(_key)); + auto* box = reinterpret_cast(pthread_getspecific(_key)); return box != nullptr ? box->Value() : 0; } - ~ThreadLocal() { - // This will NOT call the destroy callbacks on thread local values still - // active in other threads. Those must be cleared manually. The usage - // of this class should be similar to the thread_local keyword but with - // with a static storage specifier - - // Collect the container - delete reinterpret_cast(pthread_getspecific(_key)); - - // Finally, collect the key - FML_CHECK(pthread_key_delete(_key) == 0); - } + ~ThreadLocal(); private: pthread_key_t _key; @@ -115,30 +101,15 @@ class ThreadLocal { class ThreadLocal { public: - ThreadLocal() : ThreadLocal(nullptr) {} + ThreadLocal(); - ThreadLocal(ThreadLocalDestroyCallback destroy) - : destroy_(destroy), value_(0) {} + ThreadLocal(ThreadLocalDestroyCallback destroy); - void Set(intptr_t value) { - if (value_ == value) { - return; - } + void Set(intptr_t value); - if (value_ != 0 && destroy_) { - destroy_(value_); - } - - value_ = value; - } + intptr_t Get(); - intptr_t Get() { return value_; } - - ~ThreadLocal() { - if (value_ != 0 && destroy_) { - destroy_(value_); - } - } + ~ThreadLocal(); private: ThreadLocalDestroyCallback destroy_; diff --git a/fml/thread_local_unittests.cc b/fml/thread_local_unittests.cc index 9ae5f82d35e16..7f48cfcd532f6 100644 --- a/fml/thread_local_unittests.cc +++ b/fml/thread_local_unittests.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/thread_unittests.cc b/fml/thread_unittests.cc index c4ee56779dab4..f48922d84485e 100644 --- a/fml/thread_unittests.cc +++ b/fml/thread_unittests.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/time/time_delta.h b/fml/time/time_delta.h index 1b7caa281084f..914fc738751cb 100644 --- a/fml/time/time_delta.h +++ b/fml/time/time_delta.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/time/time_delta_unittest.cc b/fml/time/time_delta_unittest.cc index 992b4f4a8b888..342006e5a6dca 100644 --- a/fml/time/time_delta_unittest.cc +++ b/fml/time/time_delta_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/time/time_point.cc b/fml/time/time_point.cc index 36ca1582372df..f0a912e92fdee 100644 --- a/fml/time/time_point.cc +++ b/fml/time/time_point.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/time/time_point.h b/fml/time/time_point.h index 500de54302a0b..4b6e44429f941 100644 --- a/fml/time/time_point.h +++ b/fml/time/time_point.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/time/time_point_unittest.cc b/fml/time/time_point_unittest.cc index 2de07b0582442..965cf81d487f7 100644 --- a/fml/time/time_point_unittest.cc +++ b/fml/time/time_point_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/time/time_unittest.cc b/fml/time/time_unittest.cc index eab352d947773..535d79ec5a824 100644 --- a/fml/time/time_unittest.cc +++ b/fml/time/time_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/trace_event.cc b/fml/trace_event.cc index 628b3b785e865..69ed8b2216486 100644 --- a/fml/trace_event.cc +++ b/fml/trace_event.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/trace_event.h b/fml/trace_event.h index 9dd094acaa2b3..b3bba9b281f61 100644 --- a/fml/trace_event.h +++ b/fml/trace_event.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/unique_fd.cc b/fml/unique_fd.cc index 09226c60149b7..dd115c2008b9e 100644 --- a/fml/unique_fd.cc +++ b/fml/unique_fd.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/unique_fd.h b/fml/unique_fd.h index 05dee99018f33..17f1a3cdaa216 100644 --- a/fml/unique_fd.h +++ b/fml/unique_fd.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/fml/unique_object.h b/fml/unique_object.h index e5f2f8690a644..f42603ef80451 100644 --- a/fml/unique_object.h +++ b/fml/unique_object.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/frontend_server/BUILD.gn b/frontend_server/BUILD.gn index b792d2bce3fb0..96a92ed0a04fa 100644 --- a/frontend_server/BUILD.gn +++ b/frontend_server/BUILD.gn @@ -1,26 +1,64 @@ -# Copyright 2017 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//third_party/dart/utils/application_snapshot.gni") +if (is_fuchsia_host || is_fuchsia) { + import("//build/dart/dart_library.gni") + import("//build/dart/dart_tool.gni") -application_snapshot("frontend_server") { - main_dart = "bin/starter.dart" - deps = [ - "$flutter_root/lib/snapshot:kernel_platform_files", - ] - dot_packages = rebase_path(".packages") - flutter_patched_sdk = rebase_path("$root_out_dir/flutter_patched_sdk") - training_args = [ "--train", "--sdk-root=$flutter_patched_sdk" ] + dart_library("frontend_server") { + disable_analysis = true + package_name = "frontend_server" - frontend_server_files = exec_script("//third_party/dart/tools/list_dart_files.py", - [ "absolute", rebase_path("."), ], "list lines") + sources = [ + "server.dart", + ] - frontend_server_files += exec_script("//third_party/dart/tools/list_dart_files.py", - [ "absolute", rebase_path("../flutter_kernel_transformers"), ], "list lines") + deps = [ + "//third_party/dart/pkg/build_integration", + "//third_party/dart/pkg/front_end", + "//third_party/dart/pkg/kernel", + "//third_party/dart/pkg/vm", + "//third_party/dart-pkg/pub/args", + "//third_party/dart-pkg/pub/path", + "//third_party/dart-pkg/pub/usage", + "//third_party/flutter/flutter_kernel_transformers" + ] + } - frontend_server_files += exec_script("//third_party/dart/tools/list_dart_files.py", - [ "absolute", rebase_path("../../third_party/dart/pkg"), ], "list lines") + dart_tool("frontend_server_tool") { + main_dart = "bin/starter.dart" + source_dir = "." + disable_analysis = true + output_name = "frontend_server" - inputs = frontend_server_files + sources = [] + + deps = [ + ":frontend_server", + ] + } +} else { + import("//third_party/dart/utils/application_snapshot.gni") + + application_snapshot("frontend_server") { + main_dart = "bin/starter.dart" + deps = [ + "$flutter_root/lib/snapshot:kernel_platform_files", + ] + dot_packages = rebase_path(".packages") + flutter_patched_sdk = rebase_path("$root_out_dir/flutter_patched_sdk") + training_args = [ "--train", "--sdk-root=$flutter_patched_sdk" ] + + frontend_server_files = exec_script("//third_party/dart/tools/list_dart_files.py", + [ "absolute", rebase_path("."), ], "list lines") + + frontend_server_files += exec_script("//third_party/dart/tools/list_dart_files.py", + [ "absolute", rebase_path("../flutter_kernel_transformers"), ], "list lines") + + frontend_server_files += exec_script("//third_party/dart/tools/list_dart_files.py", + [ "absolute", rebase_path("../../third_party/dart/pkg"), ], "list lines") + + inputs = frontend_server_files + } } diff --git a/frontend_server/lib/server.dart b/frontend_server/lib/server.dart index cdf958eed8d6b..5d84d2dcf95ba 100644 --- a/frontend_server/lib/server.dart +++ b/frontend_server/lib/server.dart @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -42,7 +42,7 @@ class _FlutterFrontendCompiler implements frontend.CompilerInterface{ } @override - Future rejectLastDelta() async { + Future rejectLastDelta() async { return _compiler.rejectLastDelta(); } diff --git a/lib/io/BUILD.gn b/lib/io/BUILD.gn index 5db1cf3563421..56c37705ef659 100644 --- a/lib/io/BUILD.gn +++ b/lib/io/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/lib/io/dart_io.cc b/lib/io/dart_io.cc index 6dbf65eb7bf2b..1b1866b4e8569 100644 --- a/lib/io/dart_io.cc +++ b/lib/io/dart_io.cc @@ -1,4 +1,4 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/io/dart_io.h b/lib/io/dart_io.h index 73203cfdf1bdb..6d2a36abbbf45 100644 --- a/lib/io/dart_io.h +++ b/lib/io/dart_io.h @@ -1,4 +1,4 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn index 4eaa3bd2482de..ef06063a2a1f2 100644 --- a/lib/snapshot/BUILD.gn +++ b/lib/snapshot/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -57,7 +57,6 @@ compiled_action("generate_snapshot_bin") { "--sync-async", "--reify-generic-functions", "--snapshot_kind=core", - "--await_is_keyword", "--enable_mirrors=false", "--vm_snapshot_data=" + rebase_path(vm_snapshot_data), "--vm_snapshot_instructions=" + rebase_path(vm_snapshot_instructions), @@ -169,7 +168,9 @@ source_set("snapshot") { } compile_platform("non_strong_platform") { - libraries_specification_uri = "libraries.json" + single_root_scheme = "org-dartlang-sdk" + single_root_base = rebase_path("../../../") + libraries_specification_uri = "org-dartlang-sdk:///flutter/lib/snapshot/libraries.json" outputs = [ "$root_out_dir/flutter_patched_sdk/platform.dill", @@ -183,7 +184,9 @@ compile_platform("non_strong_platform") { } compile_platform("strong_platform") { - libraries_specification_uri = "libraries.json" + single_root_scheme = "org-dartlang-sdk" + single_root_base = rebase_path("../../../") + libraries_specification_uri = "org-dartlang-sdk:///flutter/lib/snapshot/libraries.json" outputs = [ "$root_out_dir/flutter_patched_sdk/platform_strong.dill", @@ -192,7 +195,6 @@ compile_platform("strong_platform") { args = [ "--target=flutter", - "--strong", "dart:core", ] } diff --git a/lib/snapshot/pubspec.yaml b/lib/snapshot/pubspec.yaml index 1b1139ebc4c3d..54585c8caccc8 100644 --- a/lib/snapshot/pubspec.yaml +++ b/lib/snapshot/pubspec.yaml @@ -1,4 +1,4 @@ -# Copyright 2018 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/lib/snapshot/snapshot.dart b/lib/snapshot/snapshot.dart index 48ed29258750d..c411f09a22eae 100644 --- a/lib/snapshot/snapshot.dart +++ b/lib/snapshot/snapshot.dart @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/snapshot/snapshot.h b/lib/snapshot/snapshot.h index 2bb6f0a5d1650..6a9ebfe4ea6e7 100644 --- a/lib/snapshot/snapshot.h +++ b/lib/snapshot/snapshot.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/snapshot/snapshot_fuchsia.dart b/lib/snapshot/snapshot_fuchsia.dart index 1a9057d07bbee..5fafa124d8b2f 100644 --- a/lib/snapshot/snapshot_fuchsia.dart +++ b/lib/snapshot/snapshot_fuchsia.dart @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/BUILD.gn b/lib/ui/BUILD.gn index cfb8461b19615..dcfd483638eca 100644 --- a/lib/ui/BUILD.gn +++ b/lib/ui/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -23,6 +23,8 @@ source_set("ui") { "painting/canvas.h", "painting/codec.cc", "painting/codec.h", + "painting/engine_layer.cc", + "painting/engine_layer.h", "painting/frame_info.cc", "painting/frame_info.h", "painting/gradient.cc", @@ -63,6 +65,7 @@ source_set("ui") { "semantics/semantics_update.h", "semantics/semantics_update_builder.cc", "semantics/semantics_update_builder.h", + "snapshot_delegate.h", "text/asset_manager_font_provider.cc", "text/asset_manager_font_provider.h", "text/font_collection.cc", @@ -89,6 +92,7 @@ source_set("ui") { "window/pointer_data.h", "window/pointer_data_packet.cc", "window/pointer_data_packet.h", + "window/viewport_metrics.cc", "window/viewport_metrics.h", "window/window.cc", "window/window.h", @@ -105,8 +109,6 @@ source_set("ui") { "//third_party/dart/runtime/bin:dart_io_api", "//third_party/rapidjson", "//third_party/skia", - "//third_party/skia:effects", - "//third_party/skia:gpu", "//third_party/tonic", ] if (is_fuchsia) { diff --git a/lib/ui/compositing.dart b/lib/ui/compositing.dart index 1e2af68025d6e..89529c093fda9 100644 --- a/lib/ui/compositing.dart +++ b/lib/ui/compositing.dart @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,6 +10,7 @@ part of dart.ui; /// /// Scene objects can be displayed on the screen using the /// [Window.render] method. +@pragma('vm:entry-point') class Scene extends NativeFieldWrapperClass2 { /// This class is created by the engine, and should not be instantiated /// or extended directly. @@ -55,21 +56,21 @@ class SceneBuilder extends NativeFieldWrapperClass2 { /// The objects are transformed by the given matrix before rasterization. /// /// See [pop] for details about the operation stack. - void pushTransform(Float64List matrix4) { + EngineLayer pushTransform(Float64List matrix4) { if (matrix4 == null) throw new ArgumentError('"matrix4" argument cannot be null'); if (matrix4.length != 16) throw new ArgumentError('"matrix4" must have 16 entries.'); - _pushTransform(matrix4); + return _pushTransform(matrix4); } - void _pushTransform(Float64List matrix4) native 'SceneBuilder_pushTransform'; + EngineLayer _pushTransform(Float64List matrix4) native 'SceneBuilder_pushTransform'; /// Pushes an offset operation onto the operation stack. /// /// This is equivalent to [pushTransform] with a matrix with only translation. /// /// See [pop] for details about the operation stack. - void pushOffset(double dx, double dy) native 'SceneBuilder_pushOffset'; + EngineLayer pushOffset(double dx, double dy) native 'SceneBuilder_pushOffset'; /// Pushes a rectangular clip operation onto the operation stack. /// @@ -77,16 +78,16 @@ class SceneBuilder extends NativeFieldWrapperClass2 { /// /// See [pop] for details about the operation stack, and [Clip] for different clip modes. /// By default, the clip will be anti-aliased (clip = [Clip.antiAlias]). - void pushClipRect(Rect rect, {Clip clipBehavior = Clip.antiAlias}) { + EngineLayer pushClipRect(Rect rect, {Clip clipBehavior = Clip.antiAlias}) { assert(clipBehavior != null); assert(clipBehavior != Clip.none); - _pushClipRect(rect.left, rect.right, rect.top, rect.bottom, clipBehavior.index); + return _pushClipRect(rect.left, rect.right, rect.top, rect.bottom, clipBehavior.index); } - void _pushClipRect(double left, - double right, - double top, - double bottom, - int clipBehavior) native 'SceneBuilder_pushClipRect'; + EngineLayer _pushClipRect(double left, + double right, + double top, + double bottom, + int clipBehavior) native 'SceneBuilder_pushClipRect'; /// Pushes a rounded-rectangular clip operation onto the operation stack. /// @@ -94,12 +95,12 @@ class SceneBuilder extends NativeFieldWrapperClass2 { /// /// See [pop] for details about the operation stack, and [Clip] for different clip modes. /// By default, the clip will be anti-aliased (clip = [Clip.antiAlias]). - void pushClipRRect(RRect rrect, {Clip clipBehavior = Clip.antiAlias}) { + EngineLayer pushClipRRect(RRect rrect, {Clip clipBehavior = Clip.antiAlias}) { assert(clipBehavior != null); assert(clipBehavior != Clip.none); - _pushClipRRect(rrect._value, clipBehavior.index); + return _pushClipRRect(rrect._value, clipBehavior.index); } - void _pushClipRRect(Float32List rrect, int clipBehavior) native 'SceneBuilder_pushClipRRect'; + EngineLayer _pushClipRRect(Float32List rrect, int clipBehavior) native 'SceneBuilder_pushClipRRect'; /// Pushes a path clip operation onto the operation stack. /// @@ -107,12 +108,12 @@ class SceneBuilder extends NativeFieldWrapperClass2 { /// /// See [pop] for details about the operation stack. See [Clip] for different clip modes. /// By default, the clip will be anti-aliased (clip = [Clip.antiAlias]). - void pushClipPath(Path path, {Clip clipBehavior = Clip.antiAlias}) { + EngineLayer pushClipPath(Path path, {Clip clipBehavior = Clip.antiAlias}) { assert(clipBehavior != null); assert(clipBehavior != Clip.none); - _pushClipPath(path, clipBehavior.index); + return _pushClipPath(path, clipBehavior.index); } - void _pushClipPath(Path path, int clipBehavior) native 'SceneBuilder_pushClipPath'; + EngineLayer _pushClipPath(Path path, int clipBehavior) native 'SceneBuilder_pushClipPath'; /// Pushes an opacity operation onto the operation stack. /// @@ -122,7 +123,10 @@ class SceneBuilder extends NativeFieldWrapperClass2 { /// opacity). /// /// See [pop] for details about the operation stack. - void pushOpacity(int alpha) native 'SceneBuilder_pushOpacity'; + EngineLayer pushOpacity(int alpha, {Offset offset = Offset.zero}) { + return _pushOpacity(alpha, offset.dx, offset.dy); + } + EngineLayer _pushOpacity(int alpha, double dx, double dy) native 'SceneBuilder_pushOpacity'; /// Pushes a color filter operation onto the operation stack. /// @@ -130,10 +134,10 @@ class SceneBuilder extends NativeFieldWrapperClass2 { /// blend mode. /// /// See [pop] for details about the operation stack. - void pushColorFilter(Color color, BlendMode blendMode) { - _pushColorFilter(color.value, blendMode.index); + EngineLayer pushColorFilter(Color color, BlendMode blendMode) { + return _pushColorFilter(color.value, blendMode.index); } - void _pushColorFilter(int color, int blendMode) native 'SceneBuilder_pushColorFilter'; + EngineLayer _pushColorFilter(int color, int blendMode) native 'SceneBuilder_pushColorFilter'; /// Pushes a backdrop filter operation onto the operation stack. /// @@ -141,7 +145,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 { /// rasterizing the given objects. /// /// See [pop] for details about the operation stack. - void pushBackdropFilter(ImageFilter filter) native 'SceneBuilder_pushBackdropFilter'; + EngineLayer pushBackdropFilter(ImageFilter filter) native 'SceneBuilder_pushBackdropFilter'; /// Pushes a shader mask operation onto the operation stack. /// @@ -149,20 +153,20 @@ class SceneBuilder extends NativeFieldWrapperClass2 { /// rectangle using the given blend mode. /// /// See [pop] for details about the operation stack. - void pushShaderMask(Shader shader, Rect maskRect, BlendMode blendMode) { - _pushShaderMask(shader, - maskRect.left, - maskRect.right, - maskRect.top, - maskRect.bottom, - blendMode.index); + EngineLayer pushShaderMask(Shader shader, Rect maskRect, BlendMode blendMode) { + return _pushShaderMask(shader, + maskRect.left, + maskRect.right, + maskRect.top, + maskRect.bottom, + blendMode.index); } - void _pushShaderMask(Shader shader, - double maskRectLeft, - double maskRectRight, - double maskRectTop, - double maskRectBottom, - int blendMode) native 'SceneBuilder_pushShaderMask'; + EngineLayer _pushShaderMask(Shader shader, + double maskRectLeft, + double maskRectRight, + double maskRectTop, + double maskRectBottom, + int blendMode) native 'SceneBuilder_pushShaderMask'; /// Pushes a physical layer operation for an arbitrary shape onto the /// operation stack. @@ -177,10 +181,10 @@ class SceneBuilder extends NativeFieldWrapperClass2 { /// /// See [pop] for details about the operation stack, and [Clip] for different clip modes. // ignore: deprecated_member_use - void pushPhysicalShape({ Path path, double elevation, Color color, Color shadowColor, Clip clipBehavior = defaultClipBehavior}) { - _pushPhysicalShape(path, elevation, color.value, shadowColor?.value ?? 0xFF000000, clipBehavior.index); + EngineLayer pushPhysicalShape({ Path path, double elevation, Color color, Color shadowColor, Clip clipBehavior = defaultClipBehavior}) { + return _pushPhysicalShape(path, elevation, color.value, shadowColor?.value ?? 0xFF000000, clipBehavior.index); } - void _pushPhysicalShape(Path path, double elevation, int color, int shadowColor, int clipBehavior) native + EngineLayer _pushPhysicalShape(Path path, double elevation, int color, int shadowColor, int clipBehavior) native 'SceneBuilder_pushPhysicalShape'; /// Ends the effect of the most recently pushed operation. @@ -191,6 +195,16 @@ class SceneBuilder extends NativeFieldWrapperClass2 { /// stack. void pop() native 'SceneBuilder_pop'; + /// Add a retained engine layer subtree from previous frames. + /// + /// All the engine layers that are in the subtree of the retained layer will + /// be automatically appended to the current engine layer tree. + /// + /// Therefore, when implementing a subclas of the [Layer] concept defined in + /// the rendering layer of Flutter's framework, once this is called, there's + /// no need to call [addToScene] for its children layers. + EngineLayer addRetained(EngineLayer retainedLayer) native 'SceneBuilder_addRetained'; + /// Adds an object to the scene that displays performance statistics. /// /// Useful during development to assess the performance of the application. @@ -258,6 +272,28 @@ class SceneBuilder extends NativeFieldWrapperClass2 { } void _addTexture(double dx, double dy, double width, double height, int textureId, bool freeze) native 'SceneBuilder_addTexture'; + /// Adds a platform view (e.g an iOS UIView) to the scene. + /// + /// Only supported on iOS, this is currently a no-op on other platforms. + /// + /// On iOS this layer splits the current output surface into two surfaces, one for the scene nodes + /// preceding the platform view, and one for the scene nodes following the platform view. + /// + /// ## Performance impact + /// + /// Adding an additional surface doubles the amount of graphics memory directly used by Flutter + /// for output buffers. Quartz might allocated extra buffers for compositing the Flutter surfaces + /// and the platform view. + /// + /// With a platform view in the scene, Quartz has to composite the two Flutter surfaces and the + /// embedded UIView. In addition to that, on iOS versions greater than 9, the Flutter frames are + /// synchronized with the UIView frames adding additional performance overhead. + void addPlatformView(int viewId, { Offset offset: Offset.zero, double width: 0.0, double height: 0.0}) { + assert(offset != null, 'Offset argument was null'); + _addPlatformView(offset.dx, offset.dy, width, height, viewId); + } + void _addPlatformView(double dx, double dy, double width, double height, int viewId) native 'SceneBuilder_addPlatformView'; + /// (Fuchsia-only) Adds a scene rendered by another application to the scene /// for this application. void addChildScene({ diff --git a/lib/ui/compositing/scene.cc b/lib/ui/compositing/scene.cc index 2863f5307ad40..8d3537750f5fa 100644 --- a/lib/ui/compositing/scene.cc +++ b/lib/ui/compositing/scene.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -26,7 +26,7 @@ IMPLEMENT_WRAPPERTYPEINFO(ui, Scene); DART_BIND_ALL(Scene, FOR_EACH_BINDING) -fml::RefPtr Scene::create(std::unique_ptr rootLayer, +fml::RefPtr Scene::create(std::shared_ptr rootLayer, uint32_t rasterizerTracingThreshold, bool checkerboardRasterCacheImages, bool checkerboardOffscreenLayers) { @@ -35,7 +35,7 @@ fml::RefPtr Scene::create(std::unique_ptr rootLayer, checkerboardRasterCacheImages, checkerboardOffscreenLayers); } -Scene::Scene(std::unique_ptr rootLayer, +Scene::Scene(std::shared_ptr rootLayer, uint32_t rasterizerTracingThreshold, bool checkerboardRasterCacheImages, bool checkerboardOffscreenLayers) @@ -53,46 +53,6 @@ void Scene::dispose() { ClearDartWrapper(); } -static sk_sp CreateSceneSnapshot(GrContext* context, - sk_sp picture, - const SkSize& size) { - TRACE_EVENT0("flutter", "CreateSceneSnapshot"); - auto image_info = - SkImageInfo::MakeN32Premul(SkISize::Make(size.width(), size.height())); - - sk_sp surface; - - if (context) { - surface = SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, image_info); - } - - if (!surface) { - surface = SkSurface::MakeRaster(image_info); - } - - if (!surface) { - return nullptr; - } - - auto canvas = surface->getCanvas(); - - if (!canvas) { - return nullptr; - } - - if (picture) { - canvas->drawPicture(picture.get()); - } - - auto snapshot = surface->makeImageSnapshot(); - - if (!snapshot) { - return nullptr; - } - - return snapshot->makeRasterImage(); -} - Dart_Handle Scene::toImage(uint32_t width, uint32_t height, Dart_Handle raw_image_callback) { @@ -109,68 +69,71 @@ Dart_Handle Scene::toImage(uint32_t width, return tonic::ToDart("Image dimensions for scene were invalid."); } - auto dart_state = UIDartState::Current(); - + auto* dart_state = UIDartState::Current(); auto image_callback = std::make_unique( dart_state, raw_image_callback); + auto unref_queue = dart_state->GetSkiaUnrefQueue(); + auto ui_task_runner = dart_state->GetTaskRunners().GetUITaskRunner(); + auto gpu_task_runner = dart_state->GetTaskRunners().GetGPUTaskRunner(); + auto snapshot_delegate = dart_state->GetSnapshotDelegate(); // We can't create an image on this task runner because we don't have a // graphics context. Even if we did, it would be slow anyway. Also, this // thread owns the sole reference to the layer tree. So we flatten the layer // tree into a picture and use that as the thread transport mechanism. - auto bounds_size = SkSize::Make(width, height); - auto picture = m_layerTree->Flatten(SkRect::MakeSize(bounds_size)); + auto picture_bounds = SkISize::Make(width, height); + auto picture = m_layerTree->Flatten(SkRect::MakeWH(width, height)); + if (!picture) { // Already in Dart scope. return tonic::ToDart("Could not flatten scene into a layer tree."); } - auto resource_context = dart_state->GetResourceContext(); - auto ui_task_runner = dart_state->GetTaskRunners().GetUITaskRunner(); - auto unref_queue = dart_state->GetSkiaUnrefQueue(); - - // The picture has been prepared on the UI thread. - dart_state->GetTaskRunners().GetIOTaskRunner()->PostTask( - fml::MakeCopyable([picture = std::move(picture), // - bounds_size, // - resource_context = std::move(resource_context), // - ui_task_runner = std::move(ui_task_runner), // - image_callback = std::move(image_callback), // - unref_queue = std::move(unref_queue) // - ]() mutable { - // Snapshot the picture on the IO thread that contains an optional - // GrContext. - auto image = CreateSceneSnapshot(resource_context.get(), - std::move(picture), bounds_size); - - // Send the image back to the UI thread for submission back to the - // framework. - ui_task_runner->PostTask( - fml::MakeCopyable([image = std::move(image), // - image_callback = std::move(image_callback), // - unref_queue = std::move(unref_queue) // - ]() mutable { - auto dart_state = image_callback->dart_state().lock(); - if (!dart_state) { - // The root isolate could have died in the meantime. - return; - } - tonic::DartState::Scope scope(dart_state); - - if (!image) { - tonic::DartInvoke(image_callback->Get(), {Dart_Null()}); - return; - } - - auto dart_image = CanvasImage::Create(); - dart_image->set_image({std::move(image), std::move(unref_queue)}); - auto raw_dart_image = tonic::ToDart(std::move(dart_image)); - - // All done! - tonic::DartInvoke(image_callback->Get(), {raw_dart_image}); - })); - })); + auto ui_task = fml::MakeCopyable([ui_task_runner, + image_callback = std::move(image_callback), + unref_queue]( + sk_sp raster_image) mutable { + // Send the raster image back to the UI thread for submission to the + // framework. + ui_task_runner->PostTask(fml::MakeCopyable([raster_image, + image_callback = + std::move(image_callback), + unref_queue]() mutable { + auto dart_state = image_callback->dart_state().lock(); + if (!dart_state) { + // The root isolate could have died in the meantime. + return; + } + tonic::DartState::Scope scope(dart_state); + + if (!raster_image) { + tonic::DartInvoke(image_callback->Get(), {Dart_Null()}); + return; + } + + auto dart_image = CanvasImage::Create(); + dart_image->set_image({std::move(raster_image), std::move(unref_queue)}); + auto* raw_dart_image = tonic::ToDart(std::move(dart_image)); + + // All done! + tonic::DartInvoke(image_callback->Get(), {raw_dart_image}); + })); + }); + + auto gpu_task = fml::MakeCopyable([gpu_task_runner, picture, picture_bounds, + snapshot_delegate, ui_task]() { + gpu_task_runner->PostTask([snapshot_delegate, picture, picture_bounds, + ui_task]() { + // Snapshot the picture on the GPU thread. This thread has access to the + // GPU contexts that may contain the sole references to texture backed + // images in the picture. + ui_task(snapshot_delegate->MakeRasterSnapshot(picture, picture_bounds)); + }); + }); + + // Kick things off on the GPU. + gpu_task(); return Dart_Null(); } diff --git a/lib/ui/compositing/scene.h b/lib/ui/compositing/scene.h index 09f6a3e0d8330..308a652c1e5ed 100644 --- a/lib/ui/compositing/scene.h +++ b/lib/ui/compositing/scene.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -24,7 +24,7 @@ class Scene : public RefCountedDartWrappable { public: ~Scene() override; - static fml::RefPtr create(std::unique_ptr rootLayer, + static fml::RefPtr create(std::shared_ptr rootLayer, uint32_t rasterizerTracingThreshold, bool checkerboardRasterCacheImages, bool checkerboardOffscreenLayers); @@ -40,7 +40,7 @@ class Scene : public RefCountedDartWrappable { static void RegisterNatives(tonic::DartLibraryNatives* natives); private: - explicit Scene(std::unique_ptr rootLayer, + explicit Scene(std::shared_ptr rootLayer, uint32_t rasterizerTracingThreshold, bool checkerboardRasterCacheImages, bool checkerboardOffscreenLayers); diff --git a/lib/ui/compositing/scene_builder.cc b/lib/ui/compositing/scene_builder.cc index 439821cf1491e..39eabaaba8598 100644 --- a/lib/ui/compositing/scene_builder.cc +++ b/lib/ui/compositing/scene_builder.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,6 +19,7 @@ #include "flutter/flow/layers/performance_overlay_layer.h" #include "flutter/flow/layers/physical_shape_layer.h" #include "flutter/flow/layers/picture_layer.h" +#include "flutter/flow/layers/platform_view_layer.h" #include "flutter/flow/layers/shader_mask_layer.h" #include "flutter/flow/layers/texture_layer.h" #include "flutter/flow/layers/transform_layer.h" @@ -53,6 +54,8 @@ IMPLEMENT_WRAPPERTYPEINFO(ui, SceneBuilder); V(SceneBuilder, pushShaderMask) \ V(SceneBuilder, pushPhysicalShape) \ V(SceneBuilder, pop) \ + V(SceneBuilder, addPlatformView) \ + V(SceneBuilder, addRetained) \ V(SceneBuilder, addPicture) \ V(SceneBuilder, addTexture) \ V(SceneBuilder, addChildScene) \ @@ -73,96 +76,122 @@ void SceneBuilder::RegisterNatives(tonic::DartLibraryNatives* natives) { SceneBuilder::SceneBuilder() = default; SceneBuilder::~SceneBuilder() = default; -void SceneBuilder::pushTransform(const tonic::Float64List& matrix4) { +fml::RefPtr SceneBuilder::pushTransform( + tonic::Float64List& matrix4) { SkMatrix sk_matrix = ToSkMatrix(matrix4); - auto layer = std::make_unique(); + auto layer = std::make_shared(); layer->set_transform(sk_matrix); - PushLayer(std::move(layer)); + PushLayer(layer); + // matrix4 has to be released before we can return another Dart object + matrix4.Release(); + return EngineLayer::MakeRetained(layer); } -void SceneBuilder::pushOffset(double dx, double dy) { +fml::RefPtr SceneBuilder::pushOffset(double dx, double dy) { SkMatrix sk_matrix = SkMatrix::MakeTrans(dx, dy); - auto layer = std::make_unique(); + auto layer = std::make_shared(); layer->set_transform(sk_matrix); - PushLayer(std::move(layer)); + PushLayer(layer); + return EngineLayer::MakeRetained(layer); } -void SceneBuilder::pushClipRect(double left, - double right, - double top, - double bottom, - int clipBehavior) { +fml::RefPtr SceneBuilder::pushClipRect(double left, + double right, + double top, + double bottom, + int clipBehavior) { SkRect clipRect = SkRect::MakeLTRB(left, top, right, bottom); flow::Clip clip_behavior = static_cast(clipBehavior); - auto layer = std::make_unique(clip_behavior); + auto layer = std::make_shared(clip_behavior); layer->set_clip_rect(clipRect); - PushLayer(std::move(layer)); + PushLayer(layer); + return EngineLayer::MakeRetained(layer); } -void SceneBuilder::pushClipRRect(const RRect& rrect, int clipBehavior) { +fml::RefPtr SceneBuilder::pushClipRRect(const RRect& rrect, + int clipBehavior) { flow::Clip clip_behavior = static_cast(clipBehavior); - auto layer = std::make_unique(clip_behavior); + auto layer = std::make_shared(clip_behavior); layer->set_clip_rrect(rrect.sk_rrect); - PushLayer(std::move(layer)); + PushLayer(layer); + return EngineLayer::MakeRetained(layer); } -void SceneBuilder::pushClipPath(const CanvasPath* path, int clipBehavior) { +fml::RefPtr SceneBuilder::pushClipPath(const CanvasPath* path, + int clipBehavior) { flow::Clip clip_behavior = static_cast(clipBehavior); FML_DCHECK(clip_behavior != flow::Clip::none); - auto layer = std::make_unique(clip_behavior); + auto layer = std::make_shared(clip_behavior); layer->set_clip_path(path->path()); - PushLayer(std::move(layer)); + PushLayer(layer); + return EngineLayer::MakeRetained(layer); } -void SceneBuilder::pushOpacity(int alpha) { - auto layer = std::make_unique(); +fml::RefPtr SceneBuilder::pushOpacity(int alpha, + double dx, + double dy) { + auto layer = std::make_shared(); layer->set_alpha(alpha); - PushLayer(std::move(layer)); + layer->set_offset(SkPoint::Make(dx, dy)); + PushLayer(layer); + return EngineLayer::MakeRetained(layer); } -void SceneBuilder::pushColorFilter(int color, int blendMode) { - auto layer = std::make_unique(); +fml::RefPtr SceneBuilder::pushColorFilter(int color, + int blendMode) { + auto layer = std::make_shared(); layer->set_color(static_cast(color)); layer->set_blend_mode(static_cast(blendMode)); - PushLayer(std::move(layer)); + PushLayer(layer); + return EngineLayer::MakeRetained(layer); } -void SceneBuilder::pushBackdropFilter(ImageFilter* filter) { - auto layer = std::make_unique(); +fml::RefPtr SceneBuilder::pushBackdropFilter(ImageFilter* filter) { + auto layer = std::make_shared(); layer->set_filter(filter->filter()); - PushLayer(std::move(layer)); + PushLayer(layer); + return EngineLayer::MakeRetained(layer); } -void SceneBuilder::pushShaderMask(Shader* shader, - double maskRectLeft, - double maskRectRight, - double maskRectTop, - double maskRectBottom, - int blendMode) { +fml::RefPtr SceneBuilder::pushShaderMask(Shader* shader, + double maskRectLeft, + double maskRectRight, + double maskRectTop, + double maskRectBottom, + int blendMode) { SkRect rect = SkRect::MakeLTRB(maskRectLeft, maskRectTop, maskRectRight, maskRectBottom); - auto layer = std::make_unique(); + auto layer = std::make_shared(); layer->set_shader(shader->shader()); layer->set_mask_rect(rect); layer->set_blend_mode(static_cast(blendMode)); - PushLayer(std::move(layer)); + PushLayer(layer); + return EngineLayer::MakeRetained(layer); } -void SceneBuilder::pushPhysicalShape(const CanvasPath* path, - double elevation, - int color, - int shadow_color, - int clipBehavior) { +fml::RefPtr SceneBuilder::pushPhysicalShape(const CanvasPath* path, + double elevation, + int color, + int shadow_color, + int clipBehavior) { const SkPath& sk_path = path->path(); flow::Clip clip_behavior = static_cast(clipBehavior); - auto layer = std::make_unique(clip_behavior); + auto layer = std::make_shared(clip_behavior); layer->set_path(sk_path); layer->set_elevation(elevation); layer->set_color(static_cast(color)); layer->set_shadow_color(static_cast(shadow_color)); layer->set_device_pixel_ratio( UIDartState::Current()->window()->viewport_metrics().device_pixel_ratio); - PushLayer(std::move(layer)); + PushLayer(layer); + return EngineLayer::MakeRetained(layer); +} + +void SceneBuilder::addRetained(fml::RefPtr retainedLayer) { + if (!current_layer_) { + return; + } + current_layer_->Add(retainedLayer->Layer()); } void SceneBuilder::pop() { @@ -207,6 +236,21 @@ void SceneBuilder::addTexture(double dx, current_layer_->Add(std::move(layer)); } +void SceneBuilder::addPlatformView(double dx, + double dy, + double width, + double height, + int64_t viewId) { + if (!current_layer_) { + return; + } + auto layer = std::make_unique(); + layer->set_offset(SkPoint::Make(dx, dy)); + layer->set_size(SkSize::Make(width, height)); + layer->set_view_id(viewId); + current_layer_->Add(std::move(layer)); +} + void SceneBuilder::addChildScene(double dx, double dy, double width, @@ -260,7 +304,7 @@ fml::RefPtr SceneBuilder::build() { return scene; } -void SceneBuilder::PushLayer(std::unique_ptr layer) { +void SceneBuilder::PushLayer(std::shared_ptr layer) { FML_DCHECK(layer); if (!root_layer_) { diff --git a/lib/ui/compositing/scene_builder.h b/lib/ui/compositing/scene_builder.h index 8e3ed13a411a3..2f59be6510f4f 100644 --- a/lib/ui/compositing/scene_builder.h +++ b/lib/ui/compositing/scene_builder.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,6 +12,7 @@ #include "flutter/lib/ui/compositing/scene.h" #include "flutter/lib/ui/compositing/scene_host.h" #include "flutter/lib/ui/dart_wrapper.h" +#include "flutter/lib/ui/painting/engine_layer.h" #include "flutter/lib/ui/painting/image_filter.h" #include "flutter/lib/ui/painting/path.h" #include "flutter/lib/ui/painting/picture.h" @@ -32,29 +33,32 @@ class SceneBuilder : public RefCountedDartWrappable { ~SceneBuilder() override; - void pushTransform(const tonic::Float64List& matrix4); - void pushOffset(double dx, double dy); - void pushClipRect(double left, - double right, - double top, - double bottom, - int clipBehavior); - void pushClipRRect(const RRect& rrect, int clipBehavior); - void pushClipPath(const CanvasPath* path, int clipBehavior); - void pushOpacity(int alpha); - void pushColorFilter(int color, int blendMode); - void pushBackdropFilter(ImageFilter* filter); - void pushShaderMask(Shader* shader, - double maskRectLeft, - double maskRectRight, - double maskRectTop, - double maskRectBottom, - int blendMode); - void pushPhysicalShape(const CanvasPath* path, - double elevation, - int color, - int shadowColor, - int clipBehavior); + fml::RefPtr pushTransform(tonic::Float64List& matrix4); + fml::RefPtr pushOffset(double dx, double dy); + fml::RefPtr pushClipRect(double left, + double right, + double top, + double bottom, + int clipBehavior); + fml::RefPtr pushClipRRect(const RRect& rrect, int clipBehavior); + fml::RefPtr pushClipPath(const CanvasPath* path, + int clipBehavior); + fml::RefPtr pushOpacity(int alpha, double dx = 0, double dy = 0); + fml::RefPtr pushColorFilter(int color, int blendMode); + fml::RefPtr pushBackdropFilter(ImageFilter* filter); + fml::RefPtr pushShaderMask(Shader* shader, + double maskRectLeft, + double maskRectRight, + double maskRectTop, + double maskRectBottom, + int blendMode); + fml::RefPtr pushPhysicalShape(const CanvasPath* path, + double elevation, + int color, + int shadowColor, + int clipBehavior); + + void addRetained(fml::RefPtr retainedLayer); void pop(); @@ -73,6 +77,12 @@ class SceneBuilder : public RefCountedDartWrappable { int64_t textureId, bool freeze); + void addPlatformView(double dx, + double dy, + double width, + double height, + int64_t viewId); + void addChildScene(double dx, double dy, double width, @@ -92,14 +102,14 @@ class SceneBuilder : public RefCountedDartWrappable { private: SceneBuilder(); - std::unique_ptr root_layer_; + std::shared_ptr root_layer_; flow::ContainerLayer* current_layer_ = nullptr; int rasterizer_tracing_threshold_ = 0; bool checkerboard_raster_cache_images_ = false; bool checkerboard_offscreen_layers_ = false; - void PushLayer(std::unique_ptr layer); + void PushLayer(std::shared_ptr layer); FML_DISALLOW_COPY_AND_ASSIGN(SceneBuilder); }; diff --git a/lib/ui/compositing/scene_host.cc b/lib/ui/compositing/scene_host.cc index c9588eb8c504a..d0441354949c4 100644 --- a/lib/ui/compositing/scene_host.cc +++ b/lib/ui/compositing/scene_host.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/compositing/scene_host.h b/lib/ui/compositing/scene_host.h index 897a4b754b3ec..cad141d0941ba 100644 --- a/lib/ui/compositing/scene_host.h +++ b/lib/ui/compositing/scene_host.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/dart_runtime_hooks.cc b/lib/ui/dart_runtime_hooks.cc index 7f1cd0c0ecf56..be7a88ddaf892 100644 --- a/lib/ui/dart_runtime_hooks.cc +++ b/lib/ui/dart_runtime_hooks.cc @@ -1,4 +1,4 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -318,12 +318,14 @@ static std::string GetFunctionName(Dart_Handle func) { } void GetCallbackHandle(Dart_NativeArguments args) { + const char* kAnonymousClosureName = ""; Dart_Handle func = Dart_GetNativeArgument(args, 0); std::string name = GetFunctionName(func); std::string class_name = GetFunctionClassName(func); std::string library_path = GetFunctionLibraryUrl(func); - if (name.empty()) { + // TODO(24394): check !Dart_IsTearOff(func) instead of string comparison. + if (name.empty() || (name == kAnonymousClosureName)) { Dart_SetReturnValue(args, Dart_Null()); return; } diff --git a/lib/ui/dart_runtime_hooks.h b/lib/ui/dart_runtime_hooks.h index 50247eec06734..d3beefa46bd36 100644 --- a/lib/ui/dart_runtime_hooks.h +++ b/lib/ui/dart_runtime_hooks.h @@ -1,4 +1,4 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/dart_ui.cc b/lib/ui/dart_ui.cc index 5fb48d436e99b..7256a183cb2e8 100644 --- a/lib/ui/dart_ui.cc +++ b/lib/ui/dart_ui.cc @@ -1,4 +1,4 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,6 +11,7 @@ #include "flutter/lib/ui/isolate_name_server/isolate_name_server_natives.h" #include "flutter/lib/ui/painting/canvas.h" #include "flutter/lib/ui/painting/codec.h" +#include "flutter/lib/ui/painting/engine_layer.h" #include "flutter/lib/ui/painting/frame_info.h" #include "flutter/lib/ui/painting/gradient.h" #include "flutter/lib/ui/painting/image.h" @@ -23,6 +24,7 @@ #include "flutter/lib/ui/painting/vertices.h" #include "flutter/lib/ui/semantics/semantics_update.h" #include "flutter/lib/ui/semantics/semantics_update_builder.h" +#include "flutter/lib/ui/text/font_collection.h" #include "flutter/lib/ui/text/paragraph.h" #include "flutter/lib/ui/text/paragraph_builder.h" #include "flutter/lib/ui/window/window.h" @@ -35,6 +37,7 @@ namespace blink { namespace { static tonic::DartLibraryNatives* g_natives; +static tonic::DartLibraryNatives* g_natives_secondary; Dart_NativeFunction GetNativeFunction(Dart_Handle name, int argument_count, @@ -42,10 +45,21 @@ Dart_NativeFunction GetNativeFunction(Dart_Handle name, return g_natives->GetNativeFunction(name, argument_count, auto_setup_scope); } +Dart_NativeFunction GetNativeFunctionSecondary(Dart_Handle name, + int argument_count, + bool* auto_setup_scope) { + return g_natives_secondary->GetNativeFunction(name, argument_count, + auto_setup_scope); +} + const uint8_t* GetSymbol(Dart_NativeFunction native_function) { return g_natives->GetSymbol(native_function); } +const uint8_t* GetSymbolSecondary(Dart_NativeFunction native_function) { + return g_natives_secondary->GetSymbol(native_function); +} + } // namespace void DartUI::InitForGlobal() { @@ -58,6 +72,8 @@ void DartUI::InitForGlobal() { CanvasPathMeasure::RegisterNatives(g_natives); Codec::RegisterNatives(g_natives); DartRuntimeHooks::RegisterNatives(g_natives); + EngineLayer::RegisterNatives(g_natives); + FontCollection::RegisterNatives(g_natives); FrameInfo::RegisterNatives(g_natives); ImageFilter::RegisterNatives(g_natives); ImageShader::RegisterNatives(g_natives); @@ -73,13 +89,21 @@ void DartUI::InitForGlobal() { SemanticsUpdateBuilder::RegisterNatives(g_natives); Vertices::RegisterNatives(g_natives); Window::RegisterNatives(g_natives); + + // Secondary isolates do not provide UI-related APIs. + g_natives_secondary = new tonic::DartLibraryNatives(); + DartRuntimeHooks::RegisterNatives(g_natives_secondary); + IsolateNameServerNatives::RegisterNatives(g_natives_secondary); } } -void DartUI::InitForIsolate() { +void DartUI::InitForIsolate(bool is_root_isolate) { FML_DCHECK(g_natives); + auto get_native_function = + is_root_isolate ? GetNativeFunction : GetNativeFunctionSecondary; + auto get_symbol = is_root_isolate ? GetSymbol : GetSymbolSecondary; DART_CHECK_VALID(Dart_SetNativeResolver(Dart_LookupLibrary(ToDart("dart:ui")), - GetNativeFunction, GetSymbol)); + get_native_function, get_symbol)); } } // namespace blink diff --git a/lib/ui/dart_ui.gni b/lib/ui/dart_ui.gni index e9a315ac3694e..c52a9f025f231 100644 --- a/lib/ui/dart_ui.gni +++ b/lib/ui/dart_ui.gni @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/lib/ui/dart_ui.h b/lib/ui/dart_ui.h index 4c00bda211a44..8dd4a3270ed6e 100644 --- a/lib/ui/dart_ui.h +++ b/lib/ui/dart_ui.h @@ -1,4 +1,4 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,7 +12,7 @@ namespace blink { class DartUI { public: static void InitForGlobal(); - static void InitForIsolate(); + static void InitForIsolate(bool is_root_isolate); private: FML_DISALLOW_IMPLICIT_CONSTRUCTORS(DartUI); diff --git a/lib/ui/dart_wrapper.h b/lib/ui/dart_wrapper.h index ae20bcfa68d71..ef895513dda64 100644 --- a/lib/ui/dart_wrapper.h +++ b/lib/ui/dart_wrapper.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/geometry.dart b/lib/ui/geometry.dart index df3faa39850db..e46cf63109cdd 100644 --- a/lib/ui/geometry.dart +++ b/lib/ui/geometry.dart @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/hash_codes.dart b/lib/ui/hash_codes.dart index bece69b0887e9..a3a24d7b7dd54 100644 --- a/lib/ui/hash_codes.dart +++ b/lib/ui/hash_codes.dart @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index 65c5529f156d8..54c5033b40c65 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -42,20 +42,35 @@ void _updateWindowMetrics(double devicePixelRatio, typedef _LocaleClosure = String Function(); -String _localeClosure() => window._locale.toString(); +String _localeClosure() => window.locale.toString(); @pragma('vm:entry-point') _LocaleClosure _getLocaleClosure() => _localeClosure; @pragma('vm:entry-point') -void _updateLocale(String languageCode, String countryCode) { - window._locale = new Locale(languageCode, countryCode); +void _updateLocales(List locales) { + const int stringsPerLocale = 4; + final int numLocales = locales.length ~/ stringsPerLocale; + window._locales = new List(numLocales); + for (int localeIndex = 0; localeIndex < numLocales; localeIndex++) { + final String countryCode = locales[localeIndex * stringsPerLocale + 1]; + final String scriptCode = locales[localeIndex * stringsPerLocale + 2]; + + window._locales[localeIndex] = new Locale.fromSubtags( + languageCode: locales[localeIndex * stringsPerLocale], + countryCode: countryCode.isEmpty ? null : countryCode, + scriptCode: scriptCode.isEmpty ? null : scriptCode, + ); + } _invoke(window.onLocaleChanged, window._onLocaleChangedZone); } @pragma('vm:entry-point') void _updateUserSettingsData(String jsonData) { final Map data = json.decode(jsonData); + if (data.isEmpty) { + return; + } _updateTextScaleFactor(data['textScaleFactor'].toDouble()); _updateAlwaysUse24HourFormat(data['alwaysUse24HourFormat']); } @@ -190,7 +205,7 @@ void _invoke3(void callback(A1 a1, A2 a2, A3 a3), Zone zone, A1 arg1 // // * pointer_data.cc // * FlutterView.java -const int _kPointerDataFieldCount = 19; +const int _kPointerDataFieldCount = 21; PointerDataPacket _unpackPointerDataPacket(ByteData packet) { const int kStride = Int64List.bytesPerElement; @@ -214,12 +229,14 @@ PointerDataPacket _unpackPointerDataPacket(ByteData packet) { pressureMax: packet.getFloat64(kStride * offset++, _kFakeHostEndian), distance: packet.getFloat64(kStride * offset++, _kFakeHostEndian), distanceMax: packet.getFloat64(kStride * offset++, _kFakeHostEndian), + size: packet.getFloat64(kStride * offset++, _kFakeHostEndian), radiusMajor: packet.getFloat64(kStride * offset++, _kFakeHostEndian), radiusMinor: packet.getFloat64(kStride * offset++, _kFakeHostEndian), radiusMin: packet.getFloat64(kStride * offset++, _kFakeHostEndian), radiusMax: packet.getFloat64(kStride * offset++, _kFakeHostEndian), orientation: packet.getFloat64(kStride * offset++, _kFakeHostEndian), - tilt: packet.getFloat64(kStride * offset++, _kFakeHostEndian) + tilt: packet.getFloat64(kStride * offset++, _kFakeHostEndian), + platformData: packet.getInt64(kStride * offset++, _kFakeHostEndian), ); assert(offset == (i + 1) * _kPointerDataFieldCount); } diff --git a/lib/ui/isolate_name_server.dart b/lib/ui/isolate_name_server.dart index ef32ec203d401..4c1833bc52646 100644 --- a/lib/ui/isolate_name_server.dart +++ b/lib/ui/isolate_name_server.dart @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/isolate_name_server/isolate_name_server.cc b/lib/ui/isolate_name_server/isolate_name_server.cc index 9d78d145bb00f..deae4fe6f8f16 100644 --- a/lib/ui/isolate_name_server/isolate_name_server.cc +++ b/lib/ui/isolate_name_server/isolate_name_server.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,10 @@ namespace blink { +IsolateNameServer::IsolateNameServer() {} + +IsolateNameServer::~IsolateNameServer() = default; + Dart_Port IsolateNameServer::LookupIsolatePortByName(const std::string& name) { std::lock_guard lock(mutex_); return LookupIsolatePortByNameUnprotected(name); diff --git a/lib/ui/isolate_name_server/isolate_name_server.h b/lib/ui/isolate_name_server/isolate_name_server.h index 906d943328967..db62ad871f771 100644 --- a/lib/ui/isolate_name_server/isolate_name_server.h +++ b/lib/ui/isolate_name_server/isolate_name_server.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,7 +17,9 @@ namespace blink { class IsolateNameServer { public: - IsolateNameServer() {} + IsolateNameServer(); + + ~IsolateNameServer(); // Looks up the Dart_Port associated with a given name. Returns ILLEGAL_PORT // if the name does not exist. diff --git a/lib/ui/isolate_name_server/isolate_name_server_natives.cc b/lib/ui/isolate_name_server/isolate_name_server_natives.cc index 543cd168b5223..7f4467886f4fa 100644 --- a/lib/ui/isolate_name_server/isolate_name_server_natives.cc +++ b/lib/ui/isolate_name_server/isolate_name_server_natives.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/isolate_name_server/isolate_name_server_natives.h b/lib/ui/isolate_name_server/isolate_name_server_natives.h index 2ebbe6e445010..cc3e1438cfbee 100644 --- a/lib/ui/isolate_name_server/isolate_name_server_natives.h +++ b/lib/ui/isolate_name_server/isolate_name_server_natives.h @@ -1,10 +1,11 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FLUTTER_LIB_UI_ISOLATE_NAME_SERVER_NATIVES_H_ #define FLUTTER_LIB_UI_ISOLATE_NAME_SERVER_NATIVES_H_ +#include #include "third_party/dart/runtime/include/dart_api.h" namespace tonic { diff --git a/lib/ui/lerp.dart b/lib/ui/lerp.dart index 2107969be57bb..0c69476779b73 100644 --- a/lib/ui/lerp.dart +++ b/lib/ui/lerp.dart @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/natives.dart b/lib/ui/natives.dart index 49a582c4e930f..fd34b93ff3dce 100644 --- a/lib/ui/natives.dart +++ b/lib/ui/natives.dart @@ -1,4 +1,4 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index af408b4f75ad8..4feb65dffd5ad 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -879,7 +879,7 @@ enum StrokeCap { enum StrokeJoin { /// Joins between line segments form sharp corners. /// - /// {@animation joinMiterEnum 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/miter_4_join.mp4} + /// {@animation 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/miter_4_join.mp4} /// /// The center of the line segment is colored in the diagram above to /// highlight the join, but in normal usage the join is the same color as the @@ -895,7 +895,7 @@ enum StrokeJoin { /// Joins between line segments are semi-circular. /// - /// {@animation joinRoundEnum 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/round_join.mp4} + /// {@animation 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/round_join.mp4} /// /// The center of the line segment is colored in the diagram above to /// highlight the join, but in normal usage the join is the same color as the @@ -910,7 +910,7 @@ enum StrokeJoin { /// Joins between line segments connect the corners of the butt ends of the /// line segments to give a beveled appearance. /// - /// {@animation joinBevelEnum 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/bevel_join.mp4} + /// {@animation 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/bevel_join.mp4} /// /// The center of the line segment is colored in the diagram above to /// highlight the join, but in normal usage the join is the same color as the @@ -1209,11 +1209,11 @@ class Paint { /// /// Some examples of joins: /// - /// {@animation joinMiterStrokeJoin 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/miter_4_join.mp4} + /// {@animation 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/miter_4_join.mp4} /// - /// {@animation joinRoundStrokeJoin 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/round_join.mp4} + /// {@animation 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/round_join.mp4} /// - /// {@animation joinBevelStrokeJoin 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/bevel_join.mp4} + /// {@animation 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/bevel_join.mp4} /// /// The centers of the line segments are colored in the diagrams above to /// highlight the joins, but in normal usage the join is the same color as the @@ -1248,11 +1248,11 @@ class Paint { /// Defaults to 4.0. Using zero as a limit will cause a [StrokeJoin.bevel] /// join to be used all the time. /// - /// {@animation joinMiter0Limit 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/miter_0_join.mp4} + /// {@animation 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/miter_0_join.mp4} /// - /// {@animation joinMiter4Limit 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/miter_4_join.mp4} + /// {@animation 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/miter_4_join.mp4} /// - /// {@animation joinMiter6Limit 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/miter_6_join.mp4} + /// {@animation 300 300 https://flutter.github.io/assets-for-api-docs/assets/dart-ui/miter_6_join.mp4} /// /// The centers of the line segments are colored in the diagrams above to /// highlight the joins, but in normal usage the join is the same color as the @@ -1503,6 +1503,7 @@ class _ImageInfo { /// /// To draw an [Image], use one of the methods on the [Canvas] class, such as /// [Canvas.drawImage]. +@pragma('vm:entry-point') class Image extends NativeFieldWrapperClass2 { /// This class is created by the engine, and should not be instantiated /// or extended directly. @@ -1550,6 +1551,7 @@ typedef ImageDecoderCallback = void Function(Image result); /// /// To obtain an instance of the [FrameInfo] interface, see /// [Codec.getNextFrame]. +@pragma('vm:entry-point') class FrameInfo extends NativeFieldWrapperClass2 { /// This class is created by the engine, and should not be instantiated /// or extended directly. @@ -1568,6 +1570,7 @@ class FrameInfo extends NativeFieldWrapperClass2 { } /// A handle to an image codec. +@pragma('vm:entry-point') class Codec extends NativeFieldWrapperClass2 { /// This class is created by the engine, and should not be instantiated /// or extended directly. @@ -1606,22 +1609,32 @@ class Codec extends NativeFieldWrapperClass2 { /// Instantiates an image codec [Codec] object. /// /// [list] is the binary image data (e.g a PNG or GIF binary data). -/// The data can be for either static or animated images. -/// -/// The following image formats are supported: {@macro flutter.dart:ui.imageFormats} +/// The data can be for either static or animated images. The following image +/// formats are supported: {@macro flutter.dart:ui.imageFormats} +/// +/// The [decodedCacheRatioCap] is the default maximum multiple of the compressed +/// image size to cache when decoding animated image frames. For example, +/// setting this to `2.0` means that a 400KB GIF would be allowed at most to use +/// 800KB of memory caching unessential decoded frames. Caching decoded frames +/// saves CPU but can result in out-of-memory crashes when decoding large (or +/// multiple) animated images. Note that GIFs are highly compressed, and it's +/// unlikely that a factor that low will be sufficient to cache all decoded +/// frames. The default value is `25.0`. /// /// The returned future can complete with an error if the image decoding has /// failed. -Future instantiateImageCodec(Uint8List list) { +Future instantiateImageCodec(Uint8List list, { + double decodedCacheRatioCap = double.infinity, +}) { return _futurize( - (_Callback callback) => _instantiateImageCodec(list, callback, null) + (_Callback callback) => _instantiateImageCodec(list, callback, null, decodedCacheRatioCap), ); } /// Instantiates a [Codec] object for an image binary data. /// /// Returns an error message if the instantiation has failed, null otherwise. -String _instantiateImageCodec(Uint8List list, _Callback callback, _ImageInfo imageInfo) +String _instantiateImageCodec(Uint8List list, _Callback callback, _ImageInfo imageInfo, double decodedCacheRatioCap) native 'instantiateImageCodec'; /// Loads a single image frame from a byte array into an [Image] object. @@ -1646,17 +1659,26 @@ Future _decodeImageFromListAsync(Uint8List list, /// [rowBytes] is the number of bytes consumed by each row of pixels in the /// data buffer. If unspecified, it defaults to [width] multipled by the /// number of bytes per pixel in the provided [format]. +/// +/// The [decodedCacheRatioCap] is the default maximum multiple of the compressed +/// image size to cache when decoding animated image frames. For example, +/// setting this to `2.0` means that a 400KB GIF would be allowed at most to use +/// 800KB of memory caching unessential decoded frames. Caching decoded frames +/// saves CPU but can result in out-of-memory crashes when decoding large (or +/// multiple) animated images. Note that GIFs are highly compressed, and it's +/// unlikely that a factor that low will be sufficient to cache all decoded +/// frames. The default value is `25.0`. void decodeImageFromPixels( Uint8List pixels, int width, int height, PixelFormat format, ImageDecoderCallback callback, - {int rowBytes} + {int rowBytes, double decodedCacheRatioCap = double.infinity} ) { final _ImageInfo imageInfo = new _ImageInfo(width, height, format.index, rowBytes); final Future codecFuture = _futurize( - (_Callback callback) => _instantiateImageCodec(pixels, callback, imageInfo) + (_Callback callback) => _instantiateImageCodec(pixels, callback, imageInfo, decodedCacheRatioCap) ); codecFuture.then((Codec codec) => codec.getNextFrame()) .then((FrameInfo frameInfo) => callback(frameInfo.image)); @@ -1742,6 +1764,15 @@ enum PathOperation { reverseDifference, } +/// A handle for the framework to hold and retain an engine layer across frames. +@pragma('vm:entry-point') +class EngineLayer extends NativeFieldWrapperClass2 { + /// This class is created by the engine, and should not be instantiated + /// or extended directly. + @pragma('vm:entry-point') + EngineLayer._(); +} + /// A complex, one-dimensional subset of a plane. /// /// A path consists of a number of subpaths, and a _current point_. @@ -1759,6 +1790,7 @@ enum PathOperation { /// /// Paths can be drawn on canvases using [Canvas.drawPath], and can /// used to create clip regions using [Canvas.clipPath]. +@pragma('vm:entry-point') class Path extends NativeFieldWrapperClass2 { /// Create a new empty [Path] object. @pragma('vm:entry-point') @@ -3553,6 +3585,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// A [Picture] can be placed in a [Scene] using a [SceneBuilder], via /// the [SceneBuilder.addPicture] method. A [Picture] can also be /// drawn into a [Canvas], using the [Canvas.drawPicture] method. +@pragma('vm:entry-point') class Picture extends NativeFieldWrapperClass2 { /// This class is created by the engine, and should not be instantiated /// or extended directly. @@ -3612,6 +3645,217 @@ class PictureRecorder extends NativeFieldWrapperClass2 { Picture endRecording() native 'PictureRecorder_endRecording'; } +/// A single shadow. +/// +/// Multiple shadows are stacked together in a [TextStyle]. +class Shadow { + /// Construct a shadow. + /// + /// The default shadow is a black shadow with zero offset and zero blur. + /// Default shadows should be completely covered by the casting element, + /// and not be visble. + /// + /// Transparency should be adjusted through the [color] alpha. + /// + /// Shadow order matters due to compositing multiple translucent objects not + /// being commutative. + const Shadow({ + this.color = const Color(_kColorDefault), + this.offset = Offset.zero, + this.blurRadius = 0.0, + }) : assert(color != null, 'Text shadow color was null.'), + assert(offset != null, 'Text shadow offset was null.'), + assert(blurRadius >= 0.0, 'Text shadow blur radius should be non-negative.'); + + static const int _kColorDefault = 0xFF000000; + // Constants for shadow encoding. + static const int _kBytesPerShadow = 16; + static const int _kColorOffset = 0 << 2; + static const int _kXOffset = 1 << 2; + static const int _kYOffset = 2 << 2; + static const int _kBlurOffset = 3 << 2; + + /// Color that the shadow will be drawn with. + /// + /// The shadows are shapes composited directly over the base canvas, and do not + /// represent optical occlusion. + final Color color; + + /// The displacement of the shadow from the casting element. + /// + /// Positive x/y offsets will shift the shadow to the right and down, while + /// negative offsets shift the shadow to the left and up. The offsets are + /// relative to the position of the element that is casting it. + final Offset offset; + + /// The standard deviation of the Gaussian to convolve with the shadow's shape. + final double blurRadius; + + /// Converts a blur radius in pixels to sigmas. + /// + /// See the sigma argument to [MaskFilter.blur]. + /// + // See SkBlurMask::ConvertRadiusToSigma(). + // + static double convertRadiusToSigma(double radius) { + return radius * 0.57735 + 0.5; + } + + /// The [blurRadius] in sigmas instead of logical pixels. + /// + /// See the sigma argument to [MaskFilter.blur]. + double get blurSigma => convertRadiusToSigma(blurRadius); + + /// Create the [Paint] object that corresponds to this shadow description. + /// + /// The [offset] is not represented in the [Paint] object. + /// To honor this as well, the shape should be translated by [offset] before + /// being filled using this [Paint]. + /// + /// This class does not provide a way to disable shadows to avoid inconsistencies + /// in shadow blur rendering, primarily as a method of reducing test flakiness. + /// [toPaint] should be overriden in subclasses to provide this functionality. + Paint toPaint() { + return Paint() + ..color = color + ..maskFilter = MaskFilter.blur(BlurStyle.normal, blurSigma); + } + + /// Returns a new shadow with its [offset] and [blurRadius] scaled by the given + /// factor. + Shadow scale(double factor) { + return Shadow( + color: color, + offset: offset * factor, + blurRadius: blurRadius * factor, + ); + } + + /// Linearly interpolate between two shadows. + /// + /// If either shadow is null, this function linearly interpolates from a + /// a shadow that matches the other shadow in color but has a zero + /// offset and a zero blurRadius. + /// + /// {@template dart.ui.shadow.lerp} + /// The `t` argument represents position on the timeline, with 0.0 meaning + /// that the interpolation has not started, returning `a` (or something + /// equivalent to `a`), 1.0 meaning that the interpolation has finished, + /// returning `b` (or something equivalent to `b`), and values in between + /// meaning that the interpolation is at the relevant point on the timeline + /// between `a` and `b`. The interpolation can be extrapolated beyond 0.0 and + /// 1.0, so negative values and values greater than 1.0 are valid (and can + /// easily be generated by curves such as [Curves.elasticInOut]). + /// + /// Values for `t` are usually obtained from an [Animation], such as + /// an [AnimationController]. + /// {@endtemplate} + static Shadow lerp(Shadow a, Shadow b, double t) { + assert(t != null); + if (a == null && b == null) + return null; + if (a == null) + return b.scale(t); + if (b == null) + return a.scale(1.0 - t); + return Shadow( + color: Color.lerp(a.color, b.color, t), + offset: Offset.lerp(a.offset, b.offset, t), + blurRadius: lerpDouble(a.blurRadius, b.blurRadius, t), + ); + } + + /// Linearly interpolate between two lists of shadows. + /// + /// If the lists differ in length, excess items are lerped with null. + /// + /// {@macro dart.ui.shadow.lerp} + static List lerpList(List a, List b, double t) { + assert(t != null); + if (a == null && b == null) + return null; + a ??= []; + b ??= []; + final List result = []; + final int commonLength = math.min(a.length, b.length); + for (int i = 0; i < commonLength; i += 1) + result.add(Shadow.lerp(a[i], b[i], t)); + for (int i = commonLength; i < a.length; i += 1) + result.add(a[i].scale(1.0 - t)); + for (int i = commonLength; i < b.length; i += 1) + result.add(b[i].scale(t)); + return result; + } + + @override + bool operator ==(dynamic other) { + if (identical(this, other)) + return true; + if (other is! Shadow) + return false; + final Shadow typedOther = other; + return color == typedOther.color && + offset == typedOther.offset && + blurRadius == typedOther.blurRadius; + } + + @override + int get hashCode => hashValues(color, offset, blurRadius); + + /// Determines if lists [a] and [b] are deep equivalent. + /// + /// Returns true if the lists are both null, or if they are both non-null, have + /// the same length, and contain the same Shadows in the same order. Returns + /// false otherwise. + static bool _shadowsListEquals(List a, List b) { + // Compare _shadows + if (a == null) + return b == null; + if (b == null || a.length != b.length) + return false; + for (int index = 0; index < a.length; ++index) + if (a[index] != b[index]) + return false; + return true; + } + + // Serialize [shadows] into ByteData. The format is a single uint_32_t at + // the beginning indicating the number of shadows, followed by _kBytesPerShadow + // bytes for each shadow. + static ByteData _encodeShadows(List shadows) { + if (shadows == null) + return ByteData(0); + + final int byteCount = shadows.length * _kBytesPerShadow; + final ByteData shadowsData = ByteData(byteCount); + + int shadowOffset = 0; + for (int shadowIndex = 0; shadowIndex < shadows.length; ++shadowIndex) { + final Shadow shadow = shadows[shadowIndex]; + if (shadow == null) + continue; + shadowOffset = shadowIndex * _kBytesPerShadow; + + shadowsData.setInt32(_kColorOffset + shadowOffset, + shadow.color.value ^ Shadow._kColorDefault, _kFakeHostEndian); + + shadowsData.setFloat32(_kXOffset + shadowOffset, + shadow.offset.dx, _kFakeHostEndian); + + shadowsData.setFloat32(_kYOffset + shadowOffset, + shadow.offset.dy, _kFakeHostEndian); + + shadowsData.setFloat32(_kBlurOffset + shadowOffset, + shadow.blurRadius, _kFakeHostEndian); + } + + return shadowsData; + } + + @override + String toString() => 'TextShadow($color, $offset, $blurRadius)'; +} + /// Generic callback signature, used by [_futurize]. typedef _Callback = void Function(T result); diff --git a/lib/ui/painting/canvas.cc b/lib/ui/painting/canvas.cc index a691b752d1652..691a41949ecd7 100644 --- a/lib/ui/painting/canvas.cc +++ b/lib/ui/painting/canvas.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/canvas.h b/lib/ui/painting/canvas.h index c4c870d317170..98632b9235edc 100644 --- a/lib/ui/painting/canvas.h +++ b/lib/ui/painting/canvas.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/codec.cc b/lib/ui/painting/codec.cc index 6823350553657..4cec237fd9ed5 100644 --- a/lib/ui/painting/codec.cc +++ b/lib/ui/painting/codec.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,10 +17,6 @@ #include "third_party/tonic/logging/dart_invoke.h" #include "third_party/tonic/typed_data/uint8_list.h" -#ifdef ERROR -#undef ERROR -#endif - using tonic::DartInvoke; using tonic::DartPersistentValue; using tonic::ToDart; @@ -86,6 +82,7 @@ static sk_sp DecodeImage(fml::WeakPtr context, fml::RefPtr InitCodec(fml::WeakPtr context, sk_sp buffer, fml::RefPtr unref_queue, + const float decodedCacheRatioCap, size_t trace_id) { TRACE_FLOW_STEP("flutter", kInitCodecTraceTag, trace_id); TRACE_EVENT0("blink", "InitCodec"); @@ -102,7 +99,8 @@ fml::RefPtr InitCodec(fml::WeakPtr context, return nullptr; } if (skCodec->getFrameCount() > 1) { - return fml::MakeRefCounted(std::move(skCodec)); + return fml::MakeRefCounted(std::move(skCodec), + decodedCacheRatioCap); } auto skImage = DecodeImage(context, buffer, trace_id); if (!skImage) { @@ -120,6 +118,7 @@ fml::RefPtr InitCodecUncompressed( sk_sp buffer, ImageInfo image_info, fml::RefPtr unref_queue, + const float decodedCacheRatioCap, size_t trace_id) { TRACE_FLOW_STEP("flutter", kInitCodecTraceTag, trace_id); TRACE_EVENT0("blink", "InitCodecUncompressed"); @@ -152,14 +151,16 @@ void InitCodecAndInvokeCodecCallback( std::unique_ptr callback, sk_sp buffer, std::unique_ptr image_info, + const float decodedCacheRatioCap, size_t trace_id) { fml::RefPtr codec; if (image_info) { codec = InitCodecUncompressed(context, std::move(buffer), *image_info, - std::move(unref_queue), trace_id); + std::move(unref_queue), decodedCacheRatioCap, + trace_id); } else { - codec = - InitCodec(context, std::move(buffer), std::move(unref_queue), trace_id); + codec = InitCodec(context, std::move(buffer), std::move(unref_queue), + decodedCacheRatioCap, trace_id); } ui_task_runner->PostTask( fml::MakeCopyable([callback = std::move(callback), @@ -277,9 +278,12 @@ void InstantiateImageCodec(Dart_NativeArguments args) { } } + const float decodedCacheRatioCap = + tonic::DartConverter::FromDart(Dart_GetNativeArgument(args, 3)); + auto buffer = SkData::MakeWithCopy(list.data(), list.num_elements()); - auto dart_state = UIDartState::Current(); + auto* dart_state = UIDartState::Current(); const auto& task_runners = dart_state->GetTaskRunners(); task_runners.GetIOTaskRunner()->PostTask(fml::MakeCopyable( @@ -288,11 +292,12 @@ void InstantiateImageCodec(Dart_NativeArguments args) { buffer = std::move(buffer), trace_id, image_info = std::move(image_info), ui_task_runner = task_runners.GetUITaskRunner(), context = dart_state->GetResourceContext(), - queue = UIDartState::Current()->GetSkiaUnrefQueue()]() mutable { - InitCodecAndInvokeCodecCallback(std::move(ui_task_runner), context, - std::move(queue), std::move(callback), - std::move(buffer), - std::move(image_info), trace_id); + queue = UIDartState::Current()->GetSkiaUnrefQueue(), + decodedCacheRatioCap]() mutable { + InitCodecAndInvokeCodecCallback( + std::move(ui_task_runner), context, std::move(queue), + std::move(callback), std::move(buffer), std::move(image_info), + decodedCacheRatioCap, trace_id); })); } @@ -358,17 +363,46 @@ void Codec::dispose() { ClearDartWrapper(); } -MultiFrameCodec::MultiFrameCodec(std::unique_ptr codec) - : codec_(std::move(codec)) { +MultiFrameCodec::MultiFrameCodec(std::unique_ptr codec, + const float decodedCacheRatioCap) + : codec_(std::move(codec)), decodedCacheRatioCap_(decodedCacheRatioCap) { repetitionCount_ = codec_->getRepetitionCount(); frameInfos_ = codec_->getFrameInfo(); - frameBitmaps_.resize(frameInfos_.size()); + compressedSizeBytes_ = codec_->getInfo().computeMinByteSize(); + frameBitmaps_.clear(); + decodedCacheSize_ = 0; + // Initialize the frame cache, marking frames that are required for other + // dependent frames to render. + for (size_t frameIndex = 0; frameIndex < frameInfos_.size(); frameIndex++) { + const auto& frameInfo = frameInfos_[frameIndex]; + if (frameInfo.fRequiredFrame != SkCodec::kNoFrame) { + frameBitmaps_[frameInfo.fRequiredFrame] = + std::make_unique(/*required=*/true); + } + if (frameBitmaps_.count(frameIndex) < 1) { + frameBitmaps_[frameIndex] = + std::make_unique(/*required=*/false); + } + } nextFrameIndex_ = 0; } +MultiFrameCodec::~MultiFrameCodec() {} + +int MultiFrameCodec::frameCount() { + return frameInfos_.size(); +} + +int MultiFrameCodec::repetitionCount() { + return repetitionCount_; +} + sk_sp MultiFrameCodec::GetNextFrameImage( fml::WeakPtr resourceContext) { - SkBitmap& bitmap = frameBitmaps_[nextFrameIndex_]; + // Populate this bitmap from the cache if it exists + DecodedFrame& cacheEntry = *frameBitmaps_[nextFrameIndex_]; + SkBitmap bitmap = + cacheEntry.bitmap_ != nullptr ? *cacheEntry.bitmap_ : SkBitmap(); if (!bitmap.getPixels()) { // We haven't decoded this frame yet const SkImageInfo info = codec_->getInfo().makeColorType(kN32_SkColorType); bitmap.allocPixels(info); @@ -376,18 +410,17 @@ sk_sp MultiFrameCodec::GetNextFrameImage( SkCodec::Options options; options.fFrameIndex = nextFrameIndex_; const int requiredFrame = frameInfos_[nextFrameIndex_].fRequiredFrame; - if (requiredFrame != SkCodec::kNone) { - if (requiredFrame < 0 || - static_cast(requiredFrame) >= frameBitmaps_.size()) { + if (requiredFrame != SkCodec::kNoFrame) { + const SkBitmap* requiredBitmap = + frameBitmaps_[requiredFrame]->bitmap_.get(); + if (requiredBitmap == nullptr) { FML_LOG(ERROR) << "Frame " << nextFrameIndex_ << " depends on frame " - << requiredFrame << " which out of range (0," - << frameBitmaps_.size() << ")."; + << requiredFrame << " which has not been cached."; return NULL; } - SkBitmap& requiredBitmap = frameBitmaps_[requiredFrame]; - // For simplicity, do not try to cache old frames - if (requiredBitmap.getPixels() && - copy_to(&bitmap, requiredBitmap.colorType(), requiredBitmap)) { + + if (requiredBitmap->getPixels() && + copy_to(&bitmap, requiredBitmap->colorType(), *requiredBitmap)) { options.fPriorFrame = requiredFrame; } } @@ -397,6 +430,16 @@ sk_sp MultiFrameCodec::GetNextFrameImage( FML_LOG(ERROR) << "Could not getPixels for frame " << nextFrameIndex_; return NULL; } + + // Cache the bitmap if this is a required frame or if we're still under our + // ratio cap. + const size_t cachedFrameSize = bitmap.computeByteSize(); + if (cacheEntry.required_ || + ((decodedCacheSize_ + cachedFrameSize) / compressedSizeBytes_) <= + decodedCacheRatioCap_) { + cacheEntry.bitmap_ = std::make_unique(bitmap); + decodedCacheSize_ += cachedFrameSize; + } } if (resourceContext) { @@ -448,7 +491,7 @@ Dart_Handle MultiFrameCodec::getNextFrame(Dart_Handle callback_handle) { return ToDart("Callback must be a function"); } - auto dart_state = UIDartState::Current(); + auto* dart_state = UIDartState::Current(); const auto& task_runners = dart_state->GetTaskRunners(); @@ -466,6 +509,24 @@ Dart_Handle MultiFrameCodec::getNextFrame(Dart_Handle callback_handle) { return Dart_Null(); } +MultiFrameCodec::DecodedFrame::DecodedFrame(bool required) + : required_(required) {} + +MultiFrameCodec::DecodedFrame::~DecodedFrame() = default; + +SingleFrameCodec::SingleFrameCodec(fml::RefPtr frame) + : frame_(std::move(frame)) {} + +SingleFrameCodec::~SingleFrameCodec() {} + +int SingleFrameCodec::frameCount() { + return 1; +} + +int SingleFrameCodec::repetitionCount() { + return 0; +} + Dart_Handle SingleFrameCodec::getNextFrame(Dart_Handle callback_handle) { if (!Dart_IsClosure(callback_handle)) { return ToDart("Callback must be a function"); @@ -485,7 +546,7 @@ Dart_Handle SingleFrameCodec::getNextFrame(Dart_Handle callback_handle) { void Codec::RegisterNatives(tonic::DartLibraryNatives* natives) { natives->Register({ - {"instantiateImageCodec", InstantiateImageCodec, 3, true}, + {"instantiateImageCodec", InstantiateImageCodec, 4, true}, }); natives->Register({FOR_EACH_BINDING(DART_REGISTER_NATIVE)}); } diff --git a/lib/ui/painting/codec.h b/lib/ui/painting/codec.h index c66ee445f2ba4..e853556e2b4ac 100644 --- a/lib/ui/painting/codec.h +++ b/lib/ui/painting/codec.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -36,14 +36,15 @@ class Codec : public RefCountedDartWrappable { class MultiFrameCodec : public Codec { public: - int frameCount() { return frameInfos_.size(); } - int repetitionCount() { return repetitionCount_; } - Dart_Handle getNextFrame(Dart_Handle args); + int frameCount() override; + int repetitionCount() override; + Dart_Handle getNextFrame(Dart_Handle args) override; private: - MultiFrameCodec(std::unique_ptr codec); + MultiFrameCodec(std::unique_ptr codec, + const float decodedCacheRatioCap); - ~MultiFrameCodec() {} + ~MultiFrameCodec() override; sk_sp GetNextFrameImage(fml::WeakPtr resourceContext); @@ -57,9 +58,28 @@ class MultiFrameCodec : public Codec { const std::unique_ptr codec_; int repetitionCount_; int nextFrameIndex_; + // The default max amount of memory to use for caching decoded animated image + // frames compared to total undecoded size. + const float decodedCacheRatioCap_; + size_t compressedSizeBytes_; + size_t decodedCacheSize_; std::vector frameInfos_; - std::vector frameBitmaps_; + // A struct linking the bitmap of a frame to whether it's required to render + // other dependent frames. + struct DecodedFrame { + std::unique_ptr bitmap_ = nullptr; + const bool required_; + + DecodedFrame(bool required); + ~DecodedFrame(); + }; + + // A cache of previously loaded bitmaps, indexed by the frame they belong to. + // Always holds at least the frames marked as required for reuse by + // [SkCodec::getFrameInfo()]. Will cache other non-essential frames until + // [decodedCacheSize_] : [compressedSize_] exceeds [decodedCacheRatioCap_]. + std::map> frameBitmaps_; FML_FRIEND_MAKE_REF_COUNTED(MultiFrameCodec); FML_FRIEND_REF_COUNTED_THREAD_SAFE(MultiFrameCodec); @@ -67,13 +87,13 @@ class MultiFrameCodec : public Codec { class SingleFrameCodec : public Codec { public: - int frameCount() { return 1; } - int repetitionCount() { return 0; } - Dart_Handle getNextFrame(Dart_Handle args); + int frameCount() override; + int repetitionCount() override; + Dart_Handle getNextFrame(Dart_Handle args) override; private: - SingleFrameCodec(fml::RefPtr frame) : frame_(std::move(frame)) {} - ~SingleFrameCodec() {} + SingleFrameCodec(fml::RefPtr frame); + ~SingleFrameCodec() override; fml::RefPtr frame_; diff --git a/lib/ui/painting/engine_layer.cc b/lib/ui/painting/engine_layer.cc new file mode 100644 index 0000000000000..f365e37cb8fbc --- /dev/null +++ b/lib/ui/painting/engine_layer.cc @@ -0,0 +1,36 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/lib/ui/painting/engine_layer.h" + +#include "flutter/flow/layers/container_layer.h" + +#include "third_party/tonic/converter/dart_converter.h" +#include "third_party/tonic/dart_args.h" +#include "third_party/tonic/dart_binding_macros.h" +#include "third_party/tonic/dart_library_natives.h" + +using tonic::ToDart; + +namespace blink { + +EngineLayer::EngineLayer(std::shared_ptr layer) + : layer_(layer) {} + +EngineLayer::~EngineLayer() = default; + +size_t EngineLayer::GetAllocationSize() { + // Provide an approximation of the total memory impact of this object to the + // Dart GC. The ContainerLayer may hold references to a tree of other layers, + // which in turn may contain Skia objects. + return 3000; +}; + +IMPLEMENT_WRAPPERTYPEINFO(ui, EngineLayer); + +#define FOR_EACH_BINDING(V) // nothing to bind + +DART_BIND_ALL(EngineLayer, FOR_EACH_BINDING) + +} // namespace blink diff --git a/lib/ui/painting/engine_layer.h b/lib/ui/painting/engine_layer.h new file mode 100644 index 0000000000000..a95e58a9e2e6a --- /dev/null +++ b/lib/ui/painting/engine_layer.h @@ -0,0 +1,46 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_LIB_UI_PAINTING_ENGINE_LAYER_H_ +#define FLUTTER_LIB_UI_PAINTING_ENGINE_LAYER_H_ + +#include "flutter/lib/ui/dart_wrapper.h" + +#include "flutter/flow/layers/layer.h" + +namespace tonic { +class DartLibraryNatives; +} // namespace tonic + +namespace blink { + +class EngineLayer; + +class EngineLayer : public RefCountedDartWrappable { + DEFINE_WRAPPERTYPEINFO(); + + public: + ~EngineLayer() override; + + size_t GetAllocationSize() override; + + static fml::RefPtr MakeRetained( + std::shared_ptr layer) { + return fml::MakeRefCounted(layer); + } + + static void RegisterNatives(tonic::DartLibraryNatives* natives); + + std::shared_ptr Layer() const { return layer_; } + + private: + explicit EngineLayer(std::shared_ptr layer); + std::shared_ptr layer_; + + FML_FRIEND_MAKE_REF_COUNTED(EngineLayer); +}; + +} // namespace blink + +#endif // FLUTTER_LIB_UI_PAINTING_ENGINE_LAYER_H_ diff --git a/lib/ui/painting/frame_info.cc b/lib/ui/painting/frame_info.cc index 03af5b4feb070..40359a02dce77 100644 --- a/lib/ui/painting/frame_info.cc +++ b/lib/ui/painting/frame_info.cc @@ -1,5 +1,5 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -18,6 +18,11 @@ IMPLEMENT_WRAPPERTYPEINFO(ui, FrameInfo); FOR_EACH_BINDING(DART_NATIVE_CALLBACK) +FrameInfo::FrameInfo(fml::RefPtr image, int durationMillis) + : image_(std::move(image)), durationMillis_(durationMillis) {} + +FrameInfo::~FrameInfo(){}; + void FrameInfo::RegisterNatives(tonic::DartLibraryNatives* natives) { natives->Register({FOR_EACH_BINDING(DART_REGISTER_NATIVE)}); } diff --git a/lib/ui/painting/frame_info.h b/lib/ui/painting/frame_info.h index 462ab513e0683..57ff23d91c43a 100644 --- a/lib/ui/painting/frame_info.h +++ b/lib/ui/painting/frame_info.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -25,9 +25,9 @@ class FrameInfo final : public RefCountedDartWrappable { static void RegisterNatives(tonic::DartLibraryNatives* natives); private: - FrameInfo(fml::RefPtr image, int durationMillis) - : image_(std::move(image)), durationMillis_(durationMillis) {} - ~FrameInfo(){}; + FrameInfo(fml::RefPtr image, int durationMillis); + + ~FrameInfo() override; const fml::RefPtr image_; const int durationMillis_; diff --git a/lib/ui/painting/gradient.cc b/lib/ui/painting/gradient.cc index 25b6595f6bf54..287e8e78621cc 100644 --- a/lib/ui/painting/gradient.cc +++ b/lib/ui/painting/gradient.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/gradient.h b/lib/ui/painting/gradient.h index 33450c2583812..83e2a45e0d22a 100644 --- a/lib/ui/painting/gradient.h +++ b/lib/ui/painting/gradient.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/image.cc b/lib/ui/painting/image.cc index d6ed502c033cd..bbb3b69736ed6 100644 --- a/lib/ui/painting/image.cc +++ b/lib/ui/painting/image.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/image.h b/lib/ui/painting/image.h index 44e5cf4edc7c9..a2db734b57516 100644 --- a/lib/ui/painting/image.h +++ b/lib/ui/painting/image.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -39,7 +39,7 @@ class CanvasImage final : public RefCountedDartWrappable { image_ = std::move(image); } - virtual size_t GetAllocationSize() override; + size_t GetAllocationSize() override; static void RegisterNatives(tonic::DartLibraryNatives* natives); diff --git a/lib/ui/painting/image_encoding.cc b/lib/ui/painting/image_encoding.cc index b689269cf492b..cee3896dae7b3 100644 --- a/lib/ui/painting/image_encoding.cc +++ b/lib/ui/painting/image_encoding.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -25,10 +25,6 @@ using tonic::DartInvoke; using tonic::DartPersistentValue; using tonic::ToDart; -#ifdef ERROR -#undef ERROR -#endif - namespace blink { namespace { diff --git a/lib/ui/painting/image_encoding.h b/lib/ui/painting/image_encoding.h index 39e3144f12e07..e4d66f0c8a0c9 100644 --- a/lib/ui/painting/image_encoding.h +++ b/lib/ui/painting/image_encoding.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/image_filter.cc b/lib/ui/painting/image_filter.cc index 85735060b6bda..94017beeb3ab3 100644 --- a/lib/ui/painting/image_filter.cc +++ b/lib/ui/painting/image_filter.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/image_filter.h b/lib/ui/painting/image_filter.h index bd5d2bfb99ae7..0cc0259113996 100644 --- a/lib/ui/painting/image_filter.h +++ b/lib/ui/painting/image_filter.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/image_shader.cc b/lib/ui/painting/image_shader.cc index e233c633c16bd..389a214270618 100644 --- a/lib/ui/painting/image_shader.cc +++ b/lib/ui/painting/image_shader.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/image_shader.h b/lib/ui/painting/image_shader.h index 17a5795e02558..1365577fa1de7 100644 --- a/lib/ui/painting/image_shader.h +++ b/lib/ui/painting/image_shader.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/matrix.cc b/lib/ui/painting/matrix.cc index 81c2f293b2f3d..3fe56783b7bcd 100644 --- a/lib/ui/painting/matrix.cc +++ b/lib/ui/painting/matrix.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/matrix.h b/lib/ui/painting/matrix.h index 25307b1b387c0..0a1d35064bde1 100644 --- a/lib/ui/painting/matrix.h +++ b/lib/ui/painting/matrix.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/paint.cc b/lib/ui/painting/paint.cc index 9b876542a61a7..16e953933732b 100644 --- a/lib/ui/painting/paint.cc +++ b/lib/ui/painting/paint.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/paint.h b/lib/ui/painting/paint.h index 2dd4ea14d91b6..67495736b489f 100644 --- a/lib/ui/painting/paint.h +++ b/lib/ui/painting/paint.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/path.cc b/lib/ui/painting/path.cc index 2066fbe929cfa..b6daf002d40ff 100644 --- a/lib/ui/painting/path.cc +++ b/lib/ui/painting/path.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/path.h b/lib/ui/painting/path.h index 995cf1351262b..c4bffa61f68e4 100644 --- a/lib/ui/painting/path.h +++ b/lib/ui/painting/path.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/path_measure.cc b/lib/ui/painting/path_measure.cc index 8533e5627b721..d22340381a57e 100644 --- a/lib/ui/painting/path_measure.cc +++ b/lib/ui/painting/path_measure.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/path_measure.h b/lib/ui/painting/path_measure.h index ad21f4d358371..5869e5a777ba6 100644 --- a/lib/ui/painting/path_measure.h +++ b/lib/ui/painting/path_measure.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/picture.cc b/lib/ui/painting/picture.cc index cbadebfc0a818..e65d1368d8a45 100644 --- a/lib/ui/painting/picture.cc +++ b/lib/ui/painting/picture.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/picture.h b/lib/ui/painting/picture.h index 01e7ecd596a7f..c95afd30f1f75 100644 --- a/lib/ui/painting/picture.h +++ b/lib/ui/painting/picture.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -31,7 +31,7 @@ class Picture : public RefCountedDartWrappable { void dispose(); - virtual size_t GetAllocationSize() override; + size_t GetAllocationSize() override; static void RegisterNatives(tonic::DartLibraryNatives* natives); diff --git a/lib/ui/painting/picture_recorder.cc b/lib/ui/painting/picture_recorder.cc index 9896f2f117a30..1cce5042ae204 100644 --- a/lib/ui/painting/picture_recorder.cc +++ b/lib/ui/painting/picture_recorder.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/picture_recorder.h b/lib/ui/painting/picture_recorder.h index 4e5cd861ce97b..90e5a4c03f365 100644 --- a/lib/ui/painting/picture_recorder.h +++ b/lib/ui/painting/picture_recorder.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -23,7 +23,7 @@ class PictureRecorder : public RefCountedDartWrappable { public: static fml::RefPtr Create(); - ~PictureRecorder(); + ~PictureRecorder() override; SkCanvas* BeginRecording(SkRect bounds); fml::RefPtr endRecording(); diff --git a/lib/ui/painting/rrect.cc b/lib/ui/painting/rrect.cc index 1436b95888df1..cd6a7d4456d33 100644 --- a/lib/ui/painting/rrect.cc +++ b/lib/ui/painting/rrect.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/rrect.h b/lib/ui/painting/rrect.h index c06769bfecc2c..c4a9045e674df 100644 --- a/lib/ui/painting/rrect.h +++ b/lib/ui/painting/rrect.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/shader.cc b/lib/ui/painting/shader.cc index 7999b84dfcc29..1331135917e71 100644 --- a/lib/ui/painting/shader.cc +++ b/lib/ui/painting/shader.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/shader.h b/lib/ui/painting/shader.h index 5fa0ce33c1d15..cfda1f341df35 100644 --- a/lib/ui/painting/shader.h +++ b/lib/ui/painting/shader.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/vertices.cc b/lib/ui/painting/vertices.cc index 6fc519cd777e2..2e23fcd975b11 100644 --- a/lib/ui/painting/vertices.cc +++ b/lib/ui/painting/vertices.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/painting/vertices.h b/lib/ui/painting/vertices.h index d487138385781..38ad28ac746f5 100644 --- a/lib/ui/painting/vertices.h +++ b/lib/ui/painting/vertices.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/plugins.dart b/lib/ui/plugins.dart index 0ae2b68ddbfc8..a0c65461a3e7a 100644 --- a/lib/ui/plugins.dart +++ b/lib/ui/plugins.dart @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/plugins/callback_cache.cc b/lib/ui/plugins/callback_cache.cc index 18c370f11763d..b2d4cc0d72d44 100644 --- a/lib/ui/plugins/callback_cache.cc +++ b/lib/ui/plugins/callback_cache.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,9 +9,9 @@ #include "flutter/fml/logging.h" #include "flutter/fml/paths.h" #include "flutter/lib/ui/plugins/callback_cache.h" -#include "third_party/rapidjson/rapidjson/document.h" -#include "third_party/rapidjson/rapidjson/stringbuffer.h" -#include "third_party/rapidjson/rapidjson/writer.h" +#include "rapidjson/document.h" +#include "rapidjson/stringbuffer.h" +#include "rapidjson/writer.h" #include "third_party/tonic/converter/dart_converter.h" using rapidjson::Document; @@ -134,7 +134,7 @@ void DartCallbackCache::LoadCacheFromDisk() { return; } const auto entries = d.GetArray(); - for (auto it = entries.begin(); it != entries.end(); ++it) { + for (auto* it = entries.begin(); it != entries.end(); ++it) { const auto root_obj = it->GetObject(); const auto representation = root_obj[kRepresentationKey].GetObject(); diff --git a/lib/ui/plugins/callback_cache.h b/lib/ui/plugins/callback_cache.h index b13002d332f9b..997b84426a4e5 100644 --- a/lib/ui/plugins/callback_cache.h +++ b/lib/ui/plugins/callback_cache.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/pointer.dart b/lib/ui/pointer.dart index 98a4f92385e95..c0d3757d84bd5 100644 --- a/lib/ui/pointer.dart +++ b/lib/ui/pointer.dart @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -71,12 +71,14 @@ class PointerData { this.pressureMax: 0.0, this.distance: 0.0, this.distanceMax: 0.0, + this.size: 0.0, this.radiusMajor: 0.0, this.radiusMinor: 0.0, this.radiusMin: 0.0, this.radiusMax: 0.0, this.orientation: 0.0, - this.tilt: 0.0 + this.tilt: 0.0, + this.platformData: 0, }); /// Time of event dispatch, relative to an arbitrary timeline. @@ -137,6 +139,14 @@ class PointerData { /// 0.0. final double distanceMax; + /// The area of the screen being pressed, scaled to a value between 0 and 1. + /// The value of size can be used to determine fat touch events. This value + /// is only set on Android, and is a device specific approximation within + /// the range of detectable values. So, for example, the value of 0.1 could + /// mean a touch with the tip of the finger, 0.2 a touch with full finger, + /// and 0.3 the full palm. + final double size; + /// The radius of the contact ellipse along the major axis, in logical pixels. final double radiusMajor; @@ -190,6 +200,9 @@ class PointerData { /// the stylus is flat on that surface). final double tilt; + /// Opaque platform-specific data associated with the event. + final int platformData; + @override String toString() => '$runtimeType(x: $physicalX, y: $physicalY)'; @@ -208,12 +221,14 @@ class PointerData { 'pressureMax: $pressureMax, ' 'distance: $distance, ' 'distanceMax: $distanceMax, ' + 'size: $size, ' 'radiusMajor: $radiusMajor, ' 'radiusMinor: $radiusMinor, ' 'radiusMin: $radiusMin, ' 'radiusMax: $radiusMax, ' 'orientation: $orientation, ' - 'tilt: $tilt' + 'tilt: $tilt, ' + 'platformData: $platformData' ')'; } } diff --git a/lib/ui/semantics.dart b/lib/ui/semantics.dart index d8125d0ae58bc..9b69b2834f9d4 100644 --- a/lib/ui/semantics.dart +++ b/lib/ui/semantics.dart @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -550,6 +550,7 @@ class SemanticsFlag { /// /// Once created, the [SemanticsUpdate] objects can be passed to /// [Window.updateSemantics] to update the semantics conveyed to the user. +@pragma('vm:entry-point') class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { /// Creates an empty [SemanticsUpdateBuilder] object. @pragma('vm:entry-point') @@ -723,6 +724,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { /// /// Semantics updates can be applied to the system's retained semantics tree /// using the [Window.updateSemantics] method. +@pragma('vm:entry-point') class SemanticsUpdate extends NativeFieldWrapperClass2 { /// This class is created by the engine, and should not be instantiated /// or extended directly. diff --git a/lib/ui/semantics/custom_accessibility_action.cc b/lib/ui/semantics/custom_accessibility_action.cc index 7f404e817027c..886bced770c7d 100644 --- a/lib/ui/semantics/custom_accessibility_action.cc +++ b/lib/ui/semantics/custom_accessibility_action.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,4 +10,4 @@ CustomAccessibilityAction::CustomAccessibilityAction() = default; CustomAccessibilityAction::~CustomAccessibilityAction() = default; -} +} // namespace blink diff --git a/lib/ui/semantics/custom_accessibility_action.h b/lib/ui/semantics/custom_accessibility_action.h index 3eb8356416143..ce9415aa00630 100644 --- a/lib/ui/semantics/custom_accessibility_action.h +++ b/lib/ui/semantics/custom_accessibility_action.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/semantics/semantics_node.cc b/lib/ui/semantics/semantics_node.cc index 563ca1d894976..cb655bdde8831 100644 --- a/lib/ui/semantics/semantics_node.cc +++ b/lib/ui/semantics/semantics_node.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,6 +10,8 @@ namespace blink { SemanticsNode::SemanticsNode() = default; +SemanticsNode::SemanticsNode(const SemanticsNode& other) = default; + SemanticsNode::~SemanticsNode() = default; bool SemanticsNode::HasAction(SemanticsAction action) { diff --git a/lib/ui/semantics/semantics_node.h b/lib/ui/semantics/semantics_node.h index e5d405d38e716..4275cb7d83d30 100644 --- a/lib/ui/semantics/semantics_node.h +++ b/lib/ui/semantics/semantics_node.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -69,6 +69,9 @@ enum class SemanticsFlags : int32_t { struct SemanticsNode { SemanticsNode(); + + SemanticsNode(const SemanticsNode& other); + ~SemanticsNode(); bool HasAction(SemanticsAction action); diff --git a/lib/ui/semantics/semantics_update.cc b/lib/ui/semantics/semantics_update.cc index a35befce6c384..6bb51751f46fa 100644 --- a/lib/ui/semantics/semantics_update.cc +++ b/lib/ui/semantics/semantics_update.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/semantics/semantics_update.h b/lib/ui/semantics/semantics_update.h index 21e75f60528a3..df43c425c39ba 100644 --- a/lib/ui/semantics/semantics_update.h +++ b/lib/ui/semantics/semantics_update.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/semantics/semantics_update_builder.cc b/lib/ui/semantics/semantics_update_builder.cc index 5536029565518..aca1fa7e32a42 100644 --- a/lib/ui/semantics/semantics_update_builder.cc +++ b/lib/ui/semantics/semantics_update_builder.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/semantics/semantics_update_builder.h b/lib/ui/semantics/semantics_update_builder.h index a9422afba6cae..ed486e260475c 100644 --- a/lib/ui/semantics/semantics_update_builder.h +++ b/lib/ui/semantics/semantics_update_builder.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/snapshot_delegate.h b/lib/ui/snapshot_delegate.h new file mode 100644 index 0000000000000..a124ff5b7ef21 --- /dev/null +++ b/lib/ui/snapshot_delegate.h @@ -0,0 +1,21 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_LIB_UI_SNAPSHOT_DELEGATE_H_ +#define FLUTTER_LIB_UI_SNAPSHOT_DELEGATE_H_ + +#include "third_party/skia/include/core/SkImage.h" +#include "third_party/skia/include/core/SkPicture.h" + +namespace blink { + +class SnapshotDelegate { + public: + virtual sk_sp MakeRasterSnapshot(sk_sp picture, + SkISize picture_size) = 0; +}; + +} // namespace blink + +#endif // FLUTTER_LIB_UI_SNAPSHOT_DELEGATE_H_ diff --git a/lib/ui/text.dart b/lib/ui/text.dart index 60498c5386157..9655585061974 100644 --- a/lib/ui/text.dart +++ b/lib/ui/text.dart @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -259,6 +259,7 @@ Int32List _encodeTextStyle( Locale locale, Paint background, Paint foreground, + List shadows ) { final Int32List result = new Int32List(8); if (color != null) { @@ -321,6 +322,10 @@ Int32List _encodeTextStyle( result[0] |= 1 << 15; // Passed separately to native. } + if (shadows != null) { + result[0] |= 1 << 16; + // Passed separately to native. + } return result; } @@ -359,6 +364,7 @@ class TextStyle { Locale locale, Paint background, Paint foreground, + List shadows, }) : assert(color == null || foreground == null, 'Cannot provide both a color and a foreground\n' 'The color argument is just a shorthand for "foreground: new Paint()..color = color".' @@ -379,6 +385,7 @@ class TextStyle { locale, background, foreground, + shadows, ), _fontFamily = fontFamily ?? '', _fontSize = fontSize, @@ -387,7 +394,8 @@ class TextStyle { _height = height, _locale = locale, _background = background, - _foreground = foreground; + _foreground = foreground, + _shadows = shadows; final Int32List _encoded; final String _fontFamily; @@ -398,6 +406,7 @@ class TextStyle { final Locale _locale; final Paint _background; final Paint _foreground; + final List _shadows; @override bool operator ==(dynamic other) { @@ -419,6 +428,8 @@ class TextStyle { if (_encoded[index] != typedOther._encoded[index]) return false; } + if (!Shadow._shadowsListEquals(_shadows, typedOther._shadows)) + return false; return true; } @@ -428,21 +439,22 @@ class TextStyle { @override String toString() { return 'TextStyle(' - 'color: ${ _encoded[0] & 0x0002 == 0x0002 ? new Color(_encoded[1]) : "unspecified"}, ' - 'decoration: ${ _encoded[0] & 0x0004 == 0x0004 ? new TextDecoration._(_encoded[2]) : "unspecified"}, ' - 'decorationColor: ${_encoded[0] & 0x0008 == 0x0008 ? new Color(_encoded[3]) : "unspecified"}, ' - 'decorationStyle: ${_encoded[0] & 0x0010 == 0x0010 ? TextDecorationStyle.values[_encoded[4]] : "unspecified"}, ' - 'fontWeight: ${ _encoded[0] & 0x0020 == 0x0020 ? FontWeight.values[_encoded[5]] : "unspecified"}, ' - 'fontStyle: ${ _encoded[0] & 0x0040 == 0x0040 ? FontStyle.values[_encoded[6]] : "unspecified"}, ' - 'textBaseline: ${ _encoded[0] & 0x0080 == 0x0080 ? TextBaseline.values[_encoded[7]] : "unspecified"}, ' - 'fontFamily: ${ _encoded[0] & 0x0100 == 0x0100 ? _fontFamily : "unspecified"}, ' - 'fontSize: ${ _encoded[0] & 0x0200 == 0x0200 ? _fontSize : "unspecified"}, ' - 'letterSpacing: ${ _encoded[0] & 0x0400 == 0x0400 ? "${_letterSpacing}x" : "unspecified"}, ' - 'wordSpacing: ${ _encoded[0] & 0x0800 == 0x0800 ? "${_wordSpacing}x" : "unspecified"}, ' - 'height: ${ _encoded[0] & 0x1000 == 0x1000 ? "${_height}x" : "unspecified"}, ' - 'locale: ${ _encoded[0] & 0x2000 == 0x2000 ? _locale : "unspecified"}, ' - 'background: ${ _encoded[0] & 0x4000 == 0x4000 ? _background : "unspecified"}, ' - 'foreground: ${ _encoded[0] & 0x8000 == 0x8000 ? _foreground : "unspecified"}' + 'color: ${ _encoded[0] & 0x00002 == 0x00002 ? new Color(_encoded[1]) : "unspecified"}, ' + 'decoration: ${ _encoded[0] & 0x00004 == 0x00004 ? new TextDecoration._(_encoded[2]) : "unspecified"}, ' + 'decorationColor: ${_encoded[0] & 0x00008 == 0x00008 ? new Color(_encoded[3]) : "unspecified"}, ' + 'decorationStyle: ${_encoded[0] & 0x00010 == 0x00010 ? TextDecorationStyle.values[_encoded[4]] : "unspecified"}, ' + 'fontWeight: ${ _encoded[0] & 0x00020 == 0x00020 ? FontWeight.values[_encoded[5]] : "unspecified"}, ' + 'fontStyle: ${ _encoded[0] & 0x00040 == 0x00040 ? FontStyle.values[_encoded[6]] : "unspecified"}, ' + 'textBaseline: ${ _encoded[0] & 0x00080 == 0x00080 ? TextBaseline.values[_encoded[7]] : "unspecified"}, ' + 'fontFamily: ${ _encoded[0] & 0x00100 == 0x00100 ? _fontFamily : "unspecified"}, ' + 'fontSize: ${ _encoded[0] & 0x00200 == 0x00200 ? _fontSize : "unspecified"}, ' + 'letterSpacing: ${ _encoded[0] & 0x00400 == 0x00400 ? "${_letterSpacing}x" : "unspecified"}, ' + 'wordSpacing: ${ _encoded[0] & 0x00800 == 0x00800 ? "${_wordSpacing}x" : "unspecified"}, ' + 'height: ${ _encoded[0] & 0x01000 == 0x01000 ? "${_height}x" : "unspecified"}, ' + 'locale: ${ _encoded[0] & 0x02000 == 0x02000 ? _locale : "unspecified"}, ' + 'background: ${ _encoded[0] & 0x04000 == 0x04000 ? _background : "unspecified"}, ' + 'foreground: ${ _encoded[0] & 0x08000 == 0x08000 ? _foreground : "unspecified"}, ' + 'shadows: ${ _encoded[0] & 0x10000 == 0x10000 ? _shadows : "unspecified"}' ')'; } } @@ -740,6 +752,7 @@ enum TextDirection { /// A rectangle enclosing a run of text. /// /// This is similar to [Rect] but includes an inherent [TextDirection]. +@pragma('vm:entry-point') class TextBox { /// Creates an object that describes a box containing text. const TextBox.fromLTRBD( @@ -935,6 +948,67 @@ class ParagraphConstraints { String toString() => '$runtimeType(width: $width)'; } +/// Defines various ways to vertically bound the boxes returned by +/// [Paragraph.getBoxesForRange]. +enum BoxHeightStyle { + /// Provide tight bounding boxes that fit heights per run. This style may result + /// in uneven bounding boxes that do not nicely connect with adjacent boxes. + tight, + + /// The height of the boxes will be the maximum height of all runs in the + /// line. All boxes in the same line will be the same height. This does not + /// guarantee that the boxes will cover the entire vertical height of the line + /// when there is additional line spacing. + /// + /// See [RectHeightStyle.includeLineSpacingTop], [RectHeightStyle.includeLineSpacingMiddle], + /// and [RectHeightStyle.includeLineSpacingBottom] for styles that will cover + /// the entire line. + max, + + /// Extends the top and bottom edge of the bounds to fully cover any line + /// spacing. + /// + /// The top and bottom of each box will cover half of the + /// space above and half of the space below the line. + /// + /// {@template flutter.dart:ui.boxHeightStyle.includeLineSpacing} + /// The top edge of each line should be the same as the bottom edge + /// of the line above. There should be no gaps in vertical coverage given any + /// amount of line spacing. Line spacing is not included above the first line + /// and below the last line due to no additional space present there. + /// {@endtemplate} + includeLineSpacingMiddle, + + /// Extends the top edge of the bounds to fully cover any line spacing. + /// + /// The line spacing will be added to the top of the box. + /// + /// {@macro flutter.dart:ui.rectHeightStyle.includeLineSpacing} + includeLineSpacingTop, + + /// Extends the bottom edge of the bounds to fully cover any line spacing. + /// + /// The line spacing will be added to the bottom of the box. + /// + /// {@macro flutter.dart:ui.boxHeightStyle.includeLineSpacing} + includeLineSpacingBottom, +} + +/// Defines various ways to horizontally bound the boxes returned by +/// [Paragraph.getBoxesForRange]. +enum BoxWidthStyle { + // Provide tight bounding boxes that fit widths to the runs of each line + // independently. + tight, + + /// Adds up to two additional boxes as needed at the beginning and/or end + /// of each line so that the widths of the boxes in line are the same width + /// as the widest line in the paragraph. The additional boxes on each line + /// are only added when the relevant box at the relevant edge of that line + /// does not span the maximum width of the paragraph. + max, +} + /// A paragraph of text. /// /// A paragraph retains the size and position of each glyph in the text and can @@ -944,6 +1018,7 @@ class ParagraphConstraints { /// /// Paragraphs can be displayed on a [Canvas] using the [Canvas.drawParagraph] /// method. +@pragma('vm:entry-point') class Paragraph extends NativeFieldWrapperClass2 { /// This class is created by the engine, and should not be instantiated /// or extended directly. @@ -998,7 +1073,22 @@ class Paragraph extends NativeFieldWrapperClass2 { void _layout(double width) native 'Paragraph_layout'; /// Returns a list of text boxes that enclose the given text range. - List getBoxesForRange(int start, int end) native 'Paragraph_getRectsForRange'; + /// + /// The [boxHeightStyle] and [boxWidthStyle] parameters allow customization + /// of how the boxes are bound vertically and horizontally. Both style + /// parameters default to the tight option, which will provide close-fitting + /// boxes and will not account for any line spacing. + /// + /// The [boxHeightStyle] and [boxWidthStyle] parameters must not be null. + /// + /// See [BoxHeightStyle] and [BoxWidthStyle] for full descriptions of each option. + List getBoxesForRange(int start, int end, {BoxHeightStyle boxHeightStyle = BoxHeightStyle.tight, BoxWidthStyle boxWidthStyle = BoxWidthStyle.tight}) { + assert(boxHeightStyle != null); + assert(boxWidthStyle != null); + return _getBoxesForRange(start, end, boxHeightStyle.index, boxWidthStyle.index); + } + + List _getBoxesForRange(int start, int end, int boxHeightStyle, int boxWidthStyle) native 'Paragraph_getRectsForRange'; /// Returns the text position closest to the given offset. TextPosition getPositionForOffset(Offset offset) { @@ -1035,6 +1125,7 @@ class Paragraph extends NativeFieldWrapperClass2 { /// After constructing a [Paragraph], call [Paragraph.layout] on it and then /// paint it with [Canvas.drawParagraph]. class ParagraphBuilder extends NativeFieldWrapperClass2 { + /// Creates a [ParagraphBuilder] object, which is used to create a /// [Paragraph]. @pragma('vm:entry-point') @@ -1044,8 +1135,8 @@ class ParagraphBuilder extends NativeFieldWrapperClass2 { /// Applies the given style to the added text until [pop] is called. /// /// See [pop] for details. - void pushStyle(TextStyle style) => _pushStyle(style._encoded, style._fontFamily, style._fontSize, style._letterSpacing, style._wordSpacing, style._height, _encodeLocale(style._locale), style._background?._objects, style._background?._data, style._foreground?._objects, style._foreground?._data); - void _pushStyle(Int32List encoded, String fontFamily, double fontSize, double letterSpacing, double wordSpacing, double height, String locale, List backgroundObjects, ByteData backgroundData, List foregroundObjects, ByteData foregroundData) native 'ParagraphBuilder_pushStyle'; + void pushStyle(TextStyle style) => _pushStyle(style._encoded, style._fontFamily, style._fontSize, style._letterSpacing, style._wordSpacing, style._height, _encodeLocale(style._locale), style._background?._objects, style._background?._data, style._foreground?._objects, style._foreground?._data, Shadow._encodeShadows(style._shadows)); + void _pushStyle(Int32List encoded, String fontFamily, double fontSize, double letterSpacing, double wordSpacing, double height, String locale, List backgroundObjects, ByteData backgroundData, List foregroundObjects, ByteData foregroundData, ByteData shadowsData) native 'ParagraphBuilder_pushStyle'; static String _encodeLocale(Locale locale) => locale?.toString() ?? ''; @@ -1074,3 +1165,16 @@ class ParagraphBuilder extends NativeFieldWrapperClass2 { /// cannot be used further. Paragraph build() native 'ParagraphBuilder_build'; } + +/// Loads a font from a buffer and makes it available for rendering text. +/// +/// * `list`: A list of bytes containing the font file. +/// * `fontFamily`: The family name used to identify the font in text styles. +/// If this is not provided, then the family name will be extracted from the font file. +Future loadFontFromList(Uint8List list, {String fontFamily}) { + return _futurize( + (_Callback callback) => _loadFontFromList(list, callback, fontFamily) + ); +} + +String _loadFontFromList(Uint8List list, _Callback callback, String fontFamily) native 'loadFontFromList'; diff --git a/lib/ui/text/asset_manager_font_provider.cc b/lib/ui/text/asset_manager_font_provider.cc index 6caf8dd898b91..da2d0a15be9d7 100644 --- a/lib/ui/text/asset_manager_font_provider.cc +++ b/lib/ui/text/asset_manager_font_provider.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,7 +21,7 @@ void MappingReleaseProc(const void* ptr, void* context) { } // anonymous namespace AssetManagerFontProvider::AssetManagerFontProvider( - fml::RefPtr asset_manager) + std::shared_ptr asset_manager) : asset_manager_(asset_manager) {} AssetManagerFontProvider::~AssetManagerFontProvider() = default; @@ -40,7 +40,7 @@ std::string AssetManagerFontProvider::GetFamilyName(int index) const { // |FontAssetProvider| SkFontStyleSet* AssetManagerFontProvider::MatchFamily( const std::string& family_name) { - auto found = registered_families_.find(family_name); + auto found = registered_families_.find(CanonicalFamilyName(family_name)); if (found == registered_families_.end()) { return nullptr; } @@ -49,13 +49,14 @@ SkFontStyleSet* AssetManagerFontProvider::MatchFamily( void AssetManagerFontProvider::RegisterAsset(std::string family_name, std::string asset) { - auto family_it = registered_families_.find(family_name); + std::string canonical_name = CanonicalFamilyName(family_name); + auto family_it = registered_families_.find(canonical_name); if (family_it == registered_families_.end()) { family_names_.push_back(family_name); family_it = registered_families_ .emplace(std::piecewise_construct, - std::forward_as_tuple(family_name), + std::forward_as_tuple(canonical_name), std::forward_as_tuple(asset_manager_)) .first; } @@ -64,7 +65,7 @@ void AssetManagerFontProvider::RegisterAsset(std::string family_name, } AssetManagerFontStyleSet::AssetManagerFontStyleSet( - fml::RefPtr asset_manager) + std::shared_ptr asset_manager) : asset_manager_(asset_manager) {} AssetManagerFontStyleSet::~AssetManagerFontStyleSet() = default; @@ -122,4 +123,12 @@ SkTypeface* AssetManagerFontStyleSet::matchStyle(const SkFontStyle& pattern) { return SkRef(assets_[0].typeface.get()); } +AssetManagerFontStyleSet::TypefaceAsset::TypefaceAsset(std::string a) + : asset(std::move(a)) {} + +AssetManagerFontStyleSet::TypefaceAsset::TypefaceAsset( + const AssetManagerFontStyleSet::TypefaceAsset& other) = default; + +AssetManagerFontStyleSet::TypefaceAsset::~TypefaceAsset() = default; + } // namespace blink diff --git a/lib/ui/text/asset_manager_font_provider.h b/lib/ui/text/asset_manager_font_provider.h index a6f9544ab2611..d55cf71e3bd93 100644 --- a/lib/ui/text/asset_manager_font_provider.h +++ b/lib/ui/text/asset_manager_font_provider.h @@ -1,10 +1,11 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FLUTTER_LIB_UI_TEXT_ASSET_MANAGER_FONT_PROVIDER_H_ #define FLUTTER_LIB_UI_TEXT_ASSET_MANAGER_FONT_PROVIDER_H_ +#include #include #include #include @@ -12,13 +13,14 @@ #include "flutter/assets/asset_manager.h" #include "flutter/fml/macros.h" #include "third_party/skia/include/core/SkFontMgr.h" +#include "third_party/skia/include/core/SkTypeface.h" #include "txt/font_asset_provider.h" namespace blink { class AssetManagerFontStyleSet : public SkFontStyleSet { public: - AssetManagerFontStyleSet(fml::RefPtr asset_manager); + AssetManagerFontStyleSet(std::shared_ptr asset_manager); ~AssetManagerFontStyleSet() override; @@ -37,10 +39,15 @@ class AssetManagerFontStyleSet : public SkFontStyleSet { SkTypeface* matchStyle(const SkFontStyle& pattern) override; private: - fml::RefPtr asset_manager_; + std::shared_ptr asset_manager_; struct TypefaceAsset { - TypefaceAsset(std::string a) : asset(std::move(a)) {} + TypefaceAsset(std::string a); + + TypefaceAsset(const TypefaceAsset& other); + + ~TypefaceAsset(); + std::string asset; sk_sp typeface; }; @@ -51,7 +58,8 @@ class AssetManagerFontStyleSet : public SkFontStyleSet { class AssetManagerFontProvider : public txt::FontAssetProvider { public: - AssetManagerFontProvider(fml::RefPtr asset_manager); + AssetManagerFontProvider(std::shared_ptr asset_manager); + ~AssetManagerFontProvider() override; void RegisterAsset(std::string family_name, std::string asset); @@ -66,7 +74,7 @@ class AssetManagerFontProvider : public txt::FontAssetProvider { SkFontStyleSet* MatchFamily(const std::string& family_name) override; private: - fml::RefPtr asset_manager_; + std::shared_ptr asset_manager_; std::unordered_map registered_families_; std::vector family_names_; diff --git a/lib/ui/text/font_collection.cc b/lib/ui/text/font_collection.cc index b5a88354cc05b..66fb3f83077b2 100644 --- a/lib/ui/text/font_collection.cc +++ b/lib/ui/text/font_collection.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,22 +7,49 @@ #include #include "flutter/lib/ui/text/asset_manager_font_provider.h" +#include "flutter/lib/ui/ui_dart_state.h" +#include "flutter/lib/ui/window/window.h" #include "flutter/runtime/test_font_data.h" -#include "third_party/rapidjson/rapidjson/document.h" -#include "third_party/rapidjson/rapidjson/rapidjson.h" +#include "rapidjson/document.h" +#include "rapidjson/rapidjson.h" #include "third_party/skia/include/core/SkFontMgr.h" #include "third_party/skia/include/core/SkGraphics.h" #include "third_party/skia/include/core/SkStream.h" #include "third_party/skia/include/core/SkTypeface.h" +#include "third_party/tonic/dart_args.h" +#include "third_party/tonic/dart_library_natives.h" +#include "third_party/tonic/logging/dart_invoke.h" +#include "third_party/tonic/typed_data/uint8_list.h" #include "txt/asset_font_manager.h" #include "txt/test_font_manager.h" -#include "txt/typeface_font_asset_provider.h" namespace blink { +namespace { + +void LoadFontFromList(tonic::Uint8List& font_data, + Dart_Handle callback, + std::string family_name) { + FontCollection& font_collection = + UIDartState::Current()->window()->client()->GetFontCollection(); + font_collection.LoadFontFromList(font_data.data(), font_data.num_elements(), + family_name); + font_data.Release(); + tonic::DartInvoke(callback, {tonic::ToDart(0)}); +} + +void _LoadFontFromList(Dart_NativeArguments args) { + tonic::DartCallStatic(LoadFontFromList, args); +} + +} // namespace + FontCollection::FontCollection() : collection_(std::make_shared()) { collection_->SetDefaultFontManager(SkFontMgr::RefDefault()); + + dynamic_font_manager_ = sk_make_sp(); + collection_->SetDynamicFontManager(dynamic_font_manager_); } FontCollection::~FontCollection() { @@ -30,11 +57,18 @@ FontCollection::~FontCollection() { SkGraphics::PurgeFontCache(); } +void FontCollection::RegisterNatives(tonic::DartLibraryNatives* natives) { + natives->Register({ + {"loadFontFromList", _LoadFontFromList, 3, true}, + }); +} + std::shared_ptr FontCollection::GetFontCollection() const { return collection_; } -void FontCollection::RegisterFonts(fml::RefPtr asset_manager) { +void FontCollection::RegisterFonts( + std::shared_ptr asset_manager) { std::unique_ptr manifest_mapping = asset_manager->GetAsMapping("FontManifest.json"); if (manifest_mapping == nullptr) { @@ -110,4 +144,20 @@ void FontCollection::RegisterTestFonts() { collection_->DisableFontFallback(); } +void FontCollection::LoadFontFromList(const uint8_t* font_data, + int length, + std::string family_name) { + std::unique_ptr font_stream = + std::make_unique(font_data, length, true); + sk_sp typeface = + SkTypeface::MakeFromStream(std::move(font_stream)); + txt::TypefaceFontAssetProvider& font_provider = + dynamic_font_manager_->font_provider(); + if (family_name.empty()) { + font_provider.RegisterTypeface(typeface); + } else { + font_provider.RegisterTypeface(typeface, family_name); + } +} + } // namespace blink diff --git a/lib/ui/text/font_collection.h b/lib/ui/text/font_collection.h index c9ef29cc05ade..a50eab4b8d529 100644 --- a/lib/ui/text/font_collection.h +++ b/lib/ui/text/font_collection.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,6 +13,10 @@ #include "flutter/fml/memory/ref_ptr.h" #include "txt/font_collection.h" +namespace tonic { +class DartLibraryNatives; +} // namespace tonic + namespace blink { class FontCollection { @@ -21,14 +25,21 @@ class FontCollection { ~FontCollection(); + static void RegisterNatives(tonic::DartLibraryNatives* natives); + std::shared_ptr GetFontCollection() const; - void RegisterFonts(fml::RefPtr asset_manager); + void RegisterFonts(std::shared_ptr asset_manager); void RegisterTestFonts(); + void LoadFontFromList(const uint8_t* font_data, + int length, + std::string family_name); + private: std::shared_ptr collection_; + sk_sp dynamic_font_manager_; FML_DISALLOW_COPY_AND_ASSIGN(FontCollection); }; diff --git a/lib/ui/text/paragraph.cc b/lib/ui/text/paragraph.cc index 94277c51be8a4..9c4438f12f19d 100644 --- a/lib/ui/text/paragraph.cc +++ b/lib/ui/text/paragraph.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -84,8 +84,13 @@ void Paragraph::paint(Canvas* canvas, double x, double y) { m_paragraphImpl->paint(canvas, x, y); } -std::vector Paragraph::getRectsForRange(unsigned start, unsigned end) { - return m_paragraphImpl->getRectsForRange(start, end); +std::vector Paragraph::getRectsForRange(unsigned start, + unsigned end, + unsigned boxHeightStyle, + unsigned boxWidthStyle) { + return m_paragraphImpl->getRectsForRange( + start, end, static_cast(boxHeightStyle), + static_cast(boxWidthStyle)); } Dart_Handle Paragraph::getPositionForOffset(double dx, double dy) { diff --git a/lib/ui/text/paragraph.h b/lib/ui/text/paragraph.h index e5f5e2bddb703..15df77310c17a 100644 --- a/lib/ui/text/paragraph.h +++ b/lib/ui/text/paragraph.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -42,11 +42,14 @@ class Paragraph : public RefCountedDartWrappable { void layout(double width); void paint(Canvas* canvas, double x, double y); - std::vector getRectsForRange(unsigned start, unsigned end); + std::vector getRectsForRange(unsigned start, + unsigned end, + unsigned boxHeightStyle, + unsigned boxWidthStyle); Dart_Handle getPositionForOffset(double dx, double dy); Dart_Handle getWordBoundary(unsigned offset); - virtual size_t GetAllocationSize() override; + size_t GetAllocationSize() override; static void RegisterNatives(tonic::DartLibraryNatives* natives); diff --git a/lib/ui/text/paragraph_builder.cc b/lib/ui/text/paragraph_builder.cc index 15ce9c8167e0c..bb822417082c2 100644 --- a/lib/ui/text/paragraph_builder.cc +++ b/lib/ui/text/paragraph_builder.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,7 @@ #include "flutter/common/settings.h" #include "flutter/common/task_runners.h" +#include "flutter/fml/logging.h" #include "flutter/fml/task_runner.h" #include "flutter/lib/ui/text/font_collection.h" #include "flutter/lib/ui/ui_dart_state.h" @@ -16,10 +17,12 @@ #include "flutter/third_party/txt/src/txt/text_decoration.h" #include "flutter/third_party/txt/src/txt/text_style.h" #include "third_party/icu/source/common/unicode/ustring.h" +#include "third_party/skia/include/core/SkColor.h" #include "third_party/tonic/converter/dart_converter.h" #include "third_party/tonic/dart_args.h" #include "third_party/tonic/dart_binding_macros.h" #include "third_party/tonic/dart_library_natives.h" +#include "third_party/tonic/typed_data/dart_byte_data.h" namespace blink { namespace { @@ -41,6 +44,7 @@ const int tsHeightIndex = 12; const int tsLocaleIndex = 13; const int tsBackgroundIndex = 14; const int tsForegroundIndex = 15; +const int tsTextShadowsIndex = 16; const int tsColorMask = 1 << tsColorIndex; const int tsTextDecorationMask = 1 << tsTextDecorationIndex; @@ -57,6 +61,7 @@ const int tsHeightMask = 1 << tsHeightIndex; const int tsLocaleMask = 1 << tsLocaleIndex; const int tsBackgroundMask = 1 << tsBackgroundIndex; const int tsForegroundMask = 1 << tsForegroundIndex; +const int tsTextShadowsMask = 1 << tsTextShadowsIndex; // ParagraphStyle @@ -82,6 +87,16 @@ const int psLineHeightMask = 1 << psLineHeightIndex; const int psEllipsisMask = 1 << psEllipsisIndex; const int psLocaleMask = 1 << psLocaleIndex; +// TextShadows decoding + +constexpr uint32_t kColorDefault = 0xFF000000; +constexpr uint32_t kBytesPerShadow = 16; +constexpr uint32_t kShadowPropertiesCount = 4; +constexpr uint32_t kColorOffset = 0; +constexpr uint32_t kXOffset = 1; +constexpr uint32_t kYOffset = 2; +constexpr uint32_t kBlurOffset = 3; + } // namespace static void ParagraphBuilder_constructor(Dart_NativeArguments args) { @@ -148,13 +163,11 @@ ParagraphBuilder::ParagraphBuilder(tonic::Int32List& encoded, if (mask & psMaxLinesMask) style.max_lines = encoded[psMaxLinesIndex]; - if (mask & psEllipsisMask) { + if (mask & psEllipsisMask) style.ellipsis = ellipsis; - } - if (mask & psLocaleMask) { + if (mask & psLocaleMask) style.locale = locale; - } FontCollection& font_collection = UIDartState::Current()->window()->client()->GetFontCollection(); @@ -164,6 +177,30 @@ ParagraphBuilder::ParagraphBuilder(tonic::Int32List& encoded, ParagraphBuilder::~ParagraphBuilder() = default; +void decodeTextShadows(Dart_Handle shadows_data, + std::vector& decoded_shadows) { + decoded_shadows.clear(); + + tonic::DartByteData byte_data(shadows_data); + FML_CHECK(byte_data.length_in_bytes() % kBytesPerShadow == 0); + + const uint32_t* uint_data = static_cast(byte_data.data()); + const float* float_data = static_cast(byte_data.data()); + + size_t shadow_count = byte_data.length_in_bytes() / kBytesPerShadow; + size_t shadow_count_offset = 0; + for (size_t shadow_index = 0; shadow_index < shadow_count; ++shadow_index) { + shadow_count_offset = shadow_index * kShadowPropertiesCount; + SkColor color = + uint_data[shadow_count_offset + kColorOffset] ^ kColorDefault; + decoded_shadows.emplace_back( + color, + SkPoint::Make(float_data[shadow_count_offset + kXOffset], + float_data[shadow_count_offset + kYOffset]), + float_data[shadow_count_offset + kBlurOffset]); + } +} + void ParagraphBuilder::pushStyle(tonic::Int32List& encoded, const std::string& fontFamily, double fontSize, @@ -174,7 +211,8 @@ void ParagraphBuilder::pushStyle(tonic::Int32List& encoded, Dart_Handle background_objects, Dart_Handle background_data, Dart_Handle foreground_objects, - Dart_Handle foreground_data) { + Dart_Handle foreground_data, + Dart_Handle shadows_data) { FML_DCHECK(encoded.num_elements() == 8); int32_t mask = encoded[0]; @@ -183,6 +221,8 @@ void ParagraphBuilder::pushStyle(tonic::Int32List& encoded, // explicitly given. txt::TextStyle style = m_paragraphBuilder->PeekStyle(); + // Only change the style property from the previous value if a new explicitly + // set value is available if (mask & tsColorMask) style.color = encoded[tsColorIndex]; @@ -249,6 +289,10 @@ void ParagraphBuilder::pushStyle(tonic::Int32List& encoded, } } + if (mask & tsTextShadowsMask) { + decodeTextShadows(shadows_data, style.text_shadows); + } + m_paragraphBuilder->PushStyle(style); } diff --git a/lib/ui/text/paragraph_builder.h b/lib/ui/text/paragraph_builder.h index 56f12b1de6d14..89383527c6db7 100644 --- a/lib/ui/text/paragraph_builder.h +++ b/lib/ui/text/paragraph_builder.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -44,7 +44,8 @@ class ParagraphBuilder : public RefCountedDartWrappable { Dart_Handle background_objects, Dart_Handle background_data, Dart_Handle foreground_objects, - Dart_Handle foreground_data); + Dart_Handle foreground_data, + Dart_Handle shadows_data); void pop(); diff --git a/lib/ui/text/paragraph_impl.cc b/lib/ui/text/paragraph_impl.cc index 65483a8b68142..eb5f4bb0d9005 100644 --- a/lib/ui/text/paragraph_impl.cc +++ b/lib/ui/text/paragraph_impl.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/text/paragraph_impl.h b/lib/ui/text/paragraph_impl.h index f8e1ef09d4be2..b1b3c51f77107 100644 --- a/lib/ui/text/paragraph_impl.h +++ b/lib/ui/text/paragraph_impl.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,6 +7,7 @@ #include "flutter/lib/ui/painting/canvas.h" #include "flutter/lib/ui/text/text_box.h" +#include "flutter/third_party/txt/src/txt/paragraph.h" namespace blink { @@ -32,8 +33,11 @@ class ParagraphImpl { virtual void paint(Canvas* canvas, double x, double y) = 0; - virtual std::vector getRectsForRange(unsigned start, - unsigned end) = 0; + virtual std::vector getRectsForRange( + unsigned start, + unsigned end, + txt::Paragraph::RectHeightStyle rect_height_style, + txt::Paragraph::RectWidthStyle rect_width_style) = 0; virtual Dart_Handle getPositionForOffset(double dx, double dy) = 0; diff --git a/lib/ui/text/paragraph_impl_txt.cc b/lib/ui/text/paragraph_impl_txt.cc index ccd77287ecaa3..5a00fbbda93cd 100644 --- a/lib/ui/text/paragraph_impl_txt.cc +++ b/lib/ui/text/paragraph_impl_txt.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -61,11 +61,14 @@ void ParagraphImplTxt::paint(Canvas* canvas, double x, double y) { m_paragraph->Paint(sk_canvas, x, y); } -std::vector ParagraphImplTxt::getRectsForRange(unsigned start, - unsigned end) { +std::vector ParagraphImplTxt::getRectsForRange( + unsigned start, + unsigned end, + txt::Paragraph::RectHeightStyle rect_height_style, + txt::Paragraph::RectWidthStyle rect_width_style) { std::vector result; - std::vector boxes = - m_paragraph->GetRectsForRange(start, end); + std::vector boxes = m_paragraph->GetRectsForRange( + start, end, rect_height_style, rect_width_style); for (const txt::Paragraph::TextBox& box : boxes) { result.emplace_back(box.rect, static_cast(box.direction)); diff --git a/lib/ui/text/paragraph_impl_txt.h b/lib/ui/text/paragraph_impl_txt.h index 54f5dcff8127b..226526e6e696f 100644 --- a/lib/ui/text/paragraph_impl_txt.h +++ b/lib/ui/text/paragraph_impl_txt.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,7 +8,6 @@ #include "flutter/lib/ui/painting/canvas.h" #include "flutter/lib/ui/text/paragraph_impl.h" #include "flutter/lib/ui/text/text_box.h" -#include "flutter/third_party/txt/src/txt/paragraph.h" namespace blink { @@ -29,7 +28,11 @@ class ParagraphImplTxt : public ParagraphImpl { void layout(double width) override; void paint(Canvas* canvas, double x, double y) override; - std::vector getRectsForRange(unsigned start, unsigned end) override; + std::vector getRectsForRange( + unsigned start, + unsigned end, + txt::Paragraph::RectHeightStyle rect_height_style, + txt::Paragraph::RectWidthStyle rect_width_style) override; Dart_Handle getPositionForOffset(double dx, double dy) override; Dart_Handle getWordBoundary(unsigned offset) override; diff --git a/lib/ui/text/text_box.cc b/lib/ui/text/text_box.cc index 8e254afe40ad9..2d22d954a8b93 100644 --- a/lib/ui/text/text_box.cc +++ b/lib/ui/text/text_box.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/text/text_box.h b/lib/ui/text/text_box.h index 839142ddcba8d..785f5b37bd3b6 100644 --- a/lib/ui/text/text_box.h +++ b/lib/ui/text/text_box.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/ui.dart b/lib/ui/ui.dart index 8c4480c072cdb..47fa1bb53bc37 100644 --- a/lib/ui/ui.dart +++ b/lib/ui/ui.dart @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/ui_dart_state.cc b/lib/ui/ui_dart_state.cc index 0d762f785262d..5d0f0d73c72ec 100644 --- a/lib/ui/ui_dart_state.cc +++ b/lib/ui/ui_dart_state.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,6 +16,7 @@ namespace blink { UIDartState::UIDartState(TaskRunners task_runners, TaskObserverAdd add_callback, TaskObserverRemove remove_callback, + fml::WeakPtr snapshot_delegate, fml::WeakPtr resource_context, fml::RefPtr skia_unref_queue, std::string advisory_script_uri, @@ -25,6 +26,7 @@ UIDartState::UIDartState(TaskRunners task_runners, : task_runners_(std::move(task_runners)), add_callback_(std::move(add_callback)), remove_callback_(std::move(remove_callback)), + snapshot_delegate_(std::move(snapshot_delegate)), resource_context_(std::move(resource_context)), advisory_script_uri_(std::move(advisory_script_uri)), advisory_script_entrypoint_(std::move(advisory_script_entrypoint)), @@ -52,7 +54,13 @@ void UIDartState::DidSetIsolate() { // main.dart$main-1234 debug_name << advisory_script_uri_ << "$" << advisory_script_entrypoint_ << "-" << main_port_; - debug_name_ = debug_name.str(); + SetDebugName(debug_name.str()); +} + +void UIDartState::SetDebugName(const std::string debug_name) { + debug_name_ = debug_name; + if (window_) + window_->client()->UpdateIsolateDescription(debug_name_, main_port_); } UIDartState* UIDartState::Current() { @@ -61,6 +69,8 @@ UIDartState* UIDartState::Current() { void UIDartState::SetWindow(std::unique_ptr window) { window_ = std::move(window); + if (window_) + window_->client()->UpdateIsolateDescription(debug_name_, main_port_); } const TaskRunners& UIDartState::GetTaskRunners() const { @@ -99,6 +109,10 @@ void UIDartState::AddOrRemoveTaskObserver(bool add) { } } +fml::WeakPtr UIDartState::GetSnapshotDelegate() const { + return snapshot_delegate_; +} + fml::WeakPtr UIDartState::GetResourceContext() const { return resource_context_; } diff --git a/lib/ui/ui_dart_state.h b/lib/ui/ui_dart_state.h index 6d4094a47f2be..ce81804937f63 100644 --- a/lib/ui/ui_dart_state.h +++ b/lib/ui/ui_dart_state.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,6 +15,7 @@ #include "flutter/fml/build_config.h" #include "flutter/fml/memory/weak_ptr.h" #include "flutter/lib/ui/isolate_name_server/isolate_name_server.h" +#include "flutter/lib/ui/snapshot_delegate.h" #include "third_party/dart/runtime/include/dart_api.h" #include "third_party/skia/include/gpu/GrContext.h" #include "third_party/tonic/dart_microtask_queue.h" @@ -31,6 +32,8 @@ class UIDartState : public tonic::DartState { Dart_Port main_port() const { return main_port_; } + void SetDebugName(const std::string name); + const std::string& debug_name() const { return debug_name_; } const std::string& logger_prefix() const { return logger_prefix_; } @@ -45,6 +48,8 @@ class UIDartState : public tonic::DartState { fml::RefPtr GetSkiaUnrefQueue() const; + fml::WeakPtr GetSnapshotDelegate() const; + fml::WeakPtr GetResourceContext() const; IsolateNameServer* GetIsolateNameServer(); @@ -56,7 +61,7 @@ class UIDartState : public tonic::DartState { if (!object) { return {}; } - auto state = UIDartState::Current(); + auto* state = UIDartState::Current(); FML_DCHECK(state); auto queue = state->GetSkiaUnrefQueue(); return {std::move(object), std::move(queue)}; @@ -66,6 +71,7 @@ class UIDartState : public tonic::DartState { UIDartState(TaskRunners task_runners, TaskObserverAdd add_callback, TaskObserverRemove remove_callback, + fml::WeakPtr snapshot_delegate, fml::WeakPtr resource_context, fml::RefPtr skia_unref_queue, std::string advisory_script_uri, @@ -87,6 +93,7 @@ class UIDartState : public tonic::DartState { const TaskRunners task_runners_; const TaskObserverAdd add_callback_; const TaskObserverRemove remove_callback_; + fml::WeakPtr snapshot_delegate_; fml::WeakPtr resource_context_; const std::string advisory_script_uri_; const std::string advisory_script_entrypoint_; diff --git a/lib/ui/window.dart b/lib/ui/window.dart index 0b1318c997aaf..76ef10a932b18 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -116,9 +116,11 @@ class WindowPadding { } } -/// An identifier used to select a user's language and formatting preferences, -/// consisting of a language and a country. This is a subset of locale -/// identifiers as defined by BCP 47. +/// An identifier used to select a user's language and formatting preferences. +/// +/// This represents a [Unicode Language +/// Identifier](https://www.unicode.org/reports/tr35/#Unicode_language_identifier) +/// (i.e. without Locale extensions), except variants are not supported. /// /// Locales are canonicalized according to the "preferred value" entries in the /// [IANA Language Subtag @@ -133,7 +135,8 @@ class WindowPadding { /// [Locale]. class Locale { /// Creates a new Locale object. The first argument is the - /// primary language subtag, the second is the region subtag. + /// primary language subtag, the second is the region (also + /// referred to as 'country') subtag. /// /// For example: /// @@ -143,18 +146,63 @@ class Locale { /// ``` /// /// The primary language subtag must not be null. The region subtag is - /// optional. + /// optional. When there is no region/country subtag, the parameter should + /// be omitted or passed `null` instead of an empty-string. + /// + /// The subtag values are _case sensitive_ and must be one of the valid + /// subtags according to CLDR supplemental data: + /// [language](http://unicode.org/cldr/latest/common/validity/language.xml), + /// [region](http://unicode.org/cldr/latest/common/validity/region.xml). The + /// primary language subtag must be at least two and at most eight lowercase + /// letters, but not four letters. The region region subtag must be two + /// uppercase letters or three digits. See the [Unicode Language + /// Identifier](https://www.unicode.org/reports/tr35/#Unicode_language_identifier) + /// specification. + /// + /// Validity is not checked by default, but some methods may throw away + /// invalid data. + /// + /// See also: /// - /// The values are _case sensitive_, and should match the case of the relevant - /// subtags in the [IANA Language Subtag - /// Registry](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry). - /// Typically this means the primary language subtag should be lowercase and - /// the region subtag should be uppercase. - const Locale(this._languageCode, [ this._countryCode ]) : assert(_languageCode != null); + /// * [new Locale.fromSubtags], which also allows a [scriptCode] to be + /// specified. + const Locale( + this._languageCode, [ + this._countryCode, + ]) : assert(_languageCode != null), + assert(_languageCode != ''), + scriptCode = null; + + /// Creates a new Locale object. + /// + /// The keyword arguments specify the subtags of the Locale. + /// + /// The subtag values are _case sensitive_ and must be valid subtags according + /// to CLDR supplemental data: + /// [language](http://unicode.org/cldr/latest/common/validity/language.xml), + /// [script](http://unicode.org/cldr/latest/common/validity/script.xml) and + /// [region](http://unicode.org/cldr/latest/common/validity/region.xml) for + /// each of languageCode, scriptCode and countryCode respectively. + /// + /// The [countryCode] subtag is optional. When there is no country subtag, + /// the parameter should be omitted or passed `null` instead of an empty-string. + /// + /// Validity is not checked by default, but some methods may throw away + /// invalid data. + const Locale.fromSubtags({ + String languageCode = 'und', + this.scriptCode, + String countryCode, + }) : assert(languageCode != null), + assert(languageCode != ''), + _languageCode = languageCode, + assert(scriptCode != ''), + assert(countryCode != ''), + _countryCode = countryCode; /// The primary language subtag for the locale. /// - /// This must not be null. + /// This must not be null. It may be 'und', representing 'undefined'. /// /// This is expected to be string registered in the [IANA Language Subtag /// Registry](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry) @@ -166,10 +214,19 @@ class Locale { /// Locale('he')` and `const Locale('iw')` are equal, and both have the /// [languageCode] `he`, because `iw` is a deprecated language subtag that was /// replaced by the subtag `he`. - String get languageCode => _canonicalizeLanguageCode(_languageCode); + /// + /// This must be a valid Unicode Language subtag as listed in [Unicode CLDR + /// supplemental + /// data](http://unicode.org/cldr/latest/common/validity/language.xml). + /// + /// See also: + /// + /// * [new Locale.fromSubtags], which describes the conventions for creating + /// [Locale] objects. + String get languageCode => _replaceDeprecatedLanguageSubtag(_languageCode); final String _languageCode; - static String _canonicalizeLanguageCode(String languageCode) { + static String _replaceDeprecatedLanguageSubtag(String languageCode) { // This switch statement is generated by //flutter/tools/gen_locale.dart // Mappings generated for language subtag registry as of 2018-08-08. switch (languageCode) { @@ -255,9 +312,23 @@ class Locale { } } + /// The script subtag for the locale. + /// + /// This may be null, indicating that there is no specified script subtag. + /// + /// This must be a valid Unicode Language Identifier script subtag as listed + /// in [Unicode CLDR supplemental + /// data](http://unicode.org/cldr/latest/common/validity/script.xml). + /// + /// See also: + /// + /// * [new Locale.fromSubtags], which describes the conventions for creating + /// [Locale] objects. + final String scriptCode; + /// The region subtag for the locale. /// - /// This can be null. + /// This may be null, indicating that there is no specified region subtag. /// /// This is expected to be string registered in the [IANA Language Subtag /// Registry](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry) @@ -269,10 +340,15 @@ class Locale { /// 'DE')` and `const Locale('de', 'DD')` are equal, and both have the /// [countryCode] `DE`, because `DD` is a deprecated language subtag that was /// replaced by the subtag `DE`. - String get countryCode => _canonicalizeRegionCode(_countryCode); + /// + /// See also: + /// + /// * [new Locale.fromSubtags], which describes the conventions for creating + /// [Locale] objects. + String get countryCode => _replaceDeprecatedRegionSubtag(_countryCode); final String _countryCode; - static String _canonicalizeRegionCode(String regionCode) { + static String _replaceDeprecatedRegionSubtag(String regionCode) { // This switch statement is generated by //flutter/tools/gen_locale.dart // Mappings generated for language subtag registry as of 2018-08-08. switch (regionCode) { @@ -294,23 +370,21 @@ class Locale { return false; final Locale typedOther = other; return languageCode == typedOther.languageCode + && scriptCode == typedOther.scriptCode && countryCode == typedOther.countryCode; } @override - int get hashCode { - int result = 373; - result = 37 * result + languageCode.hashCode; - if (_countryCode != null) - result = 37 * result + countryCode.hashCode; - return result; - } + int get hashCode => hashValues(languageCode, scriptCode, countryCode); @override String toString() { - if (_countryCode == null) - return languageCode; - return '${languageCode}_$countryCode'; + final StringBuffer out = StringBuffer(languageCode); + if (scriptCode != null) + out.write('_$scriptCode'); + if (_countryCode != null) + out.write('_$countryCode'); + return out.toString(); } } @@ -426,19 +500,39 @@ class Window { _onMetricsChangedZone = Zone.current; } - /// The system-reported locale. + /// The system-reported default locale of the device. /// /// This establishes the language and formatting conventions that application /// should, if possible, use to render their user interface. /// + /// This is the first locale selected by the user and is the user's + /// primary locale (the locale the device UI is displayed in) + /// + /// This is equivalent to `locales.first` and will provide an empty non-null locale + /// if the [locales] list has not been set or is empty. + Locale get locale { + if (_locales != null && _locales.isNotEmpty) { + return _locales.first; + } + return null; + } + + /// The full system-reported supported locales of the device. + /// + /// This establishes the language and formatting conventions that application + /// should, if possible, use to render their user interface. + /// + /// The list is ordered in order of priority, with lower-indexed locales being + /// preferred over higher-indexed ones. The first element is the primary [locale]. + /// /// The [onLocaleChanged] callback is called whenever this value changes. /// /// See also: /// /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to /// observe when this value changes. - Locale get locale => _locale; - Locale _locale; + List get locales => _locales; + List _locales; /// A callback that is invoked whenever [locale] changes value. /// @@ -691,6 +785,16 @@ class Window { /// semantics update cannot be used further. void updateSemantics(SemanticsUpdate update) native 'Window_updateSemantics'; + /// Set the debug name associated with this window's root isolate. + /// + /// Normally debug names are automatically generated from the Dart port, entry + /// point, and source file. For example: `main.dart$main-1234`. + /// + /// This can be combined with flutter tools `--isolate-filter` flag to debug + /// specific root isolates. For example: `flutter attach --isolate-filter=[name]`. + /// Note that this does not rename any child isolates of the root. + void setIsolateDebugName(String name) native 'Window_setIsolateDebugName'; + /// Sends a message to a platform-specific plugin. /// /// The `name` parameter determines which plugin receives the message. The diff --git a/lib/ui/window/platform_message.cc b/lib/ui/window/platform_message.cc index ca9d92c74e827..6a8c754d2aa83 100644 --- a/lib/ui/window/platform_message.cc +++ b/lib/ui/window/platform_message.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/window/platform_message.h b/lib/ui/window/platform_message.h index 6044c94e7c43d..ef26d621600ea 100644 --- a/lib/ui/window/platform_message.h +++ b/lib/ui/window/platform_message.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/window/platform_message_response.cc b/lib/ui/window/platform_message_response.cc index 4b835efdbe2ad..31f02ca286384 100644 --- a/lib/ui/window/platform_message_response.cc +++ b/lib/ui/window/platform_message_response.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/window/platform_message_response.h b/lib/ui/window/platform_message_response.h index c31779c24bc08..decd17a46beea 100644 --- a/lib/ui/window/platform_message_response.h +++ b/lib/ui/window/platform_message_response.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/window/platform_message_response_dart.cc b/lib/ui/window/platform_message_response_dart.cc index e91bcfd4247e4..3a4084958b835 100644 --- a/lib/ui/window/platform_message_response_dart.cc +++ b/lib/ui/window/platform_message_response_dart.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/window/platform_message_response_dart.h b/lib/ui/window/platform_message_response_dart.h index 274b1e08d91b7..3ff0333937096 100644 --- a/lib/ui/window/platform_message_response_dart.h +++ b/lib/ui/window/platform_message_response_dart.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/window/pointer_data.cc b/lib/ui/window/pointer_data.cc index c85a1a50b8e72..e74e0b5ce94f0 100644 --- a/lib/ui/window/pointer_data.cc +++ b/lib/ui/window/pointer_data.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,7 +9,7 @@ namespace blink { // If this value changes, update the pointer data unpacking code in hooks.dart. -static constexpr int kPointerDataFieldCount = 19; +static constexpr int kPointerDataFieldCount = 21; static_assert(sizeof(PointerData) == sizeof(int64_t) * kPointerDataFieldCount, "PointerData has the wrong size"); diff --git a/lib/ui/window/pointer_data.h b/lib/ui/window/pointer_data.h index 6a23c3d689d2e..d9d01b560a1d2 100644 --- a/lib/ui/window/pointer_data.h +++ b/lib/ui/window/pointer_data.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -43,12 +43,14 @@ struct alignas(8) PointerData { double pressure_max; double distance; double distance_max; + double size; double radius_major; double radius_minor; double radius_min; double radius_max; double orientation; double tilt; + int64_t platformData; void Clear(); }; diff --git a/lib/ui/window/pointer_data_packet.cc b/lib/ui/window/pointer_data_packet.cc index b276f92fcef78..f560df1a2b7d6 100644 --- a/lib/ui/window/pointer_data_packet.cc +++ b/lib/ui/window/pointer_data_packet.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/window/pointer_data_packet.h b/lib/ui/window/pointer_data_packet.h index fafa03d7a7d86..c9f54dec7a677 100644 --- a/lib/ui/window/pointer_data_packet.h +++ b/lib/ui/window/pointer_data_packet.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/lib/ui/window/viewport_metrics.cc b/lib/ui/window/viewport_metrics.cc new file mode 100644 index 0000000000000..1047b3e4da1cf --- /dev/null +++ b/lib/ui/window/viewport_metrics.cc @@ -0,0 +1,35 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/lib/ui/window/viewport_metrics.h" + +namespace blink { +ViewportMetrics::ViewportMetrics() = default; + +ViewportMetrics::ViewportMetrics(double p_device_pixel_ratio, + double p_physical_width, + double p_physical_height, + double p_physical_padding_top, + double p_physical_padding_right, + double p_physical_padding_bottom, + double p_physical_padding_left, + double p_physical_view_inset_top, + double p_physical_view_inset_right, + double p_physical_view_inset_bottom, + double p_physical_view_inset_left) + : device_pixel_ratio(p_device_pixel_ratio), + physical_width(p_physical_width), + physical_height(p_physical_height), + physical_padding_top(p_physical_padding_top), + physical_padding_right(p_physical_padding_right), + physical_padding_bottom(p_physical_padding_bottom), + physical_padding_left(p_physical_padding_left), + physical_view_inset_top(p_physical_view_inset_top), + physical_view_inset_right(p_physical_view_inset_right), + physical_view_inset_bottom(p_physical_view_inset_bottom), + physical_view_inset_left(p_physical_view_inset_left) {} + +ViewportMetrics::ViewportMetrics(const ViewportMetrics& other) = default; + +} // namespace blink diff --git a/lib/ui/window/viewport_metrics.h b/lib/ui/window/viewport_metrics.h index 0ccb50ccc4374..c4daa9ebe7192 100644 --- a/lib/ui/window/viewport_metrics.h +++ b/lib/ui/window/viewport_metrics.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,6 +10,22 @@ namespace blink { struct ViewportMetrics { + ViewportMetrics(); + + ViewportMetrics(double p_device_pixel_ratio, + double p_physical_width, + double p_physical_height, + double p_physical_padding_top, + double p_physical_padding_right, + double p_physical_padding_bottom, + double p_physical_padding_left, + double p_physical_view_inset_top, + double p_physical_view_inset_right, + double p_physical_view_inset_bottom, + double p_physical_view_inset_left); + + ViewportMetrics(const ViewportMetrics& other); + double device_pixel_ratio = 1.0; double physical_width = 0; double physical_height = 0; diff --git a/lib/ui/window/window.cc b/lib/ui/window/window.cc index 783b025b7189a..528e2c084eb34 100644 --- a/lib/ui/window/window.cc +++ b/lib/ui/window/window.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -54,6 +54,17 @@ void UpdateSemantics(Dart_NativeArguments args) { UIDartState::Current()->window()->client()->UpdateSemantics(update); } +void SetIsolateDebugName(Dart_NativeArguments args) { + Dart_Handle exception = nullptr; + const std::string name = + tonic::DartConverter::FromArguments(args, 1, exception); + if (exception) { + Dart_ThrowException(exception); + return; + } + UIDartState::Current()->SetDebugName(name); +} + Dart_Handle SendPlatformMessage(Dart_Handle window, const std::string& name, Dart_Handle callback, @@ -162,17 +173,14 @@ void Window::UpdateWindowMetrics(const ViewportMetrics& metrics) { }); } -void Window::UpdateLocale(const std::string& language_code, - const std::string& country_code) { +void Window::UpdateLocales(const std::vector& locales) { std::shared_ptr dart_state = library_.dart_state().lock(); if (!dart_state) return; tonic::DartState::Scope scope(dart_state); - - DartInvokeField(library_.value(), "_updateLocale", + DartInvokeField(library_.value(), "_updateLocales", { - StdStringToDart(language_code), - StdStringToDart(country_code), + tonic::ToDart>(locales), }); } @@ -309,6 +317,7 @@ void Window::RegisterNatives(tonic::DartLibraryNatives* natives) { {"Window_respondToPlatformMessage", _RespondToPlatformMessage, 3, true}, {"Window_render", Render, 2, true}, {"Window_updateSemantics", UpdateSemantics, 2, true}, + {"Window_setIsolateDebugName", SetIsolateDebugName, 2, true}, }); } diff --git a/lib/ui/window/window.h b/lib/ui/window/window.h index 44f348d07fc3e..94a506fb5fa4d 100644 --- a/lib/ui/window/window.h +++ b/lib/ui/window/window.h @@ -1,11 +1,13 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FLUTTER_LIB_UI_WINDOW_WINDOW_H_ #define FLUTTER_LIB_UI_WINDOW_WINDOW_H_ +#include #include +#include #include "flutter/fml/time/time_point.h" #include "flutter/lib/ui/semantics/semantics_update.h" @@ -42,6 +44,8 @@ class WindowClient { virtual void UpdateSemantics(SemanticsUpdate* update) = 0; virtual void HandlePlatformMessage(fml::RefPtr message) = 0; virtual FontCollection& GetFontCollection() = 0; + virtual void UpdateIsolateDescription(const std::string isolate_name, + int64_t isolate_port) = 0; protected: virtual ~WindowClient(); @@ -59,8 +63,7 @@ class Window final { void DidCreateIsolate(); void UpdateWindowMetrics(const ViewportMetrics& metrics); - void UpdateLocale(const std::string& language_code, - const std::string& country_code); + void UpdateLocales(const std::vector& locales); void UpdateUserSettingsData(const std::string& data); void UpdateSemanticsEnabled(bool enabled); void UpdateAccessibilityFeatures(int32_t flags); diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index b5ff2efea43e8..5df979ed689a9 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -6,41 +6,6 @@ import("//third_party/dart/runtime/bin/vmservice/vmservice_sources.gni") import("$flutter_root/common/config.gni") import("$flutter_root/testing/testing.gni") -action("gen_embedded_resources_cc") { - script = "//third_party/dart/runtime/tools/create_resources.py" - output_file = "$target_gen_dir/embedded_resources.cc" - outputs = [ - output_file, - ] - - inputs = rebase_path(vmservice_sources, - "", - "//third_party/dart/runtime/bin/vmservice") - - args = [ - "--output", - rebase_path(output_file), - "--outer_namespace", - "flutter", - "--inner_namespace", - "runtime", - "--table_name", - "flutter_embedded_service_isolate", - "--root_prefix", - rebase_path("//third_party/dart/runtime/bin/"), - ] + rebase_path(inputs) -} - -source_set("embedded_resources_cc") { - sources = [ - "$target_gen_dir/embedded_resources.cc", - ] - deps = [ - ":gen_embedded_resources_cc", - ] - public_configs = [ "$flutter_root:config" ] -} - source_set("test_font") { sources = [ "test_font_data.cc", @@ -84,7 +49,6 @@ source_set("runtime") { ] deps = [ - ":embedded_resources_cc", ":test_font", "$flutter_root/assets", "$flutter_root/common", @@ -95,11 +59,14 @@ source_set("runtime") { "$flutter_root/third_party/txt", "//third_party/dart/runtime:dart_api", "//third_party/dart/runtime/bin:dart_io_api", - "//third_party/rapidjson", "//third_party/skia", "//third_party/tonic", ] + public_deps = [ + "//third_party/rapidjson", + ] + public_configs = [ "$flutter_root:config" ] if (flutter_runtime_mode != "release" && @@ -119,6 +86,7 @@ executable("runtime_unittests") { sources = [ "dart_isolate_unittests.cc", + "dart_service_isolate_unittests.cc", "dart_vm_unittests.cc", ] diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 7aa7939301363..094746b26d0ed 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -26,10 +26,6 @@ #include "third_party/tonic/scopes/dart_api_scope.h" #include "third_party/tonic/scopes/dart_isolate_scope.h" -#ifdef ERROR -#undef ERROR -#endif - namespace blink { std::weak_ptr DartIsolate::CreateRootIsolate( @@ -38,6 +34,7 @@ std::weak_ptr DartIsolate::CreateRootIsolate( fml::RefPtr shared_snapshot, TaskRunners task_runners, std::unique_ptr window, + fml::WeakPtr snapshot_delegate, fml::WeakPtr resource_context, fml::RefPtr unref_queue, std::string advisory_script_uri, @@ -54,14 +51,15 @@ std::weak_ptr DartIsolate::CreateRootIsolate( // isolate lifecycle is entirely managed by the VM). auto root_embedder_data = std::make_unique>( std::make_shared( - vm, // VM - std::move(isolate_snapshot), // isolate snapshot - std::move(shared_snapshot), // shared snapshot - task_runners, // task runners - std::move(resource_context), // resource context - std::move(unref_queue), // skia unref queue - advisory_script_uri, // advisory URI - advisory_script_entrypoint, // advisory entrypoint + vm, // VM + std::move(isolate_snapshot), // isolate snapshot + std::move(shared_snapshot), // shared snapshot + task_runners, // task runners + std::move(snapshot_delegate), // snapshot delegate + std::move(resource_context), // resource context + std::move(unref_queue), // skia unref queue + advisory_script_uri, // advisory URI + advisory_script_entrypoint, // advisory entrypoint nullptr // child isolate preparer will be set when this isolate is // prepared to run )); @@ -101,6 +99,7 @@ DartIsolate::DartIsolate(DartVM* vm, fml::RefPtr isolate_snapshot, fml::RefPtr shared_snapshot, TaskRunners task_runners, + fml::WeakPtr snapshot_delegate, fml::WeakPtr resource_context, fml::RefPtr unref_queue, std::string advisory_script_uri, @@ -109,6 +108,7 @@ DartIsolate::DartIsolate(DartVM* vm, : UIDartState(std::move(task_runners), vm->GetSettings().task_observer_add, vm->GetSettings().task_observer_remove, + std::move(snapshot_delegate), std::move(resource_context), std::move(unref_queue), advisory_script_uri, @@ -152,7 +152,7 @@ bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) { return false; } - auto isolate_data = static_cast*>( + auto* isolate_data = static_cast*>( Dart_IsolateData(dart_isolate)); if (isolate_data->get() != this) { return false; @@ -243,7 +243,7 @@ bool DartIsolate::LoadLibraries(bool is_root_isolate) { DartIO::InitForIsolate(); - DartUI::InitForIsolate(); + DartUI::InitForIsolate(is_root_isolate); const bool is_service_isolate = Dart_IsServiceIsolate(isolate()); @@ -348,9 +348,22 @@ bool DartIsolate::PrepareForRunningFromKernel( return false; } - child_isolate_preparer_ = [mapping](DartIsolate* isolate) { - return isolate->PrepareForRunningFromKernel(mapping); - }; + // Child isolate shares root isolate embedder_isolate (lines 691 and 693 + // below). Re-initializing child_isolate_preparer_ lambda while it is being + // executed leads to crashes. + if (child_isolate_preparer_ == nullptr) { + child_isolate_preparer_ = [buffers = + kernel_buffers_](DartIsolate* isolate) { + for (unsigned long i = 0; i < buffers.size(); i++) { + bool last_piece = i + 1 == buffers.size(); + const std::shared_ptr& buffer = buffers.at(i); + if (!isolate->PrepareForRunningFromKernel(buffer, last_piece)) { + return false; + } + } + return true; + }; + } phase_ = Phase::Ready; return true; } @@ -477,6 +490,7 @@ bool DartIsolate::Shutdown() { // the isolate to shutdown as a parameter. FML_DCHECK(Dart_CurrentIsolate() == nullptr); Dart_EnterIsolate(vm_isolate); + shutdown_callbacks_.clear(); Dart_ShutdownIsolate(); FML_DCHECK(Dart_CurrentIsolate() == nullptr); } @@ -519,6 +533,7 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( vm->GetSharedSnapshot(), // shared snapshot null_task_runners, // task runners nullptr, // window + {}, // snapshot delegate {}, // resource context {}, // unref queue advisory_script_uri == nullptr ? "" @@ -618,7 +633,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( DartVM* const vm = (*embedder_isolate)->GetDartVM(); if (!is_root_isolate) { - auto raw_embedder_isolate = embedder_isolate.release(); + auto* raw_embedder_isolate = embedder_isolate.release(); blink::TaskRunners null_task_runners(advisory_script_uri, nullptr, nullptr, nullptr, nullptr); @@ -629,6 +644,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( (*raw_embedder_isolate)->GetIsolateSnapshot(), // isolate_snapshot (*raw_embedder_isolate)->GetSharedSnapshot(), // shared_snapshot null_task_runners, // task_runners + fml::WeakPtr{}, // snapshot_delegate fml::WeakPtr{}, // resource_context nullptr, // unref_queue advisory_script_uri, // advisory_script_uri @@ -727,4 +743,13 @@ void DartIsolate::AddIsolateShutdownCallback(fml::closure closure) { std::make_unique(std::move(closure))); } +DartIsolate::AutoFireClosure::AutoFireClosure(fml::closure closure) + : closure_(std::move(closure)) {} + +DartIsolate::AutoFireClosure::~AutoFireClosure() { + if (closure_) { + closure_(); + } +} + } // namespace blink diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index f2167364effdd..d79cc6c6b6803 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,6 +12,7 @@ #include "flutter/fml/compiler_specific.h" #include "flutter/fml/macros.h" #include "flutter/fml/mapping.h" +#include "flutter/lib/ui/snapshot_delegate.h" #include "flutter/lib/ui/ui_dart_state.h" #include "flutter/lib/ui/window/window.h" #include "flutter/runtime/dart_snapshot.h" @@ -44,6 +45,7 @@ class DartIsolate : public UIDartState { fml::RefPtr shared_snapshot, TaskRunners task_runners, std::unique_ptr window, + fml::WeakPtr snapshot_delegate, fml::WeakPtr resource_context, fml::RefPtr unref_queue, std::string advisory_script_uri, @@ -54,6 +56,7 @@ class DartIsolate : public UIDartState { fml::RefPtr isolate_snapshot, fml::RefPtr shared_snapshot, TaskRunners task_runners, + fml::WeakPtr snapshot_delegate, fml::WeakPtr resource_context, fml::RefPtr unref_queue, std::string advisory_script_uri, @@ -95,12 +98,9 @@ class DartIsolate : public UIDartState { class AutoFireClosure { public: - AutoFireClosure(fml::closure closure) : closure_(std::move(closure)) {} - ~AutoFireClosure() { - if (closure_) { - closure_(); - } - } + AutoFireClosure(fml::closure closure); + + ~AutoFireClosure(); private: fml::closure closure_; @@ -114,7 +114,7 @@ class DartIsolate : public UIDartState { const fml::RefPtr shared_snapshot_; std::vector> kernel_buffers_; std::vector> shutdown_callbacks_; - ChildIsolatePreparer child_isolate_preparer_; + ChildIsolatePreparer child_isolate_preparer_ = nullptr; FML_WARN_UNUSED_RESULT bool Initialize(Dart_Isolate isolate, bool is_root_isolate); diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc index cb7797abdcb74..d99e1bfcdbdbb 100644 --- a/runtime/dart_isolate_unittests.cc +++ b/runtime/dart_isolate_unittests.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -35,6 +35,7 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) { vm->GetSharedSnapshot(), // shared snapshot std::move(task_runners), // task runners nullptr, // window + {}, // snapshot delegate {}, // resource context nullptr, // unref qeueue "main.dart", // advisory uri @@ -46,4 +47,40 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) { ASSERT_TRUE(root_isolate->Shutdown()); } +TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) { + Settings settings = {}; + settings.task_observer_add = [](intptr_t, fml::closure) {}; + settings.task_observer_remove = [](intptr_t) {}; + auto vm = DartVM::ForProcess(settings); + ASSERT_TRUE(vm); + TaskRunners task_runners(CURRENT_TEST_NAME, // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner() // + ); + auto weak_isolate = DartIsolate::CreateRootIsolate( + vm.get(), // vm + vm->GetIsolateSnapshot(), // isolate snapshot + vm->GetSharedSnapshot(), // shared snapshot + std::move(task_runners), // task runners + nullptr, // window + {}, // snapshot delegate + {}, // resource context + nullptr, // unref qeueue + "main.dart", // advisory uri + "main" // advisory entrypoint + ); + auto root_isolate = weak_isolate.lock(); + ASSERT_TRUE(root_isolate); + ASSERT_EQ(root_isolate->GetPhase(), DartIsolate::Phase::LibrariesSetup); + size_t destruction_callback_count = 0; + root_isolate->AddIsolateShutdownCallback([&destruction_callback_count]() { + ASSERT_NE(Dart_CurrentIsolate(), nullptr); + destruction_callback_count++; + }); + ASSERT_TRUE(root_isolate->Shutdown()); + ASSERT_EQ(destruction_callback_count, 1u); +} + } // namespace blink diff --git a/runtime/dart_service_isolate.cc b/runtime/dart_service_isolate.cc index 05da4c48fc2dd..2bedd79f81716 100644 --- a/runtime/dart_service_isolate.cc +++ b/runtime/dart_service_isolate.cc @@ -1,10 +1,11 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "flutter/runtime/dart_service_isolate.h" #include +#include #include "flutter/fml/logging.h" #include "flutter/runtime/embedder_resources.h" @@ -47,12 +48,36 @@ const uint8_t* GetSymbol(Dart_NativeFunction native_function) { } // namespace +std::mutex DartServiceIsolate::callbacks_mutex_; + +FML_GUARDED_BY(DartServiceIsolate::callbacks_mutex_) +std::set> + DartServiceIsolate::callbacks_; + void DartServiceIsolate::NotifyServerState(Dart_NativeArguments args) { Dart_Handle exception = nullptr; std::string uri = tonic::DartConverter::FromArguments(args, 0, exception); - if (!exception) { - observatory_uri_ = uri; + + if (exception) { + return; + } + + observatory_uri_ = uri; + + // Collect callbacks to fire in a separate collection and invoke them outside + // the lock. + std::vector + callbacks_to_fire; + { + std::lock_guard lock(callbacks_mutex_); + for (auto& callback : callbacks_) { + callbacks_to_fire.push_back(*callback.get()); + } + } + + for (auto callback_to_fire : callbacks_to_fire) { + callback_to_fire(uri); } } @@ -60,6 +85,47 @@ std::string DartServiceIsolate::GetObservatoryUri() { return observatory_uri_; } +DartServiceIsolate::CallbackHandle DartServiceIsolate::AddServerStatusCallback( + DartServiceIsolate::ObservatoryServerStateCallback callback) { + if (!callback) { + return 0; + } + + auto callback_pointer = + std::make_unique( + callback); + + auto handle = reinterpret_cast(callback_pointer.get()); + + { + std::lock_guard lock(callbacks_mutex_); + callbacks_.insert(std::move(callback_pointer)); + } + + if (!observatory_uri_.empty()) { + callback(observatory_uri_); + } + + return handle; +} + +bool DartServiceIsolate::RemoveServerStatusCallback( + CallbackHandle callback_handle) { + std::lock_guard lock(callbacks_mutex_); + auto found = std::find_if( + callbacks_.begin(), callbacks_.end(), + [callback_handle](const auto& item) { + return reinterpret_cast(item.get()) == callback_handle; + }); + + if (found == callbacks_.end()) { + return false; + } + + callbacks_.erase(found); + return true; +} + void DartServiceIsolate::Shutdown(Dart_NativeArguments args) { // NO-OP. } diff --git a/runtime/dart_service_isolate.h b/runtime/dart_service_isolate.h index 3d672dc83bb4c..cf4137a1e6b49 100644 --- a/runtime/dart_service_isolate.h +++ b/runtime/dart_service_isolate.h @@ -1,18 +1,27 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FLUTTER_RUNTIME_DART_SERVICE_ISOLATE_H_ #define FLUTTER_RUNTIME_DART_SERVICE_ISOLATE_H_ +#include +#include +#include #include +#include "flutter/fml/compiler_specific.h" +#include "flutter/fml/synchronization/thread_annotations.h" + #include "third_party/dart/runtime/include/dart_api.h" namespace blink { class DartServiceIsolate { public: + using ObservatoryServerStateCallback = + std::function; + static bool Startup(std::string server_ip, intptr_t server_port, Dart_LibraryTagHandler embedder_tag_handler, @@ -21,10 +30,25 @@ class DartServiceIsolate { static std::string GetObservatoryUri(); + using CallbackHandle = ptrdiff_t; + + // Returns a handle for the callback that can be used in + // RemoveServerStatusCallback + FML_WARN_UNUSED_RESULT + static CallbackHandle AddServerStatusCallback( + ObservatoryServerStateCallback callback); + + // Accepts the handle returned by AddServerStatusCallback + static bool RemoveServerStatusCallback(CallbackHandle handle); + private: // Native entries. static void NotifyServerState(Dart_NativeArguments args); static void Shutdown(Dart_NativeArguments args); + + static std::mutex callbacks_mutex_; + static std::set> callbacks_ + FML_GUARDED_BY(callbacks_mutex_); }; } // namespace blink diff --git a/runtime/dart_service_isolate_unittests.cc b/runtime/dart_service_isolate_unittests.cc new file mode 100644 index 0000000000000..b0e2baf0b62af --- /dev/null +++ b/runtime/dart_service_isolate_unittests.cc @@ -0,0 +1,17 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/runtime/dart_service_isolate.h" +#include "flutter/testing/testing.h" + +namespace blink { + +TEST(DartServiceIsolateTest, CanAddAndRemoveHandles) { + ASSERT_EQ(DartServiceIsolate::AddServerStatusCallback(nullptr), 0); + auto handle = DartServiceIsolate::AddServerStatusCallback([](const auto&) {}); + ASSERT_NE(handle, 0); + ASSERT_TRUE(DartServiceIsolate::RemoveServerStatusCallback(handle)); +} + +} // namespace blink diff --git a/runtime/dart_snapshot.cc b/runtime/dart_snapshot.cc index 19d0821d92ae2..5c5fb1232bf11 100644 --- a/runtime/dart_snapshot.cc +++ b/runtime/dart_snapshot.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/runtime/dart_snapshot.h b/runtime/dart_snapshot.h index c8aa17c3140ab..19d2968833f90 100644 --- a/runtime/dart_snapshot.h +++ b/runtime/dart_snapshot.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/runtime/dart_snapshot_buffer.cc b/runtime/dart_snapshot_buffer.cc index 342613f185c96..71b0f7113a7c9 100644 --- a/runtime/dart_snapshot_buffer.cc +++ b/runtime/dart_snapshot_buffer.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/runtime/dart_snapshot_buffer.h b/runtime/dart_snapshot_buffer.h index 75fff29d7eaea..6a752c28a884f 100644 --- a/runtime/dart_snapshot_buffer.h +++ b/runtime/dart_snapshot_buffer.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index e9300654af610..4c3f67c9f6ff6 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -33,10 +33,6 @@ #include "third_party/tonic/scopes/dart_api_scope.h" #include "third_party/tonic/typed_data/uint8_list.h" -#ifdef ERROR -#undef ERROR -#endif - namespace dart { namespace observatory { @@ -64,11 +60,7 @@ static const char* kDartLanguageArgs[] = { // clang-format off "--enable_mirrors=false", "--background_compilation", - "--await_is_keyword", "--causal_async_stacks", - "--strong", - "--reify_generic_functions", - "--sync_async", // clang-format on }; @@ -321,7 +313,7 @@ DartVM::DartVM(const Settings& settings, // it does not recognize, it exits immediately. args.push_back("--ignore-unrecognized-flags"); - for (const auto& profiler_flag : + for (auto* const profiler_flag : ProfilingFlags(settings.enable_dart_profiling)) { args.push_back(profiler_flag); } @@ -355,10 +347,6 @@ DartVM::DartVM(const Settings& settings, arraysize(kDartWriteProtectCodeArgs)); #endif - const bool is_preview_dart2 = - Dart_IsDart2Snapshot(isolate_snapshot_->GetData()->GetSnapshotPointer()); - FML_CHECK(is_preview_dart2) << "Not Dart 2!"; - if (use_checked_mode) { PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); } diff --git a/runtime/dart_vm.h b/runtime/dart_vm.h index b853f026c328f..9a1bde888dd86 100644 --- a/runtime/dart_vm.h +++ b/runtime/dart_vm.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/runtime/dart_vm_unittests.cc b/runtime/dart_vm_unittests.cc index 94d5dadaaec1f..21e3d3d3fa58f 100644 --- a/runtime/dart_vm_unittests.cc +++ b/runtime/dart_vm_unittests.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/runtime/embedder_resources.cc b/runtime/embedder_resources.cc index 102bdae7b3a00..2eb73880d3d08 100644 --- a/runtime/embedder_resources.cc +++ b/runtime/embedder_resources.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/runtime/embedder_resources.h b/runtime/embedder_resources.h index eb3a0b833fdbf..1ae866a54a75f 100644 --- a/runtime/embedder_resources.h +++ b/runtime/embedder_resources.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/runtime/fixtures/simple_main.dart b/runtime/fixtures/simple_main.dart index 552dfbe344902..dc744d2777e3b 100644 --- a/runtime/fixtures/simple_main.dart +++ b/runtime/fixtures/simple_main.dart @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc index d3509ed080b40..ac99aa5f99ac5 100644 --- a/runtime/runtime_controller.cc +++ b/runtime/runtime_controller.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,10 +12,6 @@ #include "flutter/runtime/runtime_delegate.h" #include "third_party/tonic/dart_message_handler.h" -#ifdef ERROR -#undef ERROR -#endif - namespace blink { RuntimeController::RuntimeController( @@ -24,6 +20,7 @@ RuntimeController::RuntimeController( fml::RefPtr p_isolate_snapshot, fml::RefPtr p_shared_snapshot, TaskRunners p_task_runners, + fml::WeakPtr p_snapshot_delegate, fml::WeakPtr p_resource_context, fml::RefPtr p_unref_queue, std::string p_advisory_script_uri, @@ -33,6 +30,7 @@ RuntimeController::RuntimeController( std::move(p_isolate_snapshot), std::move(p_shared_snapshot), std::move(p_task_runners), + std::move(p_snapshot_delegate), std::move(p_resource_context), std::move(p_unref_queue), std::move(p_advisory_script_uri), @@ -45,6 +43,7 @@ RuntimeController::RuntimeController( fml::RefPtr p_isolate_snapshot, fml::RefPtr p_shared_snapshot, TaskRunners p_task_runners, + fml::WeakPtr p_snapshot_delegate, fml::WeakPtr p_resource_context, fml::RefPtr p_unref_queue, std::string p_advisory_script_uri, @@ -55,6 +54,7 @@ RuntimeController::RuntimeController( isolate_snapshot_(std::move(p_isolate_snapshot)), shared_snapshot_(std::move(p_shared_snapshot)), task_runners_(p_task_runners), + snapshot_delegate_(p_snapshot_delegate), resource_context_(p_resource_context), unref_queue_(p_unref_queue), advisory_script_uri_(p_advisory_script_uri), @@ -66,6 +66,7 @@ RuntimeController::RuntimeController( shared_snapshot_, task_runners_, std::make_unique(this), + snapshot_delegate_, resource_context_, unref_queue_, p_advisory_script_uri, @@ -74,7 +75,7 @@ RuntimeController::RuntimeController( root_isolate->SetReturnCodeCallback([this](uint32_t code) { root_isolate_return_code_ = {true, code}; }); - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { tonic::DartState::Scope scope(root_isolate); window->DidCreateIsolate(); if (!FlushRuntimeStateToIsolate()) { @@ -114,6 +115,7 @@ std::unique_ptr RuntimeController::Clone() const { isolate_snapshot_, // shared_snapshot_, // task_runners_, // + snapshot_delegate_, // resource_context_, // unref_queue_, // advisory_script_uri_, // @@ -124,38 +126,37 @@ std::unique_ptr RuntimeController::Clone() const { bool RuntimeController::FlushRuntimeStateToIsolate() { return SetViewportMetrics(window_data_.viewport_metrics) && - SetLocale(window_data_.language_code, window_data_.country_code) && + SetLocales(window_data_.locale_data) && SetSemanticsEnabled(window_data_.semantics_enabled) && - SetAccessibilityFeatures(window_data_.accessibility_feature_flags_); + SetAccessibilityFeatures(window_data_.accessibility_feature_flags_) && + SetUserSettingsData(window_data_.user_settings_data); } bool RuntimeController::SetViewportMetrics(const ViewportMetrics& metrics) { window_data_.viewport_metrics = metrics; - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { window->UpdateWindowMetrics(metrics); return true; } return false; } -bool RuntimeController::SetLocale(const std::string& language_code, - const std::string& country_code) { - window_data_.language_code = language_code; - window_data_.country_code = country_code; +bool RuntimeController::SetLocales( + const std::vector& locale_data) { + window_data_.locale_data = locale_data; - if (auto window = GetWindowIfAvailable()) { - window->UpdateLocale(window_data_.language_code, window_data_.country_code); + if (auto* window = GetWindowIfAvailable()) { + window->UpdateLocales(locale_data); return true; } - - return false; + return true; } bool RuntimeController::SetUserSettingsData(const std::string& data) { window_data_.user_settings_data = data; - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { window->UpdateUserSettingsData(window_data_.user_settings_data); return true; } @@ -166,7 +167,7 @@ bool RuntimeController::SetUserSettingsData(const std::string& data) { bool RuntimeController::SetSemanticsEnabled(bool enabled) { window_data_.semantics_enabled = enabled; - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { window->UpdateSemanticsEnabled(window_data_.semantics_enabled); return true; } @@ -176,7 +177,7 @@ bool RuntimeController::SetSemanticsEnabled(bool enabled) { bool RuntimeController::SetAccessibilityFeatures(int32_t flags) { window_data_.accessibility_feature_flags_ = flags; - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { window->UpdateAccessibilityFeatures( window_data_.accessibility_feature_flags_); return true; @@ -186,7 +187,7 @@ bool RuntimeController::SetAccessibilityFeatures(int32_t flags) { } bool RuntimeController::BeginFrame(fml::TimePoint frame_time) { - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { window->BeginFrame(frame_time); return true; } @@ -206,7 +207,7 @@ bool RuntimeController::NotifyIdle(int64_t deadline) { bool RuntimeController::DispatchPlatformMessage( fml::RefPtr message) { - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { TRACE_EVENT1("flutter", "RuntimeController::DispatchPlatformMessage", "mode", "basic"); window->DispatchPlatformMessage(std::move(message)); @@ -217,7 +218,7 @@ bool RuntimeController::DispatchPlatformMessage( bool RuntimeController::DispatchPointerDataPacket( const PointerDataPacket& packet) { - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { TRACE_EVENT1("flutter", "RuntimeController::DispatchPointerDataPacket", "mode", "basic"); window->DispatchPointerDataPacket(packet); @@ -231,7 +232,7 @@ bool RuntimeController::DispatchSemanticsAction(int32_t id, std::vector args) { TRACE_EVENT1("flutter", "RuntimeController::DispatchSemanticsAction", "mode", "basic"); - if (auto window = GetWindowIfAvailable()) { + if (auto* window = GetWindowIfAvailable()) { window->DispatchSemanticsAction(id, action, std::move(args)); return true; } @@ -270,6 +271,11 @@ FontCollection& RuntimeController::GetFontCollection() { return client_.GetFontCollection(); } +void RuntimeController::UpdateIsolateDescription(const std::string isolate_name, + int64_t isolate_port) { + client_.UpdateIsolateDescription(isolate_name, isolate_port); +} + Dart_Port RuntimeController::GetMainPort() { std::shared_ptr root_isolate = root_isolate_.lock(); return root_isolate ? root_isolate->main_port() : ILLEGAL_PORT; @@ -302,4 +308,21 @@ std::pair RuntimeController::GetRootIsolateReturnCode() { return root_isolate_return_code_; } +RuntimeController::Locale::Locale(std::string language_code_, + std::string country_code_, + std::string script_code_, + std::string variant_code_) + : language_code(language_code_), + country_code(country_code_), + script_code(script_code_), + variant_code(variant_code_) {} + +RuntimeController::Locale::~Locale() = default; + +RuntimeController::WindowData::WindowData() = default; + +RuntimeController::WindowData::WindowData(const WindowData& other) = default; + +RuntimeController::WindowData::~WindowData() = default; + } // namespace blink diff --git a/runtime/runtime_controller.h b/runtime/runtime_controller.h index c2a909f6edceb..34f3236c3c778 100644 --- a/runtime/runtime_controller.h +++ b/runtime/runtime_controller.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,7 @@ #define FLUTTER_RUNTIME_RUNTIME_CONTROLLER_H_ #include +#include #include "flutter/common/task_runners.h" #include "flutter/flow/layers/layer_tree.h" @@ -15,6 +16,8 @@ #include "flutter/lib/ui/window/pointer_data_packet.h" #include "flutter/lib/ui/window/window.h" #include "flutter/runtime/dart_vm.h" +#include "rapidjson/document.h" +#include "rapidjson/stringbuffer.h" namespace blink { class Scene; @@ -29,19 +32,19 @@ class RuntimeController final : public WindowClient { fml::RefPtr isolate_snapshot, fml::RefPtr shared_snapshot, TaskRunners task_runners, + fml::WeakPtr snapshot_delegate, fml::WeakPtr resource_context, fml::RefPtr unref_queue, std::string advisory_script_uri, std::string advisory_script_entrypoint); - ~RuntimeController(); + ~RuntimeController() override; std::unique_ptr Clone() const; bool SetViewportMetrics(const ViewportMetrics& metrics); - bool SetLocale(const std::string& language_code, - const std::string& country_code); + bool SetLocales(const std::vector& locale_data); bool SetUserSettingsData(const std::string& data); @@ -76,10 +79,33 @@ class RuntimeController final : public WindowClient { std::pair GetRootIsolateReturnCode(); private: + struct Locale { + Locale(std::string language_code_, + std::string country_code_, + std::string script_code_, + std::string variant_code_); + + ~Locale(); + + std::string language_code; + std::string country_code; + std::string script_code; + std::string variant_code; + }; + struct WindowData { + WindowData(); + + WindowData(const WindowData& other); + + ~WindowData(); + ViewportMetrics viewport_metrics; std::string language_code; std::string country_code; + std::string script_code; + std::string variant_code; + std::vector locale_data; std::string user_settings_data = "{}"; bool semantics_enabled = false; bool assistive_technology_enabled = false; @@ -91,6 +117,7 @@ class RuntimeController final : public WindowClient { fml::RefPtr isolate_snapshot_; fml::RefPtr shared_snapshot_; TaskRunners task_runners_; + fml::WeakPtr snapshot_delegate_; fml::WeakPtr resource_context_; fml::RefPtr unref_queue_; std::string advisory_script_uri_; @@ -104,6 +131,7 @@ class RuntimeController final : public WindowClient { fml::RefPtr isolate_snapshot, fml::RefPtr shared_snapshot, TaskRunners task_runners, + fml::WeakPtr snapshot_delegate, fml::WeakPtr resource_context, fml::RefPtr unref_queue, std::string advisory_script_uri, @@ -132,6 +160,10 @@ class RuntimeController final : public WindowClient { // |blink::WindowClient| FontCollection& GetFontCollection() override; + // |blink::WindowClient| + void UpdateIsolateDescription(const std::string isolate_name, + int64_t isolate_port) override; + FML_DISALLOW_COPY_AND_ASSIGN(RuntimeController); }; diff --git a/runtime/runtime_delegate.cc b/runtime/runtime_delegate.cc index 902672be06d8f..65e86bbde539e 100644 --- a/runtime/runtime_delegate.cc +++ b/runtime/runtime_delegate.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/runtime/runtime_delegate.h b/runtime/runtime_delegate.h index 2a9bded0a24f0..7d79dac199838 100644 --- a/runtime/runtime_delegate.h +++ b/runtime/runtime_delegate.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -33,6 +33,9 @@ class RuntimeDelegate { virtual FontCollection& GetFontCollection() = 0; + virtual void UpdateIsolateDescription(const std::string isolate_name, + int64_t isolate_port) = 0; + protected: virtual ~RuntimeDelegate(); }; diff --git a/runtime/service_protocol.cc b/runtime/service_protocol.cc index 207e683a90ebc..ea93a120facc7 100644 --- a/runtime/service_protocol.cc +++ b/runtime/service_protocol.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -45,22 +45,32 @@ ServiceProtocol::ServiceProtocol() kRunInViewExtensionName, kFlushUIThreadTasksExtensionName, kSetAssetBundlePathExtensionName, - }) {} + }), + handlers_mutex_(fml::SharedMutex::Create()) {} ServiceProtocol::~ServiceProtocol() { ToggleHooks(false); } -void ServiceProtocol::AddHandler(Handler* handler) { - std::lock_guard lock(handlers_mutex_); - handlers_.emplace(handler); +void ServiceProtocol::AddHandler(Handler* handler, + Handler::Description description) { + fml::UniqueLock lock(*handlers_mutex_); + handlers_.emplace(handler, description); } void ServiceProtocol::RemoveHandler(Handler* handler) { - std::lock_guard lock(handlers_mutex_); + fml::UniqueLock lock(*handlers_mutex_); handlers_.erase(handler); } +void ServiceProtocol::SetHandlerDescription(Handler* handler, + Handler::Description description) { + fml::SharedLock lock(*handlers_mutex_); + auto it = handlers_.find(handler); + if (it != handlers_.end()) + it->second.Store(description); +} + void ServiceProtocol::ToggleHooks(bool set) { for (const auto& endpoint : endpoints_) { Dart_RegisterIsolateServiceRequestCallback( @@ -166,7 +176,7 @@ bool ServiceProtocol::HandleMessage(fml::StringView method, return HandleListViewsMethod(response); } - std::lock_guard lock(handlers_mutex_); + fml::SharedLock lock(*handlers_mutex_); if (handlers_.size() == 0) { WriteServerErrorResponse(response, @@ -177,7 +187,7 @@ bool ServiceProtocol::HandleMessage(fml::StringView method, // Find the handler by its "viewId" in the params. auto view_id_param_found = params.find(fml::StringView{"viewId"}); if (view_id_param_found != params.end()) { - auto handler = reinterpret_cast(std::stoull( + auto* handler = reinterpret_cast(std::stoull( view_id_param_found->second.data() + kViewIdPrefx.size(), nullptr, 16)); auto handler_found = handlers_.find(handler); if (handler_found != handlers_.end()) { @@ -191,7 +201,8 @@ bool ServiceProtocol::HandleMessage(fml::StringView method, if (method == kScreenshotExtensionName || method == kScreenshotSkpExtensionName || method == kFlushUIThreadTasksExtensionName) { - return HandleMessageOnHandler(*handlers_.begin(), method, params, response); + return HandleMessageOnHandler(handlers_.begin()->first, method, params, + response); } WriteServerErrorResponse( @@ -236,26 +247,11 @@ void ServiceProtocol::Handler::Description::Write( bool ServiceProtocol::HandleListViewsMethod( rapidjson::Document& response) const { - // Collect handler descriptions on their respective task runners. - std::lock_guard lock(handlers_mutex_); + fml::SharedLock lock(*handlers_mutex_); std::vector> descriptions; for (const auto& handler : handlers_) { - fml::AutoResetWaitableEvent latch; - Handler::Description description; - - fml::TaskRunner::RunNowOrPostTask( - handler->GetServiceProtocolHandlerTaskRunner( - kListViewsExtensionName), // task runner - [&latch, // - &description, // - &handler // - ]() { - description = handler->GetServiceProtocolDescription(); - latch.Signal(); - }); - latch.Wait(); - descriptions.emplace_back(std::make_pair( - reinterpret_cast(handler), std::move(description))); + descriptions.emplace_back(reinterpret_cast(handler.first), + handler.second.Load()); } auto& allocator = response.GetAllocator(); diff --git a/runtime/service_protocol.h b/runtime/service_protocol.h index 9b255d12c3bab..1ab1f9183d208 100644 --- a/runtime/service_protocol.h +++ b/runtime/service_protocol.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,16 +6,17 @@ #define FLUTTER_RUNTIME_SERVICE_PROTOCOL_H_ #include -#include #include #include #include "flutter/fml/compiler_specific.h" #include "flutter/fml/macros.h" #include "flutter/fml/string_view.h" +#include "flutter/fml/synchronization/atomic_object.h" +#include "flutter/fml/synchronization/shared_mutex.h" #include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/task_runner.h" -#include "third_party/rapidjson/rapidjson/document.h" +#include "rapidjson/document.h" namespace blink { @@ -63,14 +64,17 @@ class ServiceProtocol { void ToggleHooks(bool set); - void AddHandler(Handler* handler); + void AddHandler(Handler* handler, Handler::Description description); void RemoveHandler(Handler* handler); + void SetHandlerDescription(Handler* handler, + Handler::Description description); + private: const std::set endpoints_; - mutable std::mutex handlers_mutex_; - std::set handlers_; + std::unique_ptr handlers_mutex_; + std::map> handlers_; FML_WARN_UNUSED_RESULT static bool HandleMessage(const char* method, diff --git a/runtime/start_up.cc b/runtime/start_up.cc index 22a4b966d34e2..a58a24afb03fa 100644 --- a/runtime/start_up.cc +++ b/runtime/start_up.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/runtime/start_up.h b/runtime/start_up.h index 49e0726239a65..603069e16a255 100644 --- a/runtime/start_up.h +++ b/runtime/start_up.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/runtime/test_font_data.cc b/runtime/test_font_data.cc index 5a7d41acc781f..66d99e483d01d 100644 --- a/runtime/test_font_data.cc +++ b/runtime/test_font_data.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/runtime/test_font_data.h b/runtime/test_font_data.h index 0cdc9a87ddec0..2f4c7bff12a5c 100644 --- a/runtime/test_font_data.h +++ b/runtime/test_font_data.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/BUILD.gn b/shell/BUILD.gn index 0672fae2edb95..e4bfd9e8fda5d 100644 --- a/shell/BUILD.gn +++ b/shell/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/shell/common/BUILD.gn b/shell/common/BUILD.gn index 628cd30c5f39a..c17dd8b60bd39 100644 --- a/shell/common/BUILD.gn +++ b/shell/common/BUILD.gn @@ -1,8 +1,9 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("$flutter_root/testing/testing.gni") +import("$flutter_root/shell/gpu/gpu.gni") # Template to generate a dart embedder resource.cc file. # Required invoker inputs: @@ -100,36 +101,68 @@ source_set("common") { "$flutter_root/runtime", "$flutter_root/synchronization", "//third_party/dart/runtime:dart_api", - "//third_party/rapidjson", "//third_party/skia", - "//third_party/skia:gpu", ] public_deps = [ "$flutter_root/shell/version", "$flutter_root/third_party/txt", + "//third_party/rapidjson", "//third_party/tonic", ] public_configs = [ "$flutter_root:config" ] } -executable("shell_unittests") { - testonly = true +template("shell_host_executable") { + executable(target_name) { + testonly = true + + deps = [] + + ldflags = [] + + forward_variables_from(invoker, "*") + + deps += [ + ":common", + "$flutter_root/fml", + "$flutter_root/lib/snapshot", + "//third_party/dart/runtime:libdart_jit", + "//third_party/skia", + "//third_party/tonic", + ] + + if (is_linux) { + ldflags += [ "-rdynamic" ] + } + } +} + +shell_gpu_configuration("shell_unittests_gpu_configuration") { + enable_software = true + enable_vulkan = false + enable_gl = false +} +shell_host_executable("shell_unittests") { sources = [ "shell_unittests.cc", ] + deps = [ - ":common", - "$flutter_root/fml", - "$flutter_root/lib/snapshot", + ":shell_unittests_gpu_configuration", + "$flutter_root/shell/", "$flutter_root/testing", - "//third_party/dart/runtime:libdart_jit", - "//third_party/skia", - "//third_party/tonic", ] - if (is_linux) { - ldflags = [ "-rdynamic" ] - } +} + +shell_host_executable("shell_benchmarks") { + sources = [ + "shell_benchmarks.cc", + ] + + deps = [ + "$flutter_root/benchmarking", + ] } diff --git a/shell/common/animator.cc b/shell/common/animator.cc index 727d521b7184f..4c281e1eceba7 100644 --- a/shell/common/animator.cc +++ b/shell/common/animator.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/common/animator.h b/shell/common/animator.h index 470f04b542881..2d60475621562 100644 --- a/shell/common/animator.h +++ b/shell/common/animator.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/common/engine.cc b/shell/common/engine.cc index 2a9ee3f2c09b0..dbc794dc0a443 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -1,11 +1,13 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "flutter/shell/common/engine.h" #include +#include #include +#include #include "flutter/common/settings.h" #include "flutter/fml/eintr_wrapper.h" @@ -19,14 +21,11 @@ #include "flutter/shell/common/animator.h" #include "flutter/shell/common/platform_view.h" #include "flutter/shell/common/shell.h" -#include "third_party/rapidjson/rapidjson/document.h" +#include "rapidjson/document.h" +#include "third_party/dart/runtime/include/dart_tools_api.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkPictureRecorder.h" -#ifdef ERROR -#undef ERROR -#endif - namespace shell { static constexpr char kAssetChannel[] = "flutter/assets"; @@ -42,6 +41,7 @@ Engine::Engine(Delegate& delegate, blink::TaskRunners task_runners, blink::Settings settings, std::unique_ptr animator, + fml::WeakPtr snapshot_delegate, fml::WeakPtr resource_context, fml::RefPtr unref_queue) : delegate_(delegate), @@ -59,6 +59,7 @@ Engine::Engine(Delegate& delegate, std::move(isolate_snapshot), // isolate snapshot std::move(shared_snapshot), // shared snapshot std::move(task_runners), // task runners + std::move(snapshot_delegate), // snapshot delegate std::move(resource_context), // resource context std::move(unref_queue), // skia unref queue settings_.advisory_script_uri, // advisory script uri @@ -73,7 +74,7 @@ fml::WeakPtr Engine::GetWeakPtr() const { } bool Engine::UpdateAssetManager( - fml::RefPtr new_asset_manager) { + std::shared_ptr new_asset_manager) { if (asset_manager_ == new_asset_manager) { return false; } @@ -194,7 +195,8 @@ void Engine::BeginFrame(fml::TimePoint frame_time) { } void Engine::NotifyIdle(int64_t deadline) { - TRACE_EVENT0("flutter", "Engine::NotifyIdle"); + TRACE_EVENT1("flutter", "Engine::NotifyIdle", "deadline_now_delta", + std::to_string(deadline - Dart_TimelineGetMicros()).c_str()); runtime_controller_->NotifyIdle(deadline); } @@ -322,14 +324,22 @@ bool Engine::HandleLocalizationPlatformMessage( if (args == root.MemberEnd() || !args->value.IsArray()) return false; - const auto& language = args->value[0]; - const auto& country = args->value[1]; - - if (!language.IsString() || !country.IsString()) + const size_t strings_per_locale = 4; + if (args->value.Size() % strings_per_locale != 0) return false; + std::vector locale_data; + for (size_t locale_index = 0; locale_index < args->value.Size(); + locale_index += strings_per_locale) { + if (!args->value[locale_index].IsString() || + !args->value[locale_index + 1].IsString()) + return false; + locale_data.push_back(args->value[locale_index].GetString()); + locale_data.push_back(args->value[locale_index + 1].GetString()); + locale_data.push_back(args->value[locale_index + 2].GetString()); + locale_data.push_back(args->value[locale_index + 3].GetString()); + } - return runtime_controller_->SetLocale(language.GetString(), - country.GetString()); + return runtime_controller_->SetLocales(locale_data); } void Engine::HandleSettingsPlatformMessage(blink::PlatformMessage* message) { @@ -406,6 +416,11 @@ void Engine::HandlePlatformMessage( } } +void Engine::UpdateIsolateDescription(const std::string isolate_name, + int64_t isolate_port) { + delegate_.UpdateIsolateDescription(isolate_name, isolate_port); +} + blink::FontCollection& Engine::GetFontCollection() { return font_collection_; } diff --git a/shell/common/engine.h b/shell/common/engine.h index 06436ce3683d0..fd5671bc36648 100644 --- a/shell/common/engine.h +++ b/shell/common/engine.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -14,6 +14,7 @@ #include "flutter/fml/memory/weak_ptr.h" #include "flutter/lib/ui/semantics/custom_accessibility_action.h" #include "flutter/lib/ui/semantics/semantics_node.h" +#include "flutter/lib/ui/snapshot_delegate.h" #include "flutter/lib/ui/text/font_collection.h" #include "flutter/lib/ui/window/platform_message.h" #include "flutter/lib/ui/window/viewport_metrics.h" @@ -47,6 +48,9 @@ class Engine final : public blink::RuntimeDelegate { fml::RefPtr message) = 0; virtual void OnPreEngineRestart() = 0; + + virtual void UpdateIsolateDescription(const std::string isolate_name, + int64_t isolate_port) = 0; }; Engine(Delegate& delegate, @@ -56,6 +60,7 @@ class Engine final : public blink::RuntimeDelegate { blink::TaskRunners task_runners, blink::Settings settings, std::unique_ptr animator, + fml::WeakPtr snapshot_delegate, fml::WeakPtr resource_context, fml::RefPtr unref_queue); @@ -73,7 +78,7 @@ class Engine final : public blink::RuntimeDelegate { FML_WARN_UNUSED_RESULT bool Restart(RunConfiguration configuration); - bool UpdateAssetManager(fml::RefPtr asset_manager); + bool UpdateAssetManager(std::shared_ptr asset_manager); void BeginFrame(fml::TimePoint frame_time); @@ -119,7 +124,7 @@ class Engine final : public blink::RuntimeDelegate { std::unique_ptr runtime_controller_; std::string initial_route_; blink::ViewportMetrics viewport_metrics_; - fml::RefPtr asset_manager_; + std::shared_ptr asset_manager_; bool activity_running_; bool have_surface_; blink::FontCollection font_collection_; @@ -140,6 +145,10 @@ class Engine final : public blink::RuntimeDelegate { void HandlePlatformMessage( fml::RefPtr message) override; + // |blink::RuntimeDelegate| + void UpdateIsolateDescription(const std::string isolate_name, + int64_t isolate_port) override; + void StopAnimator(); void StartAnimatorIfPossible(); diff --git a/shell/common/io_manager.cc b/shell/common/io_manager.cc index c92df1e910c99..c6ff79b644f30 100644 --- a/shell/common/io_manager.cc +++ b/shell/common/io_manager.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -24,6 +24,7 @@ sk_sp IOManager::CreateCompatibleResourceLoadingContext( // thread. The necessary work isn't being flushed or synchronized with the // other threads correctly, so the textures end up blank. For now, suppress // that feature, which will cause texture uploads to do CPU YUV conversion. + // A similar work-around is also used in shell/gpu/gpu_surface_gl.cc. options.fDisableGpuYUVConversion = true; // To get video playback on the widest range of devices, we limit Skia to diff --git a/shell/common/io_manager.h b/shell/common/io_manager.h index 0b459e20571d5..2d6ec241d886d 100644 --- a/shell/common/io_manager.h +++ b/shell/common/io_manager.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/common/isolate_configuration.cc b/shell/common/isolate_configuration.cc index 57c38bef9f8d8..173973b64e5b1 100644 --- a/shell/common/isolate_configuration.cc +++ b/shell/common/isolate_configuration.cc @@ -1,15 +1,12 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "flutter/shell/common/isolate_configuration.h" +#include "flutter/fml/make_copyable.h" #include "flutter/runtime/dart_vm.h" -#ifdef ERROR -#undef ERROR -#endif - namespace shell { IsolateConfiguration::IsolateConfiguration() = default; @@ -61,7 +58,7 @@ class KernelIsolateConfiguration : public IsolateConfiguration { class KernelListIsolateConfiguration final : public IsolateConfiguration { public: KernelListIsolateConfiguration( - std::vector> kernel_pieces) + std::vector>> kernel_pieces) : kernel_pieces_(std::move(kernel_pieces)) {} // |shell::IsolateConfiguration| @@ -72,7 +69,8 @@ class KernelListIsolateConfiguration final : public IsolateConfiguration { for (size_t i = 0; i < kernel_pieces_.size(); i++) { bool last_piece = i + 1 == kernel_pieces_.size(); - if (!isolate.PrepareForRunningFromKernel(std::move(kernel_pieces_[i]), + + if (!isolate.PrepareForRunningFromKernel(kernel_pieces_[i].get(), last_piece)) { return false; } @@ -82,21 +80,88 @@ class KernelListIsolateConfiguration final : public IsolateConfiguration { } private: - std::vector> kernel_pieces_; + std::vector>> kernel_pieces_; FML_DISALLOW_COPY_AND_ASSIGN(KernelListIsolateConfiguration); }; +static std::vector ParseKernelListPaths( + std::unique_ptr kernel_list) { + FML_DCHECK(kernel_list); + + std::vector kernel_pieces_paths; + + const char* kernel_list_str = + reinterpret_cast(kernel_list->GetMapping()); + size_t kernel_list_size = kernel_list->GetSize(); + + size_t piece_path_start = 0; + while (piece_path_start < kernel_list_size) { + size_t piece_path_end = piece_path_start; + while ((piece_path_end < kernel_list_size) && + (kernel_list_str[piece_path_end] != '\n')) { + piece_path_end++; + } + std::string piece_path(&kernel_list_str[piece_path_start], + piece_path_end - piece_path_start); + kernel_pieces_paths.emplace_back(std::move(piece_path)); + + piece_path_start = piece_path_end + 1; + } + + return kernel_pieces_paths; +} + +static std::vector>> +PrepareKernelMappings(std::vector kernel_pieces_paths, + std::shared_ptr asset_manager, + fml::RefPtr io_worker) { + FML_DCHECK(asset_manager); + std::vector>> fetch_futures; + + for (const auto& kernel_pieces_path : kernel_pieces_paths) { + std::promise> fetch_promise; + fetch_futures.push_back(fetch_promise.get_future()); + auto fetch_task = + fml::MakeCopyable([asset_manager, kernel_pieces_path, + fetch_promise = std::move(fetch_promise)]() mutable { + fetch_promise.set_value( + asset_manager->GetAsMapping(kernel_pieces_path)); + }); + // Fulfill the promise on the worker if one is available or the current + // thread if one is not. + if (io_worker) { + io_worker->PostTask(fetch_task); + } else { + fetch_task(); + } + } + + return fetch_futures; +} + std::unique_ptr IsolateConfiguration::InferFromSettings( const blink::Settings& settings, - fml::RefPtr asset_manager) { + std::shared_ptr asset_manager, + fml::RefPtr io_worker) { // Running in AOT mode. if (blink::DartVM::IsRunningPrecompiledCode()) { return CreateForAppSnapshot(); } + if (!asset_manager) { + return nullptr; + } + + if (settings.application_kernel_asset.empty() && + settings.application_kernel_list_asset.empty()) { + FML_DLOG(ERROR) << "application_kernel_asset or " + "application_kernel_list_asset must be set"; + return nullptr; + } + // Running from kernel snapshot. - if (asset_manager) { + { std::unique_ptr kernel = asset_manager->GetAsMapping(settings.application_kernel_asset); if (kernel) { @@ -105,40 +170,17 @@ std::unique_ptr IsolateConfiguration::InferFromSettings( } // Running from kernel divided into several pieces (for sharing). - // TODO(fuchsia): Use async blobfs API once it becomes available. - if (asset_manager) { + { std::unique_ptr kernel_list = asset_manager->GetAsMapping(settings.application_kernel_list_asset); - if (kernel_list) { - const char* kernel_list_str = - reinterpret_cast(kernel_list->GetMapping()); - size_t kernel_list_size = kernel_list->GetSize(); - - std::vector> kernel_pieces; - - size_t piece_path_start = 0; - while (piece_path_start < kernel_list_size) { - size_t piece_path_end = piece_path_start; - while ((piece_path_end < kernel_list_size) && - (kernel_list_str[piece_path_end] != '\n')) { - piece_path_end++; - } - - std::string piece_path(&kernel_list_str[piece_path_start], - piece_path_end - piece_path_start); - std::unique_ptr piece = - asset_manager->GetAsMapping(piece_path); - if (piece == nullptr) { - FML_LOG(ERROR) << "Failed to load: " << piece_path; - return nullptr; - } - - kernel_pieces.emplace_back(std::move(piece)); - - piece_path_start = piece_path_end + 1; - } - return CreateForKernelList(std::move(kernel_pieces)); + if (!kernel_list) { + FML_LOG(ERROR) << "Failed to load: " << settings.application_kernel_asset; + return nullptr; } + auto kernel_pieces_paths = ParseKernelListPaths(std::move(kernel_list)); + auto kernel_mappings = PrepareKernelMappings(std::move(kernel_pieces_paths), + asset_manager, io_worker); + return CreateForKernelList(std::move(kernel_mappings)); } return nullptr; @@ -156,6 +198,17 @@ std::unique_ptr IsolateConfiguration::CreateForKernel( std::unique_ptr IsolateConfiguration::CreateForKernelList( std::vector> kernel_pieces) { + std::vector>> pieces; + for (auto& piece : kernel_pieces) { + std::promise> promise; + pieces.push_back(promise.get_future()); + promise.set_value(std::move(piece)); + } + return CreateForKernelList(std::move(pieces)); +} + +std::unique_ptr IsolateConfiguration::CreateForKernelList( + std::vector>> kernel_pieces) { return std::make_unique( std::move(kernel_pieces)); } diff --git a/shell/common/isolate_configuration.h b/shell/common/isolate_configuration.h index 7dd54ccf3b3b7..e9f8d66b2e433 100644 --- a/shell/common/isolate_configuration.h +++ b/shell/common/isolate_configuration.h @@ -1,10 +1,11 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FLUTTER_SHELL_COMMON_ISOLATE_CONFIGURATION_H_ #define FLUTTER_SHELL_COMMON_ISOLATE_CONFIGURATION_H_ +#include #include #include @@ -22,13 +23,20 @@ class IsolateConfiguration { public: static std::unique_ptr InferFromSettings( const blink::Settings& settings, - fml::RefPtr asset_manager); + std::shared_ptr asset_manager, + fml::RefPtr io_worker); static std::unique_ptr CreateForAppSnapshot(); static std::unique_ptr CreateForKernel( std::unique_ptr kernel); + static std::unique_ptr CreateForKernelList( + std::vector>> kernel_pieces); + + // TODO(chinmaygarde): Remove this variant in favor of the one using futures + // for parallelizing asset loads. This one is in place for API compatibility + // till Android is updated. static std::unique_ptr CreateForKernelList( std::vector> kernel_pieces); diff --git a/shell/common/persistent_cache.cc b/shell/common/persistent_cache.cc index f7327a40b1686..d6d027ffab25e 100644 --- a/shell/common/persistent_cache.cc +++ b/shell/common/persistent_cache.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -40,16 +40,8 @@ PersistentCache* PersistentCache::GetCacheForProcess() { return gPersistentCache.get(); } -PersistentCache::PersistentCache() - : cache_directory_(std::make_shared( - CreateDirectory(fml::paths::GetCachesDirectory(), - { - "flutter_engine", // - GetFlutterEngineVersion(), // - "skia", // - GetSkiaVersion() // - }, - fml::FilePermission::kReadWrite))) { +PersistentCache::PersistentCache() { + // TODO(chinmaygarde): Reenable caching, avoiding the windows crasher. if (!IsValid()) { FML_LOG(WARNING) << "Could not acquire the persistent cache directory. " "Caching of GPU resources on disk is disabled."; diff --git a/shell/common/persistent_cache.h b/shell/common/persistent_cache.h index 2bc1280d63c3e..32465a5c8c091 100644 --- a/shell/common/persistent_cache.h +++ b/shell/common/persistent_cache.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/common/platform_view.cc b/shell/common/platform_view.cc index 76c01dca9cef0..4a4e7df074248 100644 --- a/shell/common/platform_view.cc +++ b/shell/common/platform_view.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/common/platform_view.h b/shell/common/platform_view.h index 153cae71d53a0..ed3b6e999a3ea 100644 --- a/shell/common/platform_view.h +++ b/shell/common/platform_view.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index 6f08b2afd0b7e..e4d81df17ae8d 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -14,12 +14,12 @@ #include "third_party/skia/include/core/SkSurfaceCharacterization.h" #include "third_party/skia/include/utils/SkBase64.h" -#ifdef ERROR -#undef ERROR -#endif - namespace shell { +// The rasterizer will tell Skia to purge cached resources that have not been +// used within this interval. +static constexpr std::chrono::milliseconds kSkiaCleanupExpiration(15000); + Rasterizer::Rasterizer(blink::TaskRunners task_runners) : Rasterizer(std::move(task_runners), std::make_unique()) {} @@ -39,6 +39,10 @@ fml::WeakPtr Rasterizer::GetWeakPtr() const { return weak_factory_.GetWeakPtr(); } +fml::WeakPtr Rasterizer::GetSnapshotDelegate() const { + return weak_factory_.GetWeakPtr(); +} + void Rasterizer::Setup(std::unique_ptr surface) { surface_ = std::move(surface); compositor_context_->OnGrContextCreated(); @@ -89,6 +93,57 @@ void Rasterizer::Draw( } } +sk_sp Rasterizer::MakeRasterSnapshot(sk_sp picture, + SkISize picture_size) { + TRACE_EVENT0("flutter", __FUNCTION__); + + sk_sp surface; + if (surface_ == nullptr || surface_->GetContext() == nullptr) { + // Raster surface is fine if there is no on screen surface. This might + // happen in case of software rendering. + surface = SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(picture_size)); + } else { + if (!surface_->MakeRenderContextCurrent()) { + return nullptr; + } + + // When there is an on screen surface, we need a render target SkSurface + // because we want to access texture backed images. + surface = SkSurface::MakeRenderTarget( + surface_->GetContext(), // context + SkBudgeted::kNo, // budgeted + SkImageInfo::MakeN32Premul(picture_size) // image info + ); + } + + if (surface == nullptr || surface->getCanvas() == nullptr) { + return nullptr; + } + + surface->getCanvas()->drawPicture(picture.get()); + + surface->getCanvas()->flush(); + + sk_sp device_snapshot; + { + TRACE_EVENT0("flutter", "MakeDeviceSnpashot"); + device_snapshot = surface->makeImageSnapshot(); + } + + if (device_snapshot == nullptr) { + return nullptr; + } + + { + TRACE_EVENT0("flutter", "DeviceHostTransfer"); + if (auto raster_image = device_snapshot->makeRasterImage()) { + return raster_image; + } + } + + return nullptr; +} + void Rasterizer::DoDraw(std::unique_ptr layer_tree) { if (!layer_tree || !surface_) { return; @@ -113,10 +168,17 @@ bool Rasterizer::DrawToSurface(flow::LayerTree& layer_tree) { // for instrumentation. compositor_context_->engine_time().SetLapTime(layer_tree.construction_time()); - auto canvas = frame->SkiaCanvas(); + auto* canvas = frame->SkiaCanvas(); + + auto* external_view_embedder = surface_->GetExternalViewEmbedder(); + + if (external_view_embedder != nullptr) { + external_view_embedder->BeginFrame(layer_tree.frame_size()); + } auto compositor_frame = compositor_context_->AcquireFrame( - surface_->GetContext(), canvas, surface_->GetRootTransformation(), true); + surface_->GetContext(), canvas, external_view_embedder, + surface_->GetRootTransformation(), true); if (canvas) { canvas->clear(SK_ColorTRANSPARENT); @@ -124,7 +186,14 @@ bool Rasterizer::DrawToSurface(flow::LayerTree& layer_tree) { if (compositor_frame && compositor_frame->Raster(layer_tree, false)) { frame->Submit(); + if (external_view_embedder != nullptr) { + external_view_embedder->SubmitFrame(surface_->GetContext()); + } FireNextFrameCallbackIfPresent(); + + if (surface_->GetContext()) + surface_->GetContext()->performDeferredCleanup(kSkiaCleanupExpiration); + return true; } @@ -146,9 +215,11 @@ static sk_sp ScreenshotLayerTreeAsPicture( SkMatrix root_surface_transformation; root_surface_transformation.reset(); - auto frame = - compositor_context.AcquireFrame(nullptr, recorder.getRecordingCanvas(), - root_surface_transformation, false); + // TODO(amirh): figure out how to take a screenshot with embedded UIView. + // https://github.com/flutter/flutter/issues/23435 + auto frame = compositor_context.AcquireFrame( + nullptr, recorder.getRecordingCanvas(), nullptr, + root_surface_transformation, false); frame->Raster(*tree, true); @@ -190,7 +261,7 @@ static sk_sp ScreenshotLayerTreeAsImage( } // Draw the current layer tree into the snapshot surface. - auto canvas = snapshot_surface->getCanvas(); + auto* canvas = snapshot_surface->getCanvas(); // There is no root surface transformation for the screenshot layer. Reset the // matrix to identity. @@ -198,7 +269,7 @@ static sk_sp ScreenshotLayerTreeAsImage( root_surface_transformation.reset(); auto frame = compositor_context.AcquireFrame( - surface_context, canvas, root_surface_transformation, false); + surface_context, canvas, nullptr, root_surface_transformation, false); canvas->clear(SK_ColorTRANSPARENT); frame->Raster(*tree, true); canvas->flush(); @@ -236,7 +307,7 @@ static sk_sp ScreenshotLayerTreeAsImage( Rasterizer::Screenshot Rasterizer::ScreenshotLastLayerTree( Rasterizer::ScreenshotType type, bool base64_encode) { - auto layer_tree = GetLastLayerTree(); + auto* layer_tree = GetLastLayerTree(); if (layer_tree == nullptr) { FML_LOG(ERROR) << "Last layer tree was null when screenshotting."; return {}; @@ -289,4 +360,13 @@ void Rasterizer::FireNextFrameCallbackIfPresent() { callback(); } +Rasterizer::Screenshot::Screenshot() {} + +Rasterizer::Screenshot::Screenshot(sk_sp p_data, SkISize p_size) + : data(std::move(p_data)), frame_size(p_size) {} + +Rasterizer::Screenshot::Screenshot(const Screenshot& other) = default; + +Rasterizer::Screenshot::~Screenshot() = default; + } // namespace shell diff --git a/shell/common/rasterizer.h b/shell/common/rasterizer.h index 1d3c03d8953df..cf02e795b15eb 100644 --- a/shell/common/rasterizer.h +++ b/shell/common/rasterizer.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,12 +13,13 @@ #include "flutter/fml/closure.h" #include "flutter/fml/memory/weak_ptr.h" #include "flutter/fml/synchronization/waitable_event.h" +#include "flutter/lib/ui/snapshot_delegate.h" #include "flutter/shell/common/surface.h" #include "flutter/synchronization/pipeline.h" namespace shell { -class Rasterizer final { +class Rasterizer final : public blink::SnapshotDelegate { public: Rasterizer(blink::TaskRunners task_runners); @@ -33,6 +34,8 @@ class Rasterizer final { fml::WeakPtr GetWeakPtr() const; + fml::WeakPtr GetSnapshotDelegate() const; + flow::LayerTree* GetLastLayerTree(); void DrawLastLayerTree(); @@ -51,10 +54,13 @@ class Rasterizer final { sk_sp data; SkISize frame_size = SkISize::MakeEmpty(); - Screenshot() {} + Screenshot(); + + Screenshot(sk_sp p_data, SkISize p_size); - Screenshot(sk_sp p_data, SkISize p_size) - : data(std::move(p_data)), frame_size(p_size) {} + Screenshot(const Screenshot& other); + + ~Screenshot(); }; Screenshot ScreenshotLastLayerTree(ScreenshotType type, bool base64_encode); @@ -75,6 +81,10 @@ class Rasterizer final { fml::closure next_frame_callback_; fml::WeakPtrFactory weak_factory_; + // |blink::SnapshotDelegate| + sk_sp MakeRasterSnapshot(sk_sp picture, + SkISize picture_size) override; + void DoDraw(std::unique_ptr layer_tree); bool DrawToSurface(flow::LayerTree& layer_tree); diff --git a/shell/common/run_configuration.cc b/shell/common/run_configuration.cc index 57784a0e08d67..122b45e6b0eff 100644 --- a/shell/common/run_configuration.cc +++ b/shell/common/run_configuration.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,8 +13,9 @@ namespace shell { RunConfiguration RunConfiguration::InferFromSettings( - const blink::Settings& settings) { - auto asset_manager = fml::MakeRefCounted(); + const blink::Settings& settings, + fml::RefPtr io_worker) { + auto asset_manager = std::make_shared(); asset_manager->PushBack(std::make_unique( fml::Duplicate(settings.assets_dir))); @@ -23,18 +24,19 @@ RunConfiguration RunConfiguration::InferFromSettings( std::make_unique(fml::OpenDirectory( settings.assets_path.c_str(), false, fml::FilePermission::kRead))); - return {IsolateConfiguration::InferFromSettings(settings, asset_manager), + return {IsolateConfiguration::InferFromSettings(settings, asset_manager, + io_worker), asset_manager}; } RunConfiguration::RunConfiguration( std::unique_ptr configuration) : RunConfiguration(std::move(configuration), - fml::MakeRefCounted()) {} + std::make_shared()) {} RunConfiguration::RunConfiguration( std::unique_ptr configuration, - fml::RefPtr asset_manager) + std::shared_ptr asset_manager) : isolate_configuration_(std::move(configuration)), asset_manager_(std::move(asset_manager)) {} @@ -66,7 +68,7 @@ void RunConfiguration::SetEntrypointAndLibrary(std::string entrypoint, entrypoint_library_ = std::move(library); } -fml::RefPtr RunConfiguration::GetAssetManager() const { +std::shared_ptr RunConfiguration::GetAssetManager() const { return asset_manager_; } diff --git a/shell/common/run_configuration.h b/shell/common/run_configuration.h index bc3b78f52e157..7cdebdd9f4a6b 100644 --- a/shell/common/run_configuration.h +++ b/shell/common/run_configuration.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,12 +20,14 @@ namespace shell { class RunConfiguration { public: - static RunConfiguration InferFromSettings(const blink::Settings& settings); + static RunConfiguration InferFromSettings( + const blink::Settings& settings, + fml::RefPtr io_worker = nullptr); RunConfiguration(std::unique_ptr configuration); RunConfiguration(std::unique_ptr configuration, - fml::RefPtr asset_manager); + std::shared_ptr asset_manager); RunConfiguration(RunConfiguration&&); @@ -39,7 +41,7 @@ class RunConfiguration { void SetEntrypointAndLibrary(std::string entrypoint, std::string library); - fml::RefPtr GetAssetManager() const; + std::shared_ptr GetAssetManager() const; const std::string& GetEntrypoint() const; @@ -49,7 +51,7 @@ class RunConfiguration { private: std::unique_ptr isolate_configuration_; - fml::RefPtr asset_manager_; + std::shared_ptr asset_manager_; std::string entrypoint_ = "main"; std::string entrypoint_library_ = ""; diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 8f07f500588a4..4adf55a3f6c74 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -31,10 +31,6 @@ #include "third_party/skia/include/core/SkGraphics.h" #include "third_party/tonic/common/log.h" -#ifdef ERROR -#undef ERROR -#endif - namespace shell { std::unique_ptr Shell::CreateShellOnPlatformThread( @@ -92,31 +88,37 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( // Create the rasterizer on the GPU thread. fml::AutoResetWaitableEvent gpu_latch; std::unique_ptr rasterizer; + fml::WeakPtr snapshot_delegate; fml::TaskRunner::RunNowOrPostTask( task_runners.GetGPUTaskRunner(), [&gpu_latch, // &rasterizer, // on_create_rasterizer, // - shell = shell.get() // + shell = shell.get(), // + &snapshot_delegate // ]() { if (auto new_rasterizer = on_create_rasterizer(*shell)) { rasterizer = std::move(new_rasterizer); + snapshot_delegate = rasterizer->GetSnapshotDelegate(); } gpu_latch.Signal(); }); + gpu_latch.Wait(); + // Create the engine on the UI thread. fml::AutoResetWaitableEvent ui_latch; std::unique_ptr engine; fml::TaskRunner::RunNowOrPostTask( shell->GetTaskRunners().GetUITaskRunner(), - fml::MakeCopyable([&ui_latch, // - &engine, // - shell = shell.get(), // - isolate_snapshot = std::move(isolate_snapshot), // - shared_snapshot = std::move(shared_snapshot), // - vsync_waiter = std::move(vsync_waiter), // - resource_context = std::move(resource_context), // - unref_queue = std::move(unref_queue) // + fml::MakeCopyable([&ui_latch, // + &engine, // + shell = shell.get(), // + isolate_snapshot = std::move(isolate_snapshot), // + shared_snapshot = std::move(shared_snapshot), // + vsync_waiter = std::move(vsync_waiter), // + snapshot_delegate = std::move(snapshot_delegate), // + resource_context = std::move(resource_context), // + unref_queue = std::move(unref_queue) // ]() mutable { const auto& task_runners = shell->GetTaskRunners(); @@ -125,20 +127,20 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( auto animator = std::make_unique(*shell, task_runners, std::move(vsync_waiter)); - engine = std::make_unique(*shell, // - shell->GetDartVM(), // - std::move(isolate_snapshot), // - std::move(shared_snapshot), // - task_runners, // - shell->GetSettings(), // - std::move(animator), // - std::move(resource_context), // - std::move(unref_queue) // + engine = std::make_unique(*shell, // + shell->GetDartVM(), // + std::move(isolate_snapshot), // + std::move(shared_snapshot), // + task_runners, // + shell->GetSettings(), // + std::move(animator), // + std::move(snapshot_delegate), // + std::move(resource_context), // + std::move(unref_queue) // ); ui_latch.Signal(); })); - gpu_latch.Wait(); ui_latch.Wait(); // We are already on the platform thread. So there is no platform latch to // wait on. @@ -371,7 +373,7 @@ bool Shell::Setup(std::unique_ptr platform_view, is_setup_ = true; if (auto vm = blink::DartVM::ForProcessIfInitialized()) { - vm->GetServiceProtocol().AddHandler(this); + vm->GetServiceProtocol().AddHandler(this, GetServiceProtocolDescription()); } PersistentCache::GetCacheForProcess()->AddWorkerTaskRunner( @@ -586,7 +588,7 @@ void Shell::OnPlatformViewRegisterTexture( task_runners_.GetGPUTaskRunner()->PostTask( [rasterizer = rasterizer_->GetWeakPtr(), texture] { if (rasterizer) { - if (auto registry = rasterizer->GetTextureRegistry()) { + if (auto* registry = rasterizer->GetTextureRegistry()) { registry->RegisterTexture(texture); } } @@ -601,7 +603,7 @@ void Shell::OnPlatformViewUnregisterTexture(int64_t texture_id) { task_runners_.GetGPUTaskRunner()->PostTask( [rasterizer = rasterizer_->GetWeakPtr(), texture_id]() { if (rasterizer) { - if (auto registry = rasterizer->GetTextureRegistry()) { + if (auto* registry = rasterizer->GetTextureRegistry()) { registry->UnregisterTexture(texture_id); } } @@ -616,7 +618,7 @@ void Shell::OnPlatformViewMarkTextureFrameAvailable(int64_t texture_id) { // Tell the rasterizer that one of its textures has a new frame available. task_runners_.GetGPUTaskRunner()->PostTask( [rasterizer = rasterizer_->GetWeakPtr(), texture_id]() { - auto registry = rasterizer->GetTextureRegistry(); + auto* registry = rasterizer->GetTextureRegistry(); if (!registry) { return; @@ -747,6 +749,15 @@ void Shell::OnPreEngineRestart() { latch.Wait(); } +// |shell::Engine::Delegate| +void Shell::UpdateIsolateDescription(const std::string isolate_name, + int64_t isolate_port) { + if (auto vm = blink::DartVM::ForProcessIfInitialized()) { + Handler::Description description(isolate_port, isolate_name); + vm->GetServiceProtocol().SetHandlerDescription(this, description); + } +} + // |blink::ServiceProtocol::Handler| fml::RefPtr Shell::GetServiceProtocolHandlerTaskRunner( fml::StringView method) const { @@ -943,7 +954,7 @@ bool Shell::OnServiceProtocolSetAssetBundlePath( auto& allocator = response.GetAllocator(); response.SetObject(); - auto asset_manager = fml::MakeRefCounted(); + auto asset_manager = std::make_shared(); asset_manager->PushFront(std::make_unique( fml::OpenDirectory(params.at("assetDirectory").ToString().c_str(), false, diff --git a/shell/common/shell.h b/shell/common/shell.h index 62723fde78521..241823038c6a5 100644 --- a/shell/common/shell.h +++ b/shell/common/shell.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -182,6 +182,10 @@ class Shell final : public PlatformView::Delegate, // |shell::Engine::Delegate| void OnPreEngineRestart() override; + // |shell::Engine::Delegate| + void UpdateIsolateDescription(const std::string isolate_name, + int64_t isolate_port) override; + // |blink::ServiceProtocol::Handler| fml::RefPtr GetServiceProtocolHandlerTaskRunner( fml::StringView method) const override; diff --git a/shell/common/shell_benchmarks.cc b/shell/common/shell_benchmarks.cc new file mode 100644 index 0000000000000..df15b8f1b40ff --- /dev/null +++ b/shell/common/shell_benchmarks.cc @@ -0,0 +1,80 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/benchmarking/benchmarking.h" +#include "flutter/fml/logging.h" +#include "flutter/shell/common/shell.h" +#include "flutter/shell/common/thread_host.h" + +namespace shell { + +static void StartupAndShutdownShell(benchmark::State& state, + bool measure_startup, + bool measure_shutdown) { + std::unique_ptr shell; + std::unique_ptr thread_host; + { + benchmarking::ScopedPauseTiming pause(state, !measure_startup); + blink::Settings settings = {}; + settings.task_observer_add = [](intptr_t, fml::closure) {}; + settings.task_observer_remove = [](intptr_t) {}; + + // Measure the time it takes to setup the threads as well. + thread_host = std::make_unique( + "io.flutter.bench.", ThreadHost::Type::Platform | + ThreadHost::Type::GPU | ThreadHost::Type::IO | + ThreadHost::Type::UI); + + blink::TaskRunners task_runners( + "test", thread_host->platform_thread->GetTaskRunner(), + thread_host->gpu_thread->GetTaskRunner(), + thread_host->ui_thread->GetTaskRunner(), + thread_host->io_thread->GetTaskRunner()); + + shell = Shell::Create( + std::move(task_runners), settings, + [](Shell& shell) { + return std::make_unique(shell, shell.GetTaskRunners()); + }, + [](Shell& shell) { + return std::make_unique(shell.GetTaskRunners()); + }); + } + + FML_CHECK(shell); + + { + benchmarking::ScopedPauseTiming pause(state, !measure_shutdown); + shell.reset(); // Shutdown is synchronous. + thread_host.reset(); + } + + FML_CHECK(!shell); +} + +static void BM_ShellInitialization(benchmark::State& state) { + while (state.KeepRunning()) { + StartupAndShutdownShell(state, true, false); + } +} + +BENCHMARK(BM_ShellInitialization); + +static void BM_ShellShutdown(benchmark::State& state) { + while (state.KeepRunning()) { + StartupAndShutdownShell(state, false, true); + } +} + +BENCHMARK(BM_ShellShutdown); + +static void BM_ShellInitializationAndShutdown(benchmark::State& state) { + while (state.KeepRunning()) { + StartupAndShutdownShell(state, true, true); + } +} + +BENCHMARK(BM_ShellInitializationAndShutdown); + +} // namespace shell diff --git a/shell/common/shell_unittests.cc b/shell/common/shell_unittests.cc index 6c1cc66c9f6ff..aa4e86690ffe4 100644 --- a/shell/common/shell_unittests.cc +++ b/shell/common/shell_unittests.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -14,6 +14,7 @@ #include "flutter/shell/common/rasterizer.h" #include "flutter/shell/common/shell.h" #include "flutter/shell/common/thread_host.h" +#include "flutter/shell/gpu/gpu_surface_software.h" #include "gtest/gtest.h" #define CURRENT_TEST_NAME \ @@ -23,6 +24,64 @@ namespace shell { +class TestPlatformView : public PlatformView, + public GPUSurfaceSoftwareDelegate { + public: + TestPlatformView(PlatformView::Delegate& delegate, + blink::TaskRunners task_runners) + : PlatformView(delegate, std::move(task_runners)) {} + + private: + // |PlatformView| + std::unique_ptr CreateRenderingSurface() override { + return std::make_unique(this); + } + + // |GPUSurfaceSoftwareDelegate| + virtual sk_sp AcquireBackingStore(const SkISize& size) override { + return SkSurface::MakeRasterN32Premul(size.width(), size.height()); + } + + // |GPUSurfaceSoftwareDelegate| + virtual bool PresentBackingStore(sk_sp backing_store) override { + return true; + } + + FML_DISALLOW_COPY_AND_ASSIGN(TestPlatformView); +}; + +static bool ValidateShell(Shell* shell) { + if (!shell) { + return false; + } + + if (!shell->IsSetup()) { + return false; + } + + { + fml::AutoResetWaitableEvent latch; + fml::TaskRunner::RunNowOrPostTask( + shell->GetTaskRunners().GetPlatformTaskRunner(), [shell, &latch]() { + shell->GetPlatformView()->NotifyCreated(); + latch.Signal(); + }); + latch.Wait(); + } + + { + fml::AutoResetWaitableEvent latch; + fml::TaskRunner::RunNowOrPostTask( + shell->GetTaskRunners().GetPlatformTaskRunner(), [shell, &latch]() { + shell->GetPlatformView()->NotifyDestroyed(); + latch.Signal(); + }); + latch.Wait(); + } + + return true; +} + TEST(ShellTest, InitializeWithInvalidThreads) { blink::Settings settings = {}; settings.task_observer_add = [](intptr_t, fml::closure) {}; @@ -31,7 +90,8 @@ TEST(ShellTest, InitializeWithInvalidThreads) { auto shell = Shell::Create( std::move(task_runners), settings, [](Shell& shell) { - return std::make_unique(shell, shell.GetTaskRunners()); + return std::make_unique(shell, + shell.GetTaskRunners()); }, [](Shell& shell) { return std::make_unique(shell.GetTaskRunners()); @@ -54,12 +114,13 @@ TEST(ShellTest, InitializeWithDifferentThreads) { auto shell = Shell::Create( std::move(task_runners), settings, [](Shell& shell) { - return std::make_unique(shell, shell.GetTaskRunners()); + return std::make_unique(shell, + shell.GetTaskRunners()); }, [](Shell& shell) { return std::make_unique(shell.GetTaskRunners()); }); - ASSERT_TRUE(shell); + ASSERT_TRUE(ValidateShell(shell.get())); } TEST(ShellTest, InitializeWithSingleThread) { @@ -74,12 +135,13 @@ TEST(ShellTest, InitializeWithSingleThread) { auto shell = Shell::Create( std::move(task_runners), settings, [](Shell& shell) { - return std::make_unique(shell, shell.GetTaskRunners()); + return std::make_unique(shell, + shell.GetTaskRunners()); }, [](Shell& shell) { return std::make_unique(shell.GetTaskRunners()); }); - ASSERT_TRUE(shell); + ASSERT_TRUE(ValidateShell(shell.get())); } TEST(ShellTest, InitializeWithSingleThreadWhichIsTheCallingThread) { @@ -93,12 +155,13 @@ TEST(ShellTest, InitializeWithSingleThreadWhichIsTheCallingThread) { auto shell = Shell::Create( std::move(task_runners), settings, [](Shell& shell) { - return std::make_unique(shell, shell.GetTaskRunners()); + return std::make_unique(shell, + shell.GetTaskRunners()); }, [](Shell& shell) { return std::make_unique(shell.GetTaskRunners()); }); - ASSERT_TRUE(shell); + ASSERT_TRUE(ValidateShell(shell.get())); } TEST(ShellTest, InitializeWithMultipleThreadButCallingThreadAsPlatformThread) { @@ -117,12 +180,41 @@ TEST(ShellTest, InitializeWithMultipleThreadButCallingThreadAsPlatformThread) { auto shell = Shell::Create( std::move(task_runners), settings, [](Shell& shell) { - return std::make_unique(shell, shell.GetTaskRunners()); + return std::make_unique(shell, + shell.GetTaskRunners()); + }, + [](Shell& shell) { + return std::make_unique(shell.GetTaskRunners()); + }); + ASSERT_TRUE(ValidateShell(shell.get())); +} + +// Reported in Bug: Engine deadlocks when gpu and platforms threads are the same +// #21398 (https://github.com/flutter/flutter/issues/21398) +TEST(ShellTest, DISABLED_InitializeWithGPUAndPlatformThreadsTheSame) { + blink::Settings settings = {}; + settings.task_observer_add = [](intptr_t, fml::closure) {}; + settings.task_observer_remove = [](intptr_t) {}; + ThreadHost thread_host( + "io.flutter.test." + CURRENT_TEST_NAME + ".", + ThreadHost::Type::Platform | ThreadHost::Type::IO | ThreadHost::Type::UI); + blink::TaskRunners task_runners( + "test", + thread_host.platform_thread->GetTaskRunner(), // platform + thread_host.platform_thread->GetTaskRunner(), // gpu + thread_host.ui_thread->GetTaskRunner(), // ui + thread_host.io_thread->GetTaskRunner() // io + ); + auto shell = Shell::Create( + std::move(task_runners), settings, + [](Shell& shell) { + return std::make_unique(shell, + shell.GetTaskRunners()); }, [](Shell& shell) { return std::make_unique(shell.GetTaskRunners()); }); - ASSERT_TRUE(shell); + ASSERT_TRUE(ValidateShell(shell.get())); } } // namespace shell diff --git a/shell/common/skia_event_tracer_impl.cc b/shell/common/skia_event_tracer_impl.cc index 2f1c386f08a0b..7b073a729638e 100644 --- a/shell/common/skia_event_tracer_impl.cc +++ b/shell/common/skia_event_tracer_impl.cc @@ -1,4 +1,4 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/common/skia_event_tracer_impl.h b/shell/common/skia_event_tracer_impl.h index 55305b9cbdd4b..12e2fc41dee85 100644 --- a/shell/common/skia_event_tracer_impl.h +++ b/shell/common/skia_event_tracer_impl.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/common/surface.cc b/shell/common/surface.cc index f0b3ba19d93ab..99896ad7e38d0 100644 --- a/shell/common/surface.cc +++ b/shell/common/surface.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -64,4 +64,12 @@ Surface::Surface() = default; Surface::~Surface() = default; +flow::ExternalViewEmbedder* Surface::GetExternalViewEmbedder() { + return nullptr; +} + +bool Surface::MakeRenderContextCurrent() { + return true; +} + } // namespace shell diff --git a/shell/common/surface.h b/shell/common/surface.h index beef9765da490..97450feaa211e 100644 --- a/shell/common/surface.h +++ b/shell/common/surface.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,7 @@ #include #include "flutter/flow/compositor_context.h" +#include "flutter/flow/embedded_views.h" #include "flutter/fml/macros.h" #include "third_party/skia/include/core/SkCanvas.h" @@ -55,6 +56,10 @@ class Surface { virtual GrContext* GetContext() = 0; + virtual flow::ExternalViewEmbedder* GetExternalViewEmbedder(); + + virtual bool MakeRenderContextCurrent(); + private: FML_DISALLOW_COPY_AND_ASSIGN(Surface); }; diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 98f0bb353015f..d2b4d56eb2070 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/common/switches.h b/shell/common/switches.h index bf23d06175cd1..bbaa5b4760ad1 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/common/thread_host.cc b/shell/common/thread_host.cc index f35594829d5d9..d8a2a73006eb4 100644 --- a/shell/common/thread_host.cc +++ b/shell/common/thread_host.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,8 @@ namespace shell { ThreadHost::ThreadHost() = default; +ThreadHost::ThreadHost(ThreadHost&&) = default; + ThreadHost::ThreadHost(std::string name_prefix, uint64_t mask) { if (mask & ThreadHost::Type::Platform) { platform_thread = std::make_unique(name_prefix + ".platform"); diff --git a/shell/common/thread_host.h b/shell/common/thread_host.h index 4fbe0f130910d..9e09603095644 100644 --- a/shell/common/thread_host.h +++ b/shell/common/thread_host.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -27,7 +27,7 @@ struct ThreadHost { ThreadHost(); - ThreadHost(ThreadHost&&) = default; + ThreadHost(ThreadHost&&); ThreadHost& operator=(ThreadHost&&) = default; diff --git a/shell/common/vsync_waiter.cc b/shell/common/vsync_waiter.cc index 1629db908a685..eee6b54193d33 100644 --- a/shell/common/vsync_waiter.cc +++ b/shell/common/vsync_waiter.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/common/vsync_waiter.h b/shell/common/vsync_waiter.h index a787e3554f993..0e3012c2de95e 100644 --- a/shell/common/vsync_waiter.h +++ b/shell/common/vsync_waiter.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/common/vsync_waiter_fallback.cc b/shell/common/vsync_waiter_fallback.cc index f8e091495e59d..a768380c4314b 100644 --- a/shell/common/vsync_waiter_fallback.cc +++ b/shell/common/vsync_waiter_fallback.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/common/vsync_waiter_fallback.h b/shell/common/vsync_waiter_fallback.h index 1289dd91bd532..92930ee192c61 100644 --- a/shell/common/vsync_waiter_fallback.h +++ b/shell/common/vsync_waiter_fallback.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/config.gni b/shell/config.gni index 0c31d3acd316f..3088b2cc6544a 100644 --- a/shell/config.gni +++ b/shell/config.gni @@ -1,4 +1,4 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/shell/gpu/BUILD.gn b/shell/gpu/BUILD.gn new file mode 100644 index 0000000000000..a886b0192c903 --- /dev/null +++ b/shell/gpu/BUILD.gn @@ -0,0 +1,46 @@ +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("$flutter_root/shell/config.gni") + +gpu_dir = "$flutter_root/shell/gpu" + +gpu_common_deps = [ + "$flutter_root/common", + "$flutter_root/flow", + "$flutter_root/fml", + "$flutter_root/shell/common", + "$flutter_root/synchronization", + "//third_party/skia", +] + +source_set("gpu_surface_software") { + sources = [ + "$gpu_dir/gpu_surface_software.cc", + "$gpu_dir/gpu_surface_software.h", + ] + + deps = gpu_common_deps +} + +source_set("gpu_surface_gl") { + sources = [ + "$gpu_dir/gpu_surface_gl.cc", + "$gpu_dir/gpu_surface_gl.h", + ] + + deps = gpu_common_deps + [ "//third_party/skia" ] +} + +source_set("gpu_surface_vulkan") { + sources = [ + "$gpu_dir/gpu_surface_vulkan.cc", + "$gpu_dir/gpu_surface_vulkan.h", + ] + + deps = gpu_common_deps + [ + "//third_party/skia", + "$flutter_root/vulkan", + ] +} diff --git a/shell/gpu/gpu.gni b/shell/gpu/gpu.gni index 48cb476017509..3a5771f47a178 100644 --- a/shell/gpu/gpu.gni +++ b/shell/gpu/gpu.gni @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -12,51 +12,19 @@ template("shell_gpu_configuration") { assert(defined(invoker.enable_gl), "Caller must declare if the Open GL backend must be enabled.") - source_set(target_name) { - # vulkan_backend_enabled = shell_enable_vulkan - # gl_backend_enabled = !is_fuchsia - # software_backend_enabled = true - - sources = [] - - gpu_dir = "$flutter_root/shell/gpu" + group(target_name) { + public_deps = [] if (invoker.enable_software) { - sources += [ - "$gpu_dir/gpu_surface_software.cc", - "$gpu_dir/gpu_surface_software.h", - ] + public_deps += [ "$flutter_root/shell/gpu:gpu_surface_software" ] } if (invoker.enable_gl) { - sources += [ - "$gpu_dir/gpu_surface_gl.cc", - "$gpu_dir/gpu_surface_gl.h", - ] - } - - if (invoker.enable_vulkan) { - sources += [ - "$gpu_dir/gpu_surface_vulkan.cc", - "$gpu_dir/gpu_surface_vulkan.h", - ] - } - - deps = [ - "$flutter_root/common", - "$flutter_root/flow", - "$flutter_root/fml", - "$flutter_root/shell/common", - "$flutter_root/synchronization", - "//third_party/skia", - ] - - if (invoker.enable_vulkan || invoker.enable_gl) { - deps += [ "//third_party/skia:gpu" ] + public_deps += [ "$flutter_root/shell/gpu:gpu_surface_gl" ] } if (invoker.enable_vulkan) { - deps += [ "$flutter_root/vulkan" ] + public_deps += [ "$flutter_root/shell/gpu:gpu_surface_vulkan" ] } } } diff --git a/shell/gpu/gpu_surface_gl.cc b/shell/gpu/gpu_surface_gl.cc index f55f972649e43..675e6d6f7cacf 100644 --- a/shell/gpu/gpu_surface_gl.cc +++ b/shell/gpu/gpu_surface_gl.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -22,10 +22,7 @@ #define GPU_GL_RGBA8 0x8058 #define GPU_GL_RGBA4 0x8056 #define GPU_GL_RGB565 0x8D62 - -#ifdef ERROR -#undef ERROR -#endif +#define GPU_GL_VERSION 0x1F02 namespace shell { @@ -36,6 +33,9 @@ static const int kGrCacheMaxCount = 8192; // cache. static const size_t kGrCacheMaxByteSize = 512 * (1 << 20); +// Version string prefix that identifies an OpenGL ES implementation. +static const char kGLESVersionPrefix[] = "OpenGL ES"; + GPUSurfaceGL::GPUSurfaceGL(GPUSurfaceGLDelegate* delegate) : delegate_(delegate), weak_factory_(this) { if (!delegate_->GLContextMakeCurrent()) { @@ -56,16 +56,28 @@ GPUSurfaceGL::GPUSurfaceGL(GPUSurfaceGLDelegate* delegate) // ES2 shading language when the ES3 external image extension is missing. options.fPreferExternalImagesOverES3 = true; - auto interface = - proc_resolver_ - ? GrGLMakeAssembledGLESInterface( - this /* context */, - [](void* context, const char gl_proc_name[]) -> GrGLFuncPtr { - return reinterpret_cast( - reinterpret_cast(context)->proc_resolver_( - gl_proc_name)); - }) - : GrGLMakeNativeInterface(); + // TODO(goderbauer): remove option when skbug.com/7523 is fixed. + // A similar work-around is also used in shell/common/io_manager.cc. + options.fDisableGpuYUVConversion = true; + + sk_sp interface; + + if (proc_resolver_ == nullptr) { + interface = GrGLMakeNativeInterface(); + } else { + auto gl_get_proc = [](void* context, + const char gl_proc_name[]) -> GrGLFuncPtr { + return reinterpret_cast( + reinterpret_cast(context)->proc_resolver_( + gl_proc_name)); + }; + + if (IsProcResolverOpenGLES()) { + interface = GrGLMakeAssembledGLESInterface(this, gl_get_proc); + } else { + interface = GrGLMakeAssembledGLInterface(this, gl_get_proc); + } + } auto context = GrContext::MakeGL(interface, options); @@ -81,6 +93,24 @@ GPUSurfaceGL::GPUSurfaceGL(GPUSurfaceGLDelegate* delegate) delegate_->GLContextClearCurrent(); valid_ = true; + context_owner_ = true; +} + +GPUSurfaceGL::GPUSurfaceGL(sk_sp gr_context, + GPUSurfaceGLDelegate* delegate) + : delegate_(delegate), context_(gr_context), weak_factory_(this) { + if (!delegate_->GLContextMakeCurrent()) { + FML_LOG(ERROR) + << "Could not make the context current to setup the gr context."; + return; + } + + proc_resolver_ = delegate_->GetGLProcResolver(); + + delegate_->GLContextClearCurrent(); + + valid_ = true; + context_owner_ = false; } GPUSurfaceGL::~GPUSurfaceGL() { @@ -95,12 +125,28 @@ GPUSurfaceGL::~GPUSurfaceGL() { } onscreen_surface_ = nullptr; - context_->releaseResourcesAndAbandonContext(); + if (context_owner_) { + context_->releaseResourcesAndAbandonContext(); + } context_ = nullptr; delegate_->GLContextClearCurrent(); } +bool GPUSurfaceGL::IsProcResolverOpenGLES() { + using GLGetStringProc = const char* (*)(uint32_t); + GLGetStringProc gl_get_string = + reinterpret_cast(proc_resolver_("glGetString")); + FML_CHECK(gl_get_string) + << "The GL proc resolver could not resolve glGetString"; + const char* gl_version_string = gl_get_string(GPU_GL_VERSION); + FML_CHECK(gl_version_string) + << "The GL proc resolver's glGetString(GL_VERSION) failed"; + + return strncmp(gl_version_string, kGLESVersionPrefix, + strlen(kGLESVersionPrefix)) == 0; +} + // |shell::Surface| bool GPUSurfaceGL::IsValid() { return valid_; @@ -258,8 +304,10 @@ bool GPUSurfaceGL::PresentSurface(SkCanvas* canvas) { if (offscreen_surface_ != nullptr) { TRACE_EVENT0("flutter", "CopyTextureOnscreen"); SkPaint paint; - onscreen_surface_->getCanvas()->drawImage( - offscreen_surface_->makeImageSnapshot(), 0, 0, &paint); + SkCanvas* onscreen_canvas = onscreen_surface_->getCanvas(); + onscreen_canvas->clear(SK_ColorTRANSPARENT); + onscreen_canvas->drawImage(offscreen_surface_->makeImageSnapshot(), 0, 0, + &paint); } { @@ -314,4 +362,37 @@ GrContext* GPUSurfaceGL::GetContext() { return context_.get(); } +// |shell::Surface| +flow::ExternalViewEmbedder* GPUSurfaceGL::GetExternalViewEmbedder() { + return delegate_->GetExternalViewEmbedder(); +} + +// |shell::Surface| +bool GPUSurfaceGL::MakeRenderContextCurrent() { + return delegate_->GLContextMakeCurrent(); +} + +bool GPUSurfaceGLDelegate::GLContextFBOResetAfterPresent() const { + return false; +} + +bool GPUSurfaceGLDelegate::UseOffscreenSurface() const { + return false; +} + +SkMatrix GPUSurfaceGLDelegate::GLContextSurfaceTransformation() const { + SkMatrix matrix; + matrix.setIdentity(); + return matrix; +} + +flow::ExternalViewEmbedder* GPUSurfaceGLDelegate::GetExternalViewEmbedder() { + return nullptr; +} + +GPUSurfaceGLDelegate::GLProcResolver GPUSurfaceGLDelegate::GetGLProcResolver() + const { + return nullptr; +} + } // namespace shell diff --git a/shell/gpu/gpu_surface_gl.h b/shell/gpu/gpu_surface_gl.h index f01317b9caec0..a268e6d28020f 100644 --- a/shell/gpu/gpu_surface_gl.h +++ b/shell/gpu/gpu_surface_gl.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,7 @@ #include #include +#include "flutter/flow/embedded_views.h" #include "flutter/fml/macros.h" #include "flutter/fml/memory/weak_ptr.h" #include "flutter/shell/common/surface.h" @@ -25,25 +26,26 @@ class GPUSurfaceGLDelegate { virtual intptr_t GLContextFBO() const = 0; - virtual bool GLContextFBOResetAfterPresent() const { return false; } + virtual bool GLContextFBOResetAfterPresent() const; - virtual bool UseOffscreenSurface() const { return false; } + virtual bool UseOffscreenSurface() const; - virtual SkMatrix GLContextSurfaceTransformation() const { - SkMatrix matrix; - matrix.setIdentity(); - return matrix; - } + virtual SkMatrix GLContextSurfaceTransformation() const; + + virtual flow::ExternalViewEmbedder* GetExternalViewEmbedder(); using GLProcResolver = std::function; - virtual GLProcResolver GetGLProcResolver() const { return nullptr; } + virtual GLProcResolver GetGLProcResolver() const; }; class GPUSurfaceGL : public Surface { public: GPUSurfaceGL(GPUSurfaceGLDelegate* delegate); + // Creates a new GL surface reusing an existing GrContext. + GPUSurfaceGL(sk_sp gr_context, GPUSurfaceGLDelegate* delegate); + ~GPUSurfaceGL() override; // |shell::Surface| @@ -58,6 +60,12 @@ class GPUSurfaceGL : public Surface { // |shell::Surface| GrContext* GetContext() override; + // |shell::Surface| + flow::ExternalViewEmbedder* GetExternalViewEmbedder() override; + + // |shell::Surface| + bool MakeRenderContextCurrent() override; + private: GPUSurfaceGLDelegate* delegate_; GPUSurfaceGLDelegate::GLProcResolver proc_resolver_; @@ -66,6 +74,7 @@ class GPUSurfaceGL : public Surface { sk_sp offscreen_surface_; bool valid_ = false; fml::WeakPtrFactory weak_factory_; + bool context_owner_; bool CreateOrUpdateSurfaces(const SkISize& size); @@ -75,6 +84,8 @@ class GPUSurfaceGL : public Surface { bool PresentSurface(SkCanvas* canvas); + bool IsProcResolverOpenGLES(); + FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceGL); }; diff --git a/shell/gpu/gpu_surface_software.cc b/shell/gpu/gpu_surface_software.cc index 7598aa243d33e..cea507c67bf01 100644 --- a/shell/gpu/gpu_surface_software.cc +++ b/shell/gpu/gpu_surface_software.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,6 +9,11 @@ namespace shell { +flow::ExternalViewEmbedder* +GPUSurfaceSoftwareDelegate::GetExternalViewEmbedder() { + return nullptr; +} + GPUSurfaceSoftware::GPUSurfaceSoftware(GPUSurfaceSoftwareDelegate* delegate) : delegate_(delegate), weak_factory_(this) {} @@ -75,4 +80,9 @@ GrContext* GPUSurfaceSoftware::GetContext() { return nullptr; } +// |shell::Surface| +flow::ExternalViewEmbedder* GPUSurfaceSoftware::GetExternalViewEmbedder() { + return delegate_->GetExternalViewEmbedder(); +} + } // namespace shell diff --git a/shell/gpu/gpu_surface_software.h b/shell/gpu/gpu_surface_software.h index 95940c4702454..eb64920a33630 100644 --- a/shell/gpu/gpu_surface_software.h +++ b/shell/gpu/gpu_surface_software.h @@ -1,10 +1,11 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_H_ #define FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_H_ +#include "flutter/flow/embedded_views.h" #include "flutter/fml/macros.h" #include "flutter/fml/memory/weak_ptr.h" #include "flutter/shell/common/surface.h" @@ -17,6 +18,8 @@ class GPUSurfaceSoftwareDelegate { virtual sk_sp AcquireBackingStore(const SkISize& size) = 0; virtual bool PresentBackingStore(sk_sp backing_store) = 0; + + virtual flow::ExternalViewEmbedder* GetExternalViewEmbedder(); }; class GPUSurfaceSoftware : public Surface { @@ -37,6 +40,9 @@ class GPUSurfaceSoftware : public Surface { // |shell::Surface| GrContext* GetContext() override; + // |shell::Surface| + flow::ExternalViewEmbedder* GetExternalViewEmbedder() override; + private: GPUSurfaceSoftwareDelegate* delegate_; fml::WeakPtrFactory weak_factory_; diff --git a/shell/gpu/gpu_surface_vulkan.cc b/shell/gpu/gpu_surface_vulkan.cc index 728fca6a0028e..3c42bf0876adc 100644 --- a/shell/gpu/gpu_surface_vulkan.cc +++ b/shell/gpu/gpu_surface_vulkan.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/gpu/gpu_surface_vulkan.h b/shell/gpu/gpu_surface_vulkan.h index fe4a34b814240..ece0cbb81b97c 100644 --- a/shell/gpu/gpu_surface_vulkan.h +++ b/shell/gpu/gpu_surface_vulkan.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/BUILD.gn b/shell/platform/BUILD.gn index ae3b1003f22fe..3a613d6b22b85 100644 --- a/shell/platform/BUILD.gn +++ b/shell/platform/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -15,8 +15,9 @@ group("platform") { deps = [ "embedder", ] - } else if (is_win) { - # There is no platform target on windows. Instead, only a tester is used. + } else if (is_win || is_fuchsia) { + # There is no platform target on Windows. Fuchsia has its own runner + # implementation. deps = [] } else { assert(false, "Unknown/Unsupported platform.") diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index 970b06e27c90d..eefe556a180d0 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -61,7 +61,6 @@ shared_library("flutter_shell_native") { "$flutter_root/runtime", "$flutter_root/shell/common", "//third_party/skia", - "//third_party/skia:gpu", ] if (flutter_runtime_mode == "debug" || flutter_runtime_mode == "dynamic_profile" || diff --git a/shell/platform/android/android_context_gl.cc b/shell/platform/android/android_context_gl.cc index b61f4ec7433c8..8ac43b4031a48 100644 --- a/shell/platform/android/android_context_gl.cc +++ b/shell/platform/android/android_context_gl.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/android_context_gl.h b/shell/platform/android/android_context_gl.h index 7b420211f34df..e29dc7ac4f69d 100644 --- a/shell/platform/android/android_context_gl.h +++ b/shell/platform/android/android_context_gl.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/android_environment_gl.cc b/shell/platform/android/android_environment_gl.cc index 0482367823672..3d9f919bb0110 100644 --- a/shell/platform/android/android_environment_gl.cc +++ b/shell/platform/android/android_environment_gl.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/android_environment_gl.h b/shell/platform/android/android_environment_gl.h index 3b9124e275de4..710064e75da12 100644 --- a/shell/platform/android/android_environment_gl.h +++ b/shell/platform/android/android_environment_gl.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/android_external_texture_gl.cc b/shell/platform/android/android_external_texture_gl.cc index f644376e5fdd4..c587becd60406 100644 --- a/shell/platform/android/android_external_texture_gl.cc +++ b/shell/platform/android/android_external_texture_gl.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/android_external_texture_gl.h b/shell/platform/android/android_external_texture_gl.h index b96eb33191f5d..09a56766e2a8f 100644 --- a/shell/platform/android/android_external_texture_gl.h +++ b/shell/platform/android/android_external_texture_gl.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,13 +19,11 @@ class AndroidExternalTextureGL : public flow::Texture { ~AndroidExternalTextureGL() override; - virtual void Paint(SkCanvas& canvas, - const SkRect& bounds, - bool freeze) override; + void Paint(SkCanvas& canvas, const SkRect& bounds, bool freeze) override; - virtual void OnGrContextCreated() override; + void OnGrContextCreated() override; - virtual void OnGrContextDestroyed() override; + void OnGrContextDestroyed() override; void MarkNewFrameAvailable() override; diff --git a/shell/platform/android/android_native_window.cc b/shell/platform/android/android_native_window.cc index d84e078857ac3..af8b179d1b094 100644 --- a/shell/platform/android/android_native_window.cc +++ b/shell/platform/android/android_native_window.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/android_native_window.h b/shell/platform/android/android_native_window.h index 3337ba228107c..04938c59630b8 100644 --- a/shell/platform/android/android_native_window.h +++ b/shell/platform/android/android_native_window.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/android_shell_holder.cc b/shell/platform/android/android_shell_holder.cc index f7df86addccc6..4c9a1ba076ba4 100644 --- a/shell/platform/android/android_shell_holder.cc +++ b/shell/platform/android/android_shell_holder.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/android_shell_holder.h b/shell/platform/android/android_shell_holder.h index e401816d3da7c..1fbca8a288f3c 100644 --- a/shell/platform/android/android_shell_holder.h +++ b/shell/platform/android/android_shell_holder.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/android_surface.cc b/shell/platform/android/android_surface.cc index a8b41bacbf7c5..cb1ee518ab941 100644 --- a/shell/platform/android/android_surface.cc +++ b/shell/platform/android/android_surface.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/android_surface.h b/shell/platform/android/android_surface.h index e0a413c1e0dc2..0ecc9ffc76bc1 100644 --- a/shell/platform/android/android_surface.h +++ b/shell/platform/android/android_surface.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/android_surface_gl.cc b/shell/platform/android/android_surface_gl.cc index 207d2631a0404..4e1ff9f41cd6f 100644 --- a/shell/platform/android/android_surface_gl.cc +++ b/shell/platform/android/android_surface_gl.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/android_surface_gl.h b/shell/platform/android/android_surface_gl.h index 5562523799096..11badede13e6c 100644 --- a/shell/platform/android/android_surface_gl.h +++ b/shell/platform/android/android_surface_gl.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/android_surface_software.cc b/shell/platform/android/android_surface_software.cc index a577ade5c91fb..475c1de26e48a 100644 --- a/shell/platform/android/android_surface_software.cc +++ b/shell/platform/android/android_surface_software.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/android_surface_software.h b/shell/platform/android/android_surface_software.h index 6301515ca4254..c7410642cb22d 100644 --- a/shell/platform/android/android_surface_software.h +++ b/shell/platform/android/android_surface_software.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/android_surface_vulkan.cc b/shell/platform/android/android_surface_vulkan.cc index 05848f042715c..7753a42081550 100644 --- a/shell/platform/android/android_surface_vulkan.cc +++ b/shell/platform/android/android_surface_vulkan.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/android_surface_vulkan.h b/shell/platform/android/android_surface_vulkan.h index 3bec57febc502..ef6eec003a431 100644 --- a/shell/platform/android/android_surface_vulkan.h +++ b/shell/platform/android/android_surface_vulkan.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/apk_asset_provider.h b/shell/platform/android/apk_asset_provider.h index e425ad205c575..be41a685ebfeb 100644 --- a/shell/platform/android/apk_asset_provider.h +++ b/shell/platform/android/apk_asset_provider.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,7 +19,7 @@ class APKAssetProvider final : public AssetResolver { explicit APKAssetProvider(JNIEnv* env, jobject assetManager, std::string directory); - virtual ~APKAssetProvider(); + ~APKAssetProvider() override; private: fml::jni::ScopedJavaGlobalRef java_asset_manager_; diff --git a/shell/platform/android/flutter_main.cc b/shell/platform/android/flutter_main.cc index 6311ed72a2b2a..bfbc4c1ce44e6 100644 --- a/shell/platform/android/flutter_main.cc +++ b/shell/platform/android/flutter_main.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/flutter_main.h b/shell/platform/android/flutter_main.h index 7d738a15b9c7f..4ce8e49658662 100644 --- a/shell/platform/android/flutter_main.h +++ b/shell/platform/android/flutter_main.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/app/FlutterActivity.java b/shell/platform/android/io/flutter/app/FlutterActivity.java index 9751ef4a009ec..33c7e75d1772d 100644 --- a/shell/platform/android/io/flutter/app/FlutterActivity.java +++ b/shell/platform/android/io/flutter/app/FlutterActivity.java @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -109,7 +109,7 @@ public void onBackPressed() { super.onBackPressed(); } } - + @Override protected void onStop() { eventDelegate.onStop(); diff --git a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java index 5c5c367723272..dad63b9e1a8e5 100644 --- a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java +++ b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/app/FlutterActivityEvents.java b/shell/platform/android/io/flutter/app/FlutterActivityEvents.java index a9a51d7a7bfcb..69e783f59db19 100644 --- a/shell/platform/android/io/flutter/app/FlutterActivityEvents.java +++ b/shell/platform/android/io/flutter/app/FlutterActivityEvents.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -63,7 +63,7 @@ public interface FlutterActivityEvents * @see android.app.Activity#onStop() */ void onStop(); - + /** * Invoked when the activity has detected the user's press of the back key. * diff --git a/shell/platform/android/io/flutter/app/FlutterApplication.java b/shell/platform/android/io/flutter/app/FlutterApplication.java index d25d68eda35f9..5ac61fd449f1f 100644 --- a/shell/platform/android/io/flutter/app/FlutterApplication.java +++ b/shell/platform/android/io/flutter/app/FlutterApplication.java @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/app/FlutterFragmentActivity.java b/shell/platform/android/io/flutter/app/FlutterFragmentActivity.java index 1ecd8857666bd..b483ae9fd1e96 100644 --- a/shell/platform/android/io/flutter/app/FlutterFragmentActivity.java +++ b/shell/platform/android/io/flutter/app/FlutterFragmentActivity.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java b/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java index 4a8617ff2f3a6..02452620d9418 100644 --- a/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java +++ b/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java b/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java index 9fc889a99e625..04f9f434ae235 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java b/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java index c77b2f275580c..3a2e13ea911b3 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/android/FlutterView.java index dbd66702075f9..93ca69c9c37b7 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/embedding/engine/Flutter b/shell/platform/android/io/flutter/embedding/engine/Flutter deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java b/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java index f956b4ee1003b..b2d22f7ae76ff 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java @@ -1,3 +1,7 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + package io.flutter.embedding.engine; import android.content.Context; diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java index 255d385a8f2e6..fe3600775ca52 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java @@ -1,3 +1,7 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + package io.flutter.embedding.engine; import android.content.res.AssetManager; diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java b/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java index 4b8e8408a24e8..1f37cff1e6a50 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java b/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java index 1facef3588e3c..f89d04b9aca44 100644 --- a/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java +++ b/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java @@ -1,3 +1,7 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + package io.flutter.embedding.engine.dart; import android.content.res.Resources; diff --git a/shell/platform/android/io/flutter/embedding/engine/dart/PlatformMessageHandler.java b/shell/platform/android/io/flutter/embedding/engine/dart/PlatformMessageHandler.java index cdf7cc5163477..0ab5178c423fd 100644 --- a/shell/platform/android/io/flutter/embedding/engine/dart/PlatformMessageHandler.java +++ b/shell/platform/android/io/flutter/embedding/engine/dart/PlatformMessageHandler.java @@ -1,3 +1,7 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + package io.flutter.embedding.engine.dart; public interface PlatformMessageHandler { diff --git a/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java b/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java index 96af8aa187359..a9b548f1535b7 100644 --- a/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java +++ b/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java @@ -1,3 +1,7 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + package io.flutter.embedding.engine.renderer; import android.annotation.TargetApi; diff --git a/shell/platform/android/io/flutter/embedding/engine/renderer/OnFirstFrameRenderedListener.java b/shell/platform/android/io/flutter/embedding/engine/renderer/OnFirstFrameRenderedListener.java index 874a5e4580965..044b244dcad2c 100644 --- a/shell/platform/android/io/flutter/embedding/engine/renderer/OnFirstFrameRenderedListener.java +++ b/shell/platform/android/io/flutter/embedding/engine/renderer/OnFirstFrameRenderedListener.java @@ -1,3 +1,7 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + package io.flutter.embedding.engine.renderer; public interface OnFirstFrameRenderedListener { diff --git a/shell/platform/android/io/flutter/embedding/legacy/AccessibilityBridge.java b/shell/platform/android/io/flutter/embedding/legacy/AccessibilityBridge.java index f497f61ef0d20..c91fe00a3c964 100644 --- a/shell/platform/android/io/flutter/embedding/legacy/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/embedding/legacy/AccessibilityBridge.java @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/embedding/legacy/FlutterPluginRegistry.java b/shell/platform/android/io/flutter/embedding/legacy/FlutterPluginRegistry.java index 922ec2c16bfb2..7b1bf081ea6b8 100644 --- a/shell/platform/android/io/flutter/embedding/legacy/FlutterPluginRegistry.java +++ b/shell/platform/android/io/flutter/embedding/legacy/FlutterPluginRegistry.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/embedding/legacy/InputConnectionAdaptor.java b/shell/platform/android/io/flutter/embedding/legacy/InputConnectionAdaptor.java index 695f20e6b91da..e56836dc0c15a 100644 --- a/shell/platform/android/io/flutter/embedding/legacy/InputConnectionAdaptor.java +++ b/shell/platform/android/io/flutter/embedding/legacy/InputConnectionAdaptor.java @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/embedding/legacy/PluginRegistry.java b/shell/platform/android/io/flutter/embedding/legacy/PluginRegistry.java index 95c40007049a3..608263b600fff 100644 --- a/shell/platform/android/io/flutter/embedding/legacy/PluginRegistry.java +++ b/shell/platform/android/io/flutter/embedding/legacy/PluginRegistry.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/embedding/legacy/TextInputPlugin.java b/shell/platform/android/io/flutter/embedding/legacy/TextInputPlugin.java index 12a798a48d99c..4d5acc3dad964 100644 --- a/shell/platform/android/io/flutter/embedding/legacy/TextInputPlugin.java +++ b/shell/platform/android/io/flutter/embedding/legacy/TextInputPlugin.java @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/common/ActivityLifecycleListener.java b/shell/platform/android/io/flutter/plugin/common/ActivityLifecycleListener.java index 5c27bd9613f45..beb51ecb54aca 100644 --- a/shell/platform/android/io/flutter/plugin/common/ActivityLifecycleListener.java +++ b/shell/platform/android/io/flutter/plugin/common/ActivityLifecycleListener.java @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/common/BasicMessageChannel.java b/shell/platform/android/io/flutter/plugin/common/BasicMessageChannel.java index 3e7a285793a54..74a193880eb31 100644 --- a/shell/platform/android/io/flutter/plugin/common/BasicMessageChannel.java +++ b/shell/platform/android/io/flutter/plugin/common/BasicMessageChannel.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/common/BinaryCodec.java b/shell/platform/android/io/flutter/plugin/common/BinaryCodec.java index 6514dc21b1148..2cc407ebba847 100644 --- a/shell/platform/android/io/flutter/plugin/common/BinaryCodec.java +++ b/shell/platform/android/io/flutter/plugin/common/BinaryCodec.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/common/BinaryMessenger.java b/shell/platform/android/io/flutter/plugin/common/BinaryMessenger.java index b382aba0b44fb..c8f54e9e88f2b 100644 --- a/shell/platform/android/io/flutter/plugin/common/BinaryMessenger.java +++ b/shell/platform/android/io/flutter/plugin/common/BinaryMessenger.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/common/EventChannel.java b/shell/platform/android/io/flutter/plugin/common/EventChannel.java index 8b9c1cbe7881b..57443a0aa1816 100644 --- a/shell/platform/android/io/flutter/plugin/common/EventChannel.java +++ b/shell/platform/android/io/flutter/plugin/common/EventChannel.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/common/FlutterException.java b/shell/platform/android/io/flutter/plugin/common/FlutterException.java index 72d1b9029d901..61eb12c13c11b 100644 --- a/shell/platform/android/io/flutter/plugin/common/FlutterException.java +++ b/shell/platform/android/io/flutter/plugin/common/FlutterException.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,7 +10,7 @@ public class FlutterException extends RuntimeException { public final String code; public final Object details; - + FlutterException(String code, String message, Object details) { super(message); assert code != null; diff --git a/shell/platform/android/io/flutter/plugin/common/JSONMessageCodec.java b/shell/platform/android/io/flutter/plugin/common/JSONMessageCodec.java index 85d14fcc290ee..6b2b88d0d0a23 100644 --- a/shell/platform/android/io/flutter/plugin/common/JSONMessageCodec.java +++ b/shell/platform/android/io/flutter/plugin/common/JSONMessageCodec.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/common/JSONMethodCodec.java b/shell/platform/android/io/flutter/plugin/common/JSONMethodCodec.java index 78c09a9d4935b..c87771d66a01e 100644 --- a/shell/platform/android/io/flutter/plugin/common/JSONMethodCodec.java +++ b/shell/platform/android/io/flutter/plugin/common/JSONMethodCodec.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/common/MessageCodec.java b/shell/platform/android/io/flutter/plugin/common/MessageCodec.java index 125186f213017..a1a0590df476c 100644 --- a/shell/platform/android/io/flutter/plugin/common/MessageCodec.java +++ b/shell/platform/android/io/flutter/plugin/common/MessageCodec.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/common/MethodCall.java b/shell/platform/android/io/flutter/plugin/common/MethodCall.java index b30ac2eef319a..9206ba5ecee25 100644 --- a/shell/platform/android/io/flutter/plugin/common/MethodCall.java +++ b/shell/platform/android/io/flutter/plugin/common/MethodCall.java @@ -1,9 +1,10 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package io.flutter.plugin.common; +import android.support.annotation.Nullable; import java.util.Map; import org.json.JSONObject; @@ -61,6 +62,7 @@ public T arguments() { * {@link JSONObject}. */ @SuppressWarnings("unchecked") + @Nullable public T argument(String key) { if (arguments == null) { return null; diff --git a/shell/platform/android/io/flutter/plugin/common/MethodChannel.java b/shell/platform/android/io/flutter/plugin/common/MethodChannel.java index 991cf05e7129c..d16671bc1c91e 100644 --- a/shell/platform/android/io/flutter/plugin/common/MethodChannel.java +++ b/shell/platform/android/io/flutter/plugin/common/MethodChannel.java @@ -1,9 +1,10 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package io.flutter.plugin.common; +import android.support.annotation.Nullable; import android.util.Log; import io.flutter.plugin.common.BinaryMessenger.BinaryMessageHandler; import io.flutter.plugin.common.BinaryMessenger.BinaryReply; @@ -65,7 +66,7 @@ public MethodChannel(BinaryMessenger messenger, String name, MethodCodec codec) * @param method the name String of the method. * @param arguments the arguments for the invocation, possibly null. */ - public void invokeMethod(String method, Object arguments) { + public void invokeMethod(String method, @Nullable Object arguments) { invokeMethod(method, arguments, null); } @@ -78,7 +79,7 @@ public void invokeMethod(String method, Object arguments) { * @param arguments the arguments for the invocation, possibly null. * @param callback a {@link Result} callback for the invocation result, or null. */ - public void invokeMethod(String method, Object arguments, Result callback) { + public void invokeMethod(String method, @Nullable Object arguments, Result callback) { messenger.send(name, codec.encodeMethodCall(new MethodCall(method, arguments)), callback == null ? null : new IncomingResultHandler(callback)); } @@ -97,7 +98,7 @@ public void invokeMethod(String method, Object arguments, Result callback) { * * @param handler a {@link MethodCallHandler}, or null to deregister. */ - public void setMethodCallHandler(final MethodCallHandler handler) { + public void setMethodCallHandler(final @Nullable MethodCallHandler handler) { messenger.setMessageHandler(name, handler == null ? null : new IncomingMethodCallHandler(handler)); } @@ -143,7 +144,7 @@ public interface Result { * * @param result The result, possibly null. */ - void success(Object result); + void success(@Nullable Object result); /** * Handles an error result. @@ -152,7 +153,7 @@ public interface Result { * @param errorMessage A human-readable error message String, possibly null. * @param errorDetails Error details, possibly null */ - void error(String errorCode, String errorMessage, Object errorDetails); + void error(String errorCode, @Nullable String errorMessage, @Nullable Object errorDetails); /** * Handles a call to an unimplemented method. diff --git a/shell/platform/android/io/flutter/plugin/common/MethodCodec.java b/shell/platform/android/io/flutter/plugin/common/MethodCodec.java index d4e7307230913..49e058ae7efca 100644 --- a/shell/platform/android/io/flutter/plugin/common/MethodCodec.java +++ b/shell/platform/android/io/flutter/plugin/common/MethodCodec.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java b/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java index 4fd8a4def4368..33f30b300a8c8 100644 --- a/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java +++ b/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java b/shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java index db769b0482aef..63d63b2a2e236 100644 --- a/shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java +++ b/shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/common/StandardMethodCodec.java b/shell/platform/android/io/flutter/plugin/common/StandardMethodCodec.java index 1284c11390e09..132f075f798e6 100644 --- a/shell/platform/android/io/flutter/plugin/common/StandardMethodCodec.java +++ b/shell/platform/android/io/flutter/plugin/common/StandardMethodCodec.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/common/StringCodec.java b/shell/platform/android/io/flutter/plugin/common/StringCodec.java index 9851cf4ccf60c..18f6a102df31c 100644 --- a/shell/platform/android/io/flutter/plugin/common/StringCodec.java +++ b/shell/platform/android/io/flutter/plugin/common/StringCodec.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java b/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java index ae3a1381e230a..e169d6ff6b080 100644 --- a/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java +++ b/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java b/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java index 220776b35140a..cd7282f87b968 100644 --- a/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java +++ b/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java b/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java index 4396782279413..0722406645d5c 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformView.java b/shell/platform/android/io/flutter/plugin/platform/PlatformView.java index 6e379e96a6ba0..36240f0cc3805 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformView.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformView.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformViewFactory.java b/shell/platform/android/io/flutter/plugin/platform/PlatformViewFactory.java index f6fcd35b9c55f..e47f6e854ee82 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformViewFactory.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformViewFactory.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformViewRegistry.java b/shell/platform/android/io/flutter/plugin/platform/PlatformViewRegistry.java index 0a45ab7a65b59..9b48d76799512 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformViewRegistry.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformViewRegistry.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformViewRegistryImpl.java b/shell/platform/android/io/flutter/plugin/platform/PlatformViewRegistryImpl.java index ea1b02c4785ab..5c303034c764f 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformViewRegistryImpl.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformViewRegistryImpl.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java index 41b95dc5c7a2c..e7297567e198c 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -179,7 +179,7 @@ private void createPlatformView(MethodCall call, MethodChannel.Result result) { VirtualDisplayController vdController = VirtualDisplayController.create( mContext, viewFactory, - textureEntry.surfaceTexture(), + textureEntry, toPhysicalPixels(logicalWidth), toPhysicalPixels(logicalHeight), id, diff --git a/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java b/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java index 733f38819ea2e..24675bbbf8a28 100644 --- a/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java +++ b/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -232,7 +232,8 @@ private WindowManager getWindowManager() { * (see: https://github.com/flutter/flutter/issues/20714). This was triggered when selecting text in an embedded * WebView (as the selection handles are implemented as popup windows). * - * This dynamic proxy overrides the addView, removeView, and updateViewLayout methods to prevent these crashes. + * This dynamic proxy overrides the addView, removeView, removeViewImmediate, and updateViewLayout methods + * to prevent these crashes. * * This will be more efficient as a static proxy that's not using reflection, but as the engine is currently * not being built against the latest Android SDK we cannot override all relevant method. @@ -266,6 +267,9 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl case "removeView": removeView(args); return null; + case "removeViewImmediate": + removeViewImmediate(args); + return null; case "updateViewLayout": updateViewLayout(args); return null; @@ -296,6 +300,16 @@ private void removeView(Object[] args) { mFakeWindowRootView.removeView(view); } + private void removeViewImmediate(Object[] args) { + if (mFakeWindowRootView == null) { + Log.w(TAG, "Embedded view called removeViewImmediate while detached from presentation"); + return; + } + View view = (View) args[0]; + view.clearAnimation(); + mFakeWindowRootView.removeView(view); + } + private void updateViewLayout(Object[] args) { if (mFakeWindowRootView == null) { Log.w(TAG, "Embedded view called updateViewLayout while detached from presentation"); diff --git a/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java b/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java index 4495b7388b016..9985361762bcd 100644 --- a/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java +++ b/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,13 +6,13 @@ import android.annotation.TargetApi; import android.content.Context; -import android.graphics.SurfaceTexture; import android.hardware.display.DisplayManager; import android.hardware.display.VirtualDisplay; import android.os.Build; import android.view.Surface; import android.view.View; import android.view.ViewTreeObserver; +import io.flutter.view.TextureRegistry; @TargetApi(Build.VERSION_CODES.KITKAT_WATCH) class VirtualDisplayController { @@ -20,14 +20,14 @@ class VirtualDisplayController { public static VirtualDisplayController create( Context context, PlatformViewFactory viewFactory, - SurfaceTexture surfaceTexture, + TextureRegistry.SurfaceTextureEntry textureEntry, int width, int height, int viewId, Object createParams ) { - surfaceTexture.setDefaultBufferSize(width, height); - Surface surface = new Surface(surfaceTexture); + textureEntry.surfaceTexture().setDefaultBufferSize(width, height); + Surface surface = new Surface(textureEntry.surfaceTexture()); DisplayManager displayManager = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE); int densityDpi = context.getResources().getDisplayMetrics().densityDpi; @@ -45,12 +45,12 @@ public static VirtualDisplayController create( } return new VirtualDisplayController( - context, virtualDisplay, viewFactory, surface, surfaceTexture, viewId, createParams); + context, virtualDisplay, viewFactory, surface, textureEntry, viewId, createParams); } private final Context mContext; private final int mDensityDpi; - private final SurfaceTexture mSurfaceTexture; + private final TextureRegistry.SurfaceTextureEntry mTextureEntry; private VirtualDisplay mVirtualDisplay; private SingleViewPresentation mPresentation; private Surface mSurface; @@ -61,11 +61,11 @@ private VirtualDisplayController( VirtualDisplay virtualDisplay, PlatformViewFactory viewFactory, Surface surface, - SurfaceTexture surfaceTexture, + TextureRegistry.SurfaceTextureEntry textureEntry, int viewId, Object createParams ) { - mSurfaceTexture = surfaceTexture; + mTextureEntry = textureEntry; mSurface = surface; mContext = context; mVirtualDisplay = virtualDisplay; @@ -85,7 +85,7 @@ public void resize(final int width, final int height, final Runnable onNewSizeFr mVirtualDisplay.setSurface(null); mVirtualDisplay.release(); - mSurfaceTexture.setDefaultBufferSize(width, height); + mTextureEntry.surfaceTexture().setDefaultBufferSize(width, height); DisplayManager displayManager = (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE); mVirtualDisplay = displayManager.createVirtualDisplay( "flutter-vd", @@ -130,6 +130,7 @@ public void dispose() { mPresentation.detachState(); view.dispose(); mVirtualDisplay.release(); + mTextureEntry.release(); } public View getView() { diff --git a/shell/platform/android/io/flutter/util/PathUtils.java b/shell/platform/android/io/flutter/util/PathUtils.java index df187cbc0c1ec..94cf131916af2 100644 --- a/shell/platform/android/io/flutter/util/PathUtils.java +++ b/shell/platform/android/io/flutter/util/PathUtils.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/util/Preconditions.java b/shell/platform/android/io/flutter/util/Preconditions.java index cf39129d32910..968d2cb18e5f3 100644 --- a/shell/platform/android/io/flutter/util/Preconditions.java +++ b/shell/platform/android/io/flutter/util/Preconditions.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index a15410e01aa2e..4fc808e9eea5f 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -1,11 +1,10 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package io.flutter.view; import android.app.Activity; -import android.content.Context; import android.graphics.Rect; import android.opengl.Matrix; import android.os.Build; @@ -145,7 +144,9 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(mOwner, virtualViewId); // Work around for https://github.com/flutter/flutter/issues/2101 - result.setViewIdResourceName(""); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { + result.setViewIdResourceName(""); + } result.setPackageName(mOwner.getContext().getPackageName()); result.setClassName("android.view.View"); result.setSource(mOwner, virtualViewId); @@ -166,10 +167,10 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (object.textSelectionBase != -1 && object.textSelectionExtent != -1) { result.setTextSelection(object.textSelectionBase, object.textSelectionExtent); } - // Text fields will always be created as a live region, so that updates to - // the label trigger polite announcements. This makes it easy to follow a11y - // guidelines for text fields on Android. - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) { + // Text fields will always be created as a live region when they have input focus, + // so that updates to the label trigger polite announcements. This makes it easy to + // follow a11y guidelines for text fields on Android. + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2 && mA11yFocusedObject != null && mA11yFocusedObject.id == virtualViewId) { result.setLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE); } } @@ -215,7 +216,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { // TODO(jonahwilliams): Figure out a way conform to the expected id from TalkBack's // CustomLabelManager. talkback/src/main/java/labeling/CustomLabelManager.java#L525 } - if (object.hasAction(Action.DISMISS)) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2 && object.hasAction(Action.DISMISS)) { result.setDismissable(true); result.addAction(AccessibilityNodeInfo.ACTION_DISMISS); } @@ -598,8 +599,6 @@ void handleTouchExploration(float x, float y) { } void updateCustomAccessibilityActions(ByteBuffer buffer, String[] strings) { - ArrayList updatedActions = - new ArrayList(); while (buffer.hasRemaining()) { int id = buffer.getInt(); CustomAccessibilityAction action = getOrCreateAction(id); @@ -727,13 +726,20 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { // handle hidden children at the beginning and end of the list. for (SemanticsObject child : object.childrenInHitTestOrder) { if (!child.hasFlag(Flag.IS_HIDDEN)) { - break; + visibleChildren += 1; } - visibleChildren += 1; } assert(object.scrollIndex + visibleChildren <= object.scrollChildren); assert(!object.childrenInHitTestOrder.get(object.scrollIndex).hasFlag(Flag.IS_HIDDEN)); - event.setToIndex(object.scrollIndex + visibleChildren); + // The setToIndex should be the index of the last visible child. Because we counted all + // children, including the first index we need to subtract one. + // + // [0, 1, 2, 3, 4, 5] + // ^ ^ + // In the example above where 0 is the first visible index and 2 is the last, we will + // count 3 total visible children. We then subtract one to get the correct last visible + // index of 2. + event.setToIndex(object.scrollIndex + visibleChildren - 1); } sendAccessibilityEvent(event); } @@ -757,7 +763,12 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { sendAccessibilityEvent(event); } if (mInputFocusedObject != null && mInputFocusedObject.id == object.id - && object.hadFlag(Flag.IS_TEXT_FIELD) && object.hasFlag(Flag.IS_TEXT_FIELD)) { + && object.hadFlag(Flag.IS_TEXT_FIELD) && object.hasFlag(Flag.IS_TEXT_FIELD) + // If we have a TextField that has InputFocus, we should avoid announcing it if something + // else we track has a11y focus. This needs to still work when, e.g., IME has a11y focus + // or the "PASTE" popup is used though. + // See more discussion at https://github.com/flutter/flutter/issues/23180 + && (mA11yFocusedObject == null || (mA11yFocusedObject.id == mInputFocusedObject.id))) { String oldValue = object.previousValue != null ? object.previousValue : ""; String newValue = object.value != null ? object.value : ""; AccessibilityEvent event = createTextChangedEvent(object.id, oldValue, newValue); diff --git a/shell/platform/android/io/flutter/view/FlutterCallbackInformation.java b/shell/platform/android/io/flutter/view/FlutterCallbackInformation.java index 20006dd60547c..f6157a0f31d1a 100644 --- a/shell/platform/android/io/flutter/view/FlutterCallbackInformation.java +++ b/shell/platform/android/io/flutter/view/FlutterCallbackInformation.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/view/FlutterMain.java b/shell/platform/android/io/flutter/view/FlutterMain.java index f030d61ad2679..6e5f80a800c96 100644 --- a/shell/platform/android/io/flutter/view/FlutterMain.java +++ b/shell/platform/android/io/flutter/view/FlutterMain.java @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/view/FlutterNativeView.java b/shell/platform/android/io/flutter/view/FlutterNativeView.java index da47794609c8d..71c1dcf3e4960 100644 --- a/shell/platform/android/io/flutter/view/FlutterNativeView.java +++ b/shell/platform/android/io/flutter/view/FlutterNativeView.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -222,20 +222,25 @@ public void handlePlatformMessageResponse(int replyId, byte[] reply) { private final class RenderSurfaceImpl implements RenderSurface { // Called by native to update the semantics/accessibility tree. public void updateSemantics(ByteBuffer buffer, String[] strings) { - if (mFlutterView == null) return; + if (mFlutterView == null) { + return; + } mFlutterView.updateSemantics(buffer, strings); } // Called by native to update the custom accessibility actions. public void updateCustomAccessibilityActions(ByteBuffer buffer, String[] strings) { - if (mFlutterView == null) + if (mFlutterView == null) { return; + } mFlutterView.updateCustomAccessibilityActions(buffer, strings); } // Called by native to notify first Flutter frame rendered. public void onFirstFrameRendered() { - if (mFlutterView == null) return; + if (mFlutterView == null) { + return; + } mFlutterView.onFirstFrame(); } @@ -248,8 +253,12 @@ private final class EngineHandlerImpl implements EngineHandler { // Called by native to notify when the engine is restarted (cold reload). @SuppressWarnings("unused") public void onPreEngineRestart() { - if (mPluginRegistry == null) + if (mFlutterView != null) { + mFlutterView.resetAccessibilityTree(); + } + if (mPluginRegistry == null) { return; + } mPluginRegistry.onPreEngineRestart(); } } diff --git a/shell/platform/android/io/flutter/view/FlutterRunArguments.java b/shell/platform/android/io/flutter/view/FlutterRunArguments.java index f322cb8d24db5..04e13afbb5872 100644 --- a/shell/platform/android/io/flutter/view/FlutterRunArguments.java +++ b/shell/platform/android/io/flutter/view/FlutterRunArguments.java @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 6ca4aea766b70..80cfc90981eaf 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -1,29 +1,24 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package io.flutter.view; import android.app.Activity; -import android.content.BroadcastReceiver; import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.pm.ApplicationInfo; import android.content.res.Configuration; import android.database.ContentObserver; -import android.graphics.PixelFormat; -import android.provider.Settings; -import android.net.Uri; -import android.os.Handler; import android.graphics.Bitmap; +import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.SurfaceTexture; +import android.net.Uri; import android.os.Build; +import android.os.Handler; +import android.provider.Settings; import android.text.format.DateFormat; import android.util.AttributeSet; import android.util.Log; -import android.util.TypedValue; import android.view.*; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeProvider; @@ -36,9 +31,8 @@ import io.flutter.plugin.editing.TextInputPlugin; import io.flutter.plugin.platform.PlatformPlugin; import org.json.JSONException; -import org.json.JSONObject; -import java.net.URI; +import java.lang.reflect.Method; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.*; @@ -171,7 +165,8 @@ public void surfaceDestroyed(SurfaceHolder holder) { mImm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); mTextInputPlugin = new TextInputPlugin(this); - setLocale(getResources().getConfiguration().locale); + + setLocales(getResources().getConfiguration()); setUserSettings(); } @@ -317,14 +312,39 @@ private void setUserSettings() { mFlutterSettingsChannel.send(message); } - private void setLocale(Locale locale) { - mFlutterLocalizationChannel.invokeMethod("setLocale", Arrays.asList(locale.getLanguage(), locale.getCountry())); + private void setLocales(Configuration config) { + if (Build.VERSION.SDK_INT >= 24) { + try { + // Passes the full list of locales for android API >= 24 with reflection. + Object localeList = config.getClass().getDeclaredMethod("getLocales").invoke(config); + Method localeListGet = localeList.getClass().getDeclaredMethod("get", int.class); + Method localeListSize = localeList.getClass().getDeclaredMethod("size"); + int localeCount = (int)localeListSize.invoke(localeList); + List data = new ArrayList(); + for (int index = 0; index < localeCount; ++index) { + Locale locale = (Locale)localeListGet.invoke(localeList, index); + data.add(locale.getLanguage()); + data.add(locale.getCountry()); + data.add(locale.getScript()); + data.add(locale.getVariant()); + } + mFlutterLocalizationChannel.invokeMethod("setLocale", data); + return; + } catch (Exception exception) { + // Any exception is a failure. Resort to fallback of sending only one locale. + } + } + // Fallback single locale passing for android API < 24. Should work always. + Locale locale = config.locale; + // getScript() is gated because it is added in API 21. + mFlutterLocalizationChannel.invokeMethod("setLocale", Arrays.asList(locale.getLanguage(), locale.getCountry(), Build.VERSION.SDK_INT >= 21 ? locale.getScript() : "", locale.getVariant())); + } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); - setLocale(newConfig.locale); + setLocales(newConfig); setUserSettings(); } @@ -421,8 +441,8 @@ private int getPointerDeviceTypeForToolType(int toolType) { } } - private void addPointerForIndex(MotionEvent event, int pointerIndex, ByteBuffer packet) { - int pointerChange = getPointerChangeForAction(event.getActionMasked()); + private void addPointerForIndex(MotionEvent event, int pointerIndex, int pointerChange, + int pointerData, ByteBuffer packet) { if (pointerChange == -1) { return; } @@ -462,6 +482,8 @@ private void addPointerForIndex(MotionEvent event, int pointerIndex, ByteBuffer packet.putDouble(0.0); // distance_max } + packet.putDouble(event.getSize(pointerIndex)); // size + packet.putDouble(event.getToolMajor(pointerIndex)); // radius_major packet.putDouble(event.getToolMinor(pointerIndex)); // radius_minor @@ -475,6 +497,8 @@ private void addPointerForIndex(MotionEvent event, int pointerIndex, ByteBuffer } else { packet.putDouble(0.0); // tilt } + + packet.putLong(pointerData); // platformData } @Override @@ -493,26 +517,44 @@ public boolean onTouchEvent(MotionEvent event) { } // These values must match the unpacking code in hooks.dart. - final int kPointerDataFieldCount = 19; + final int kPointerDataFieldCount = 21; final int kBytePerField = 8; + // This value must match the value in framework's platform_view.dart. + // This flag indicates whether the original Android pointer events were batched together. + final int kPointerDataFlagBatched = 1; + int pointerCount = event.getPointerCount(); ByteBuffer packet = ByteBuffer.allocateDirect(pointerCount * kPointerDataFieldCount * kBytePerField); packet.order(ByteOrder.LITTLE_ENDIAN); int maskedAction = event.getActionMasked(); - // ACTION_UP, ACTION_POINTER_UP, ACTION_DOWN, and ACTION_POINTER_DOWN - // only apply to a single pointer, other events apply to all pointers. - if (maskedAction == MotionEvent.ACTION_UP || maskedAction == MotionEvent.ACTION_POINTER_UP - || maskedAction == MotionEvent.ACTION_DOWN || maskedAction == MotionEvent.ACTION_POINTER_DOWN) { - addPointerForIndex(event, event.getActionIndex(), packet); + int pointerChange = getPointerChangeForAction(event.getActionMasked()); + if (maskedAction == MotionEvent.ACTION_DOWN || maskedAction == MotionEvent.ACTION_POINTER_DOWN) { + // ACTION_DOWN and ACTION_POINTER_DOWN always apply to a single pointer only. + addPointerForIndex(event, event.getActionIndex(), pointerChange, 0, packet); + } else if (maskedAction == MotionEvent.ACTION_UP || maskedAction == MotionEvent.ACTION_POINTER_UP) { + // ACTION_UP and ACTION_POINTER_UP may contain position updates for other pointers. + // We are converting these updates to move events here in order to preserve this data. + // We also mark these events with a flag in order to help the framework reassemble + // the original Android event later, should it need to forward it to a PlatformView. + for (int p = 0; p < pointerCount; p++) { + if (p != event.getActionIndex()) { + if (event.getToolType(p) == MotionEvent.TOOL_TYPE_FINGER) { + addPointerForIndex(event, p, kPointerChangeMove, kPointerDataFlagBatched, packet); + } + } + } + // It's important that we're sending the UP event last. This allows PlatformView + // to correctly batch everything back into the original Android event if needed. + addPointerForIndex(event, event.getActionIndex(), pointerChange, 0, packet); } else { // ACTION_MOVE may not actually mean all pointers have moved // but it's the responsibility of a later part of the system to // ignore 0-deltas if desired. for (int p = 0; p < pointerCount; p++) { - addPointerForIndex(event, p, packet); + addPointerForIndex(event, p, pointerChange, 0, packet); } } @@ -804,7 +846,9 @@ protected void onAttachedToWindow() { ensureAccessibilityEnabled(); } if (mTouchExplorationEnabled) { - mAccessibilityFeatureFlags ^= AccessibilityFeature.ACCESSIBLE_NAVIGATION.value; + mAccessibilityFeatureFlags |= AccessibilityFeature.ACCESSIBLE_NAVIGATION.value; + } else { + mAccessibilityFeatureFlags &= ~AccessibilityFeature.ACCESSIBLE_NAVIGATION.value; } // Apply additional accessibility settings updateAccessibilityFeatures(); @@ -823,7 +867,7 @@ private void updateAccessibilityFeatures() { String transitionAnimationScale = Settings.Global.getString(getContext().getContentResolver(), Settings.Global.TRANSITION_ANIMATION_SCALE); if (transitionAnimationScale != null && transitionAnimationScale.equals("0")) { - mAccessibilityFeatureFlags ^= AccessibilityFeature.DISABLE_ANIMATIONS.value; + mAccessibilityFeatureFlags |= AccessibilityFeature.DISABLE_ANIMATIONS.value; } else { mAccessibilityFeatureFlags &= ~AccessibilityFeature.DISABLE_ANIMATIONS.value; } @@ -892,8 +936,8 @@ public void onChange(boolean selfChange) { public void onChange(boolean selfChange, Uri uri) { String value = Settings.Global.getString(getContext().getContentResolver(), Settings.Global.TRANSITION_ANIMATION_SCALE); - if (value == "0") { - mAccessibilityFeatureFlags ^= AccessibilityFeature.DISABLE_ANIMATIONS.value; + if (value != null && value.equals("0")) { + mAccessibilityFeatureFlags |= AccessibilityFeature.DISABLE_ANIMATIONS.value; } else { mAccessibilityFeatureFlags &= ~AccessibilityFeature.DISABLE_ANIMATIONS.value; } @@ -907,7 +951,7 @@ public void onTouchExplorationStateChanged(boolean enabled) { if (enabled) { mTouchExplorationEnabled = true; ensureAccessibilityEnabled(); - mAccessibilityFeatureFlags ^= AccessibilityFeature.ACCESSIBLE_NAVIGATION.value; + mAccessibilityFeatureFlags |= AccessibilityFeature.ACCESSIBLE_NAVIGATION.value; mNativeView.getFlutterJNI().nativeSetAccessibilityFeatures(mNativeView.get(), mAccessibilityFeatureFlags); } else { mTouchExplorationEnabled = false; @@ -1010,24 +1054,33 @@ final class SurfaceTextureRegistryEntry implements TextureRegistry.SurfaceTextur SurfaceTextureRegistryEntry(long id, SurfaceTexture surfaceTexture) { this.id = id; this.surfaceTexture = surfaceTexture; - this.surfaceTexture.setOnFrameAvailableListener(new SurfaceTexture.OnFrameAvailableListener() { - @Override - public void onFrameAvailable(SurfaceTexture texture) { - if (released) { - // Even though we make sure to unregister the callback before releasing, as of Android O - // SurfaceTexture has a data race when accessing the callback, so the callback may - // still be called by a stale reference after released==true and mNativeView==null. - return; - } - mNativeView.getFlutterJNI().nativeMarkTextureFrameAvailable(mNativeView.get(), SurfaceTextureRegistryEntry.this.id); - } - }, - // The callback relies on being executed on the UI thread (unsynchronised read of mNativeView - // and also the engine code check for platform thread in Shell::OnPlatformViewMarkTextureFrameAvailable), - // so we explicitly pass a Handler for the current thread. - new Handler()); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + // The callback relies on being executed on the UI thread (unsynchronised read of mNativeView + // and also the engine code check for platform thread in Shell::OnPlatformViewMarkTextureFrameAvailable), + // so we explicitly pass a Handler for the current thread. + this.surfaceTexture.setOnFrameAvailableListener(onFrameListener, new Handler()); + } else { + // Android documentation states that the listener can be called on an arbitrary thread. + // But in practice, versions of Android that predate the newer API will call the listener + // on the thread where the SurfaceTexture was constructed. + this.surfaceTexture.setOnFrameAvailableListener(onFrameListener); + } } + private SurfaceTexture.OnFrameAvailableListener onFrameListener = new SurfaceTexture.OnFrameAvailableListener() { + @Override + public void onFrameAvailable(SurfaceTexture texture) { + if (released) { + // Even though we make sure to unregister the callback before releasing, as of Android O + // SurfaceTexture has a data race when accessing the callback, so the callback may + // still be called by a stale reference after released==true and mNativeView==null. + return; + } + mNativeView.getFlutterJNI().nativeMarkTextureFrameAvailable(mNativeView.get(), SurfaceTextureRegistryEntry.this.id); + } + }; + @Override public SurfaceTexture surfaceTexture() { return surfaceTexture; diff --git a/shell/platform/android/io/flutter/view/ResourceCleaner.java b/shell/platform/android/io/flutter/view/ResourceCleaner.java index 7378a04d2d719..c45d2a22a4e41 100644 --- a/shell/platform/android/io/flutter/view/ResourceCleaner.java +++ b/shell/platform/android/io/flutter/view/ResourceCleaner.java @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/view/ResourceExtractor.java b/shell/platform/android/io/flutter/view/ResourceExtractor.java index e796219694d37..840977f3eaf54 100644 --- a/shell/platform/android/io/flutter/view/ResourceExtractor.java +++ b/shell/platform/android/io/flutter/view/ResourceExtractor.java @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -101,6 +101,11 @@ private String checkTimestamp(File dataDir) { TIMESTAMP_PREFIX + packageInfo.versionCode + "-" + packageInfo.lastUpdateTime; final String[] existingTimestamps = getExistingTimestamps(dataDir); + + if (existingTimestamps == null) { + return null; + } + if (existingTimestamps.length != 1 || !expectedTimestamp.equals(existingTimestamps[0])) { return expectedTimestamp; @@ -173,7 +178,11 @@ private void deleteFiles() { file.delete(); } } - for (String timestamp : getExistingTimestamps(dataDir)) { + final String[] existingTimestamps = getExistingTimestamps(dataDir); + if (existingTimestamps == null) { + return; + } + for (String timestamp : existingTimestamps) { new File(dataDir, timestamp).delete(); } } diff --git a/shell/platform/android/io/flutter/view/ResourcePaths.java b/shell/platform/android/io/flutter/view/ResourcePaths.java index 44bfb4a0a0c43..2e2305e0945a6 100644 --- a/shell/platform/android/io/flutter/view/ResourcePaths.java +++ b/shell/platform/android/io/flutter/view/ResourcePaths.java @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/view/TextureRegistry.java b/shell/platform/android/io/flutter/view/TextureRegistry.java index 992114dc07318..ed3134bb035dd 100644 --- a/shell/platform/android/io/flutter/view/TextureRegistry.java +++ b/shell/platform/android/io/flutter/view/TextureRegistry.java @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/io/flutter/view/VsyncWaiter.java b/shell/platform/android/io/flutter/view/VsyncWaiter.java index c7de31f860119..526d836167efd 100644 --- a/shell/platform/android/io/flutter/view/VsyncWaiter.java +++ b/shell/platform/android/io/flutter/view/VsyncWaiter.java @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/library_loader.cc b/shell/platform/android/library_loader.cc index 70a2b5af34da2..c625414470340 100644 --- a/shell/platform/android/library_loader.cc +++ b/shell/platform/android/library_loader.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/platform_message_response_android.cc b/shell/platform/android/platform_message_response_android.cc index 3610d8baa0d73..eb88a6a5840bb 100644 --- a/shell/platform/android/platform_message_response_android.cc +++ b/shell/platform/android/platform_message_response_android.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,6 +17,8 @@ PlatformMessageResponseAndroid::PlatformMessageResponseAndroid( weak_java_object_(weak_java_object), platform_task_runner_(std::move(platform_task_runner)) {} +PlatformMessageResponseAndroid::~PlatformMessageResponseAndroid() = default; + // |blink::PlatformMessageResponse| void PlatformMessageResponseAndroid::Complete( std::unique_ptr data) { @@ -27,7 +29,7 @@ void PlatformMessageResponseAndroid::Complete( ]() { // We are on the platform thread. Attempt to get the strong reference to // the Java object. - auto env = fml::jni::AttachCurrentThread(); + auto* env = fml::jni::AttachCurrentThread(); auto java_object = weak_java_object.get(env); if (java_object.is_null()) { @@ -57,7 +59,7 @@ void PlatformMessageResponseAndroid::CompleteEmpty() { ]() { // We are on the platform thread. Attempt to get the strong reference to // the Java object. - auto env = fml::jni::AttachCurrentThread(); + auto* env = fml::jni::AttachCurrentThread(); auto java_object = weak_java_object.get(env); if (java_object.is_null()) { diff --git a/shell/platform/android/platform_message_response_android.h b/shell/platform/android/platform_message_response_android.h index fb4c5ac640645..f3d79c1aa4faf 100644 --- a/shell/platform/android/platform_message_response_android.h +++ b/shell/platform/android/platform_message_response_android.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -26,6 +26,8 @@ class PlatformMessageResponseAndroid : public blink::PlatformMessageResponse { fml::jni::JavaObjectWeakGlobalRef weak_java_object, fml::RefPtr platform_task_runner); + ~PlatformMessageResponseAndroid() override; + int response_id_; fml::jni::JavaObjectWeakGlobalRef weak_java_object_; fml::RefPtr platform_task_runner_; diff --git a/shell/platform/android/platform_view_android.cc b/shell/platform/android/platform_view_android.cc index ee82b44e51604..034c059695014 100644 --- a/shell/platform/android/platform_view_android.cc +++ b/shell/platform/android/platform_view_android.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/platform_view_android.h b/shell/platform/android/platform_view_android.h index 0a73fed04d5d6..c162ac5a2e8f3 100644 --- a/shell/platform/android/platform_view_android.h +++ b/shell/platform/android/platform_view_android.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc index b1bf3cb280ffb..075b5aa08bcd9 100644 --- a/shell/platform/android/platform_view_android_jni.cc +++ b/shell/platform/android/platform_view_android_jni.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -244,7 +244,7 @@ static void RunBundleAndSnapshotFromLibrary(JNIEnv* env, jstring jEntrypoint, jstring jLibraryUrl, jobject jAssetManager) { - auto asset_manager = fml::MakeRefCounted(); + auto asset_manager = std::make_shared(); const auto bundlepath = fml::jni::JavaStringToString(env, jbundlepath); if (bundlepath.size() > 0) { @@ -332,19 +332,18 @@ static void SetViewportMetrics(JNIEnv* env, jint physicalViewInsetRight, jint physicalViewInsetBottom, jint physicalViewInsetLeft) { - const blink::ViewportMetrics metrics = { - .device_pixel_ratio = static_cast(devicePixelRatio), - .physical_width = static_cast(physicalWidth), - .physical_height = static_cast(physicalHeight), - .physical_padding_top = static_cast(physicalPaddingTop), - .physical_padding_right = static_cast(physicalPaddingRight), - .physical_padding_bottom = static_cast(physicalPaddingBottom), - .physical_padding_left = static_cast(physicalPaddingLeft), - .physical_view_inset_top = static_cast(physicalViewInsetTop), - .physical_view_inset_right = static_cast(physicalViewInsetRight), - .physical_view_inset_bottom = - static_cast(physicalViewInsetBottom), - .physical_view_inset_left = static_cast(physicalViewInsetLeft), + const blink::ViewportMetrics metrics{ + static_cast(devicePixelRatio), + static_cast(physicalWidth), + static_cast(physicalHeight), + static_cast(physicalPaddingTop), + static_cast(physicalPaddingRight), + static_cast(physicalPaddingBottom), + static_cast(physicalPaddingLeft), + static_cast(physicalViewInsetTop), + static_cast(physicalViewInsetRight), + static_cast(physicalViewInsetBottom), + static_cast(physicalViewInsetLeft), }; ANDROID_SHELL_HOLDER->SetViewportMetrics(metrics); @@ -369,7 +368,7 @@ static jobject GetBitmap(JNIEnv* env, jobject jcaller, jlong shell_holder) { return nullptr; } - auto pixels_src = static_cast(screenshot.data->data()); + auto* pixels_src = static_cast(screenshot.data->data()); // Our configuration of Skia does not support rendering to the // BitmapConfig.ARGB_8888 format expected by android.graphics.Bitmap. diff --git a/shell/platform/android/platform_view_android_jni.h b/shell/platform/android/platform_view_android_jni.h index 9a4a411a9d303..3423c745fd584 100644 --- a/shell/platform/android/platform_view_android_jni.h +++ b/shell/platform/android/platform_view_android_jni.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/android/vsync_waiter_android.cc b/shell/platform/android/vsync_waiter_android.cc index be04abcf1e61f..7d551c71143a8 100644 --- a/shell/platform/android/vsync_waiter_android.cc +++ b/shell/platform/android/vsync_waiter_android.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -84,7 +84,7 @@ bool VsyncWaiterAndroid::Register(JNIEnv* env) { static void ConsumePendingCallback(jlong java_baton, fml::TimePoint frame_start_time, fml::TimePoint frame_target_time) { - auto weak_this = reinterpret_cast*>(java_baton); + auto* weak_this = reinterpret_cast*>(java_baton); auto shared_this = weak_this->lock(); delete weak_this; diff --git a/shell/platform/android/vsync_waiter_android.h b/shell/platform/android/vsync_waiter_android.h index 6c664059ded28..46fa28fc48f2e 100644 --- a/shell/platform/android/vsync_waiter_android.h +++ b/shell/platform/android/vsync_waiter_android.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/BUILD.gn b/shell/platform/darwin/BUILD.gn index 3c04dda634945..0dba0a457e448 100644 --- a/shell/platform/darwin/BUILD.gn +++ b/shell/platform/darwin/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/shell/platform/darwin/common/BUILD.gn b/shell/platform/darwin/common/BUILD.gn index 38df59c502d75..8dd3387b3f871 100644 --- a/shell/platform/darwin/common/BUILD.gn +++ b/shell/platform/darwin/common/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/shell/platform/darwin/common/buffer_conversions.h b/shell/platform/darwin/common/buffer_conversions.h index 7b48a0c8b913d..a5b166d2e3c08 100644 --- a/shell/platform/darwin/common/buffer_conversions.h +++ b/shell/platform/darwin/common/buffer_conversions.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/common/buffer_conversions.mm b/shell/platform/darwin/common/buffer_conversions.mm index f7238f104db7d..237910b2cfbb4 100644 --- a/shell/platform/darwin/common/buffer_conversions.mm +++ b/shell/platform/darwin/common/buffer_conversions.mm @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/common/command_line.h b/shell/platform/darwin/common/command_line.h index 63add3f4285a0..fab7ff0aa21bf 100644 --- a/shell/platform/darwin/common/command_line.h +++ b/shell/platform/darwin/common/command_line.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/common/command_line.mm b/shell/platform/darwin/common/command_line.mm index 18e37f2b4f798..84ab3ca432c77 100644 --- a/shell/platform/darwin/common/command_line.mm +++ b/shell/platform/darwin/common/command_line.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/ios/BUILD.gn b/shell/platform/darwin/ios/BUILD.gn index 3de4e258a7d75..8adbfc627970e 100644 --- a/shell/platform/darwin/ios/BUILD.gn +++ b/shell/platform/darwin/ios/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -26,9 +26,10 @@ _flutter_framework_headers = [ "framework/Headers/FlutterChannels.h", "framework/Headers/FlutterCodecs.h", "framework/Headers/FlutterDartProject.h", + "framework/Headers/FlutterEngine.h", "framework/Headers/FlutterHeadlessDartRunner.h", "framework/Headers/FlutterMacros.h", - "framework/Headers/FlutterNavigationController.h", + "framework/Headers/FlutterPlatformViews.h", "framework/Headers/FlutterPlugin.h", "framework/Headers/FlutterPluginAppLifeCycleDelegate.h", "framework/Headers/FlutterTexture.h", @@ -51,10 +52,18 @@ shared_library("create_flutter_framework_dylib") { "framework/Source/FlutterCodecs.mm", "framework/Source/FlutterDartProject.mm", "framework/Source/FlutterDartProject_Internal.h", + "framework/Source/FlutterEngine.mm", + "framework/Source/FlutterEngine_Internal.h", "framework/Source/FlutterHeadlessDartRunner.mm", - "framework/Source/FlutterNavigationController.mm", + "framework/Source/FlutterObservatoryPublisher.h", + "framework/Source/FlutterObservatoryPublisher.mm", + "framework/Source/FlutterOverlayView.h", + "framework/Source/FlutterOverlayView.mm", "framework/Source/FlutterPlatformPlugin.h", "framework/Source/FlutterPlatformPlugin.mm", + "framework/Source/FlutterPlatformViews_Internal.h", + "framework/Source/FlutterPlatformViews_Internal.mm", + "framework/Source/FlutterPlatformViews.mm", "framework/Source/FlutterPluginAppLifeCycleDelegate.mm", "framework/Source/FlutterStandardCodec.mm", "framework/Source/FlutterStandardCodec_Internal.h", @@ -69,20 +78,18 @@ shared_library("create_flutter_framework_dylib") { "framework/Source/accessibility_bridge.mm", "framework/Source/accessibility_text_entry.h", "framework/Source/accessibility_text_entry.mm", - "framework/Source/flutter_touch_mapper.h", - "framework/Source/flutter_touch_mapper.mm", "framework/Source/platform_message_response_darwin.h", "framework/Source/platform_message_response_darwin.mm", "framework/Source/platform_message_router.h", "framework/Source/platform_message_router.mm", "framework/Source/vsync_waiter_ios.h", "framework/Source/vsync_waiter_ios.mm", - "headless_platform_view_ios.h", - "headless_platform_view_ios.mm", "ios_external_texture_gl.h", "ios_external_texture_gl.mm", "ios_gl_context.h", "ios_gl_context.mm", + "ios_gl_render_target.h", + "ios_gl_render_target.mm", "ios_surface.h", "ios_surface.mm", "ios_surface_gl.h", @@ -105,7 +112,6 @@ shared_library("create_flutter_framework_dylib") { "$flutter_root/shell/common", "$flutter_root/shell/platform/darwin/common", "//third_party/skia", - "//third_party/skia:gpu", ] if (flutter_runtime_mode == "debug" || flutter_runtime_mode == "dynamic_profile" || diff --git a/shell/platform/darwin/ios/framework/Headers/Flutter.h b/shell/platform/darwin/ios/framework/Headers/Flutter.h index 49464e40dc06b..364912afc04a8 100644 --- a/shell/platform/darwin/ios/framework/Headers/Flutter.h +++ b/shell/platform/darwin/ios/framework/Headers/Flutter.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,13 @@ /** BREAKING CHANGES: + October 5, 2018: + - Removed FlutterNavigationController.h/.mm + - Changed return signature of `FlutterDartHeadlessCodeRunner.run*` from void + to bool + - Removed HeadlessPlatformViewIOS + - Marked FlutterDartHeadlessCodeRunner deprecated + August 31, 2018: Marked -[FlutterDartProject initFromDefaultSourceForConfiguration] and FlutterStandardBigInteger as unavailable. @@ -47,9 +54,10 @@ #include "FlutterChannels.h" #include "FlutterCodecs.h" #include "FlutterDartProject.h" +#include "FlutterEngine.h" #include "FlutterHeadlessDartRunner.h" #include "FlutterMacros.h" -#include "FlutterNavigationController.h" +#include "FlutterPlatformViews.h" #include "FlutterPlugin.h" #include "FlutterPluginAppLifeCycleDelegate.h" #include "FlutterTexture.h" diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterAppDelegate.h b/shell/platform/darwin/ios/framework/Headers/FlutterAppDelegate.h index f175ea2925826..8684a22ea7733 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterAppDelegate.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterAppDelegate.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,11 +11,11 @@ #include "FlutterPlugin.h" /** - * UIApplicationDelegate subclass for simple apps that want default behavior. + * `UIApplicationDelegate` subclass for simple apps that want default behavior. * - * This class provides the following behaviors: + * This class implements the following behaviors: * * Status bar touches are forwarded to the key window's root view - * FlutterViewController, in order to trigger scroll to top. + * `FlutterViewController`, in order to trigger scroll to top. * * Keeps the Flutter connection open in debug mode when the phone screen * locks. * @@ -24,7 +24,8 @@ * code as necessary from FlutterAppDelegate.mm. */ FLUTTER_EXPORT -@interface FlutterAppDelegate : UIResponder +@interface FlutterAppDelegate + : UIResponder @property(strong, nonatomic) UIWindow* window; diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h b/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h index 606c131349cc4..2c35fd42599c4 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,72 +11,67 @@ NS_ASSUME_NONNULL_BEGIN /** - A message reply callback. - - Used for submitting a binary reply back to a Flutter message sender. Also used - in the dual capacity for handling a binary message reply received from Flutter. - - - Parameters: - - reply: The reply. + * A message reply callback. + * + * Used for submitting a binary reply back to a Flutter message sender. Also used + * in for handling a binary message reply received from Flutter. + * + * @param reply The reply. */ typedef void (^FlutterBinaryReply)(NSData* _Nullable reply); /** - A strategy for handling incoming binary messages from Flutter and to send - asynchronous replies back to Flutter. - - - Parameters: - - message: The message. - - reply: A callback for submitting a reply to the sender. + * A strategy for handling incoming binary messages from Flutter and to send + * asynchronous replies back to Flutter. + * + * @param message The message. + * @param reply A callback for submitting an asynchronous reply to the sender. */ typedef void (^FlutterBinaryMessageHandler)(NSData* _Nullable message, FlutterBinaryReply reply); /** - A facility for communicating with the Flutter side using asynchronous message - passing with binary messages. - - - SeeAlso: - - `FlutterBasicMessageChannel`, which supports communication using structured - messages. - - `FlutterMethodChannel`, which supports communication using asynchronous - method calls. - - `FlutterEventChannel`, which supports commuication using event streams. + * A facility for communicating with the Flutter side using asynchronous message + * passing with binary messages. + * + * Implementated by: + * - `FlutterBasicMessageChannel`, which supports communication using structured + * messages. + * - `FlutterMethodChannel`, which supports communication using asynchronous + * method calls. + * - `FlutterEventChannel`, which supports commuication using event streams. */ FLUTTER_EXPORT -@protocol FlutterBinaryMessenger +@protocol FlutterBinaryMessenger /** - Sends a binary message to the Flutter side on the specified channel, expecting - no reply. - - - Parameters: - - channel: The channel name. - - message: The message. + * Sends a binary message to the Flutter side on the specified channel, expecting + * no reply. + * + * @param channel The channel name. + * @param message The message. */ - (void)sendOnChannel:(NSString*)channel message:(NSData* _Nullable)message; /** - Sends a binary message to the Flutter side on the specified channel, expecting - an asynchronous reply. - - - Parameters: - - channel: The channel name. - - message: The message. - - callback: A callback for receiving a reply. + * Sends a binary message to the Flutter side on the specified channel, expecting + * an asynchronous reply. + * + * @param channel The channel name. + * @param message The message. + * @param callback A callback for receiving a reply. */ - (void)sendOnChannel:(NSString*)channel message:(NSData* _Nullable)message binaryReply:(FlutterBinaryReply _Nullable)callback; /** - Registers a message handler for incoming binary messages from the Flutter side - on the specified channel. - - Replaces any existing handler. Use a `nil` handler for unregistering the - existing handler. - - - Parameters: - - channel: The channel name. - - handler: The message handler. + * Registers a message handler for incoming binary messages from the Flutter side + * on the specified channel. + * + * Replaces any existing handler. Use a `nil` handler for unregistering the + * existing handler. + * + * @param channel The channel name. + * @param handler The message handler. */ - (void)setMessageHandlerOnChannel:(NSString*)channel binaryMessageHandler:(FlutterBinaryMessageHandler _Nullable)handler; diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterCallbackCache.h b/shell/platform/darwin/ios/framework/Headers/FlutterCallbackCache.h index 7150838fafbb3..8849dca01e6d9 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterCallbackCache.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterCallbackCache.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,26 +9,43 @@ #include "FlutterMacros.h" +/** + * An object containing the result of `FlutterCallbackCache`'s `lookupCallbackInformation` + * method. + */ FLUTTER_EXPORT @interface FlutterCallbackInformation : NSObject +/** + * The name of the callback. + */ @property(retain) NSString* callbackName; +/** + * The class name of the callback. + */ @property(retain) NSString* callbackClassName; +/** + * The library path of the callback. + */ @property(retain) NSString* callbackLibraryPath; @end +/** + * The cache containing callback information for spawning a + * `FlutterHeadlessDartRunner`. + */ FLUTTER_EXPORT @interface FlutterCallbackCache : NSObject /** - Returns the callback information for the given callback handle. - This callback information can be used when spawning a - FlutterHeadlessDartRunner. - - - Parameter handle: The handle for a callback, provided by the - Dart method `PluginUtilities.getCallbackHandle`. - - Returns: A FlutterCallbackInformation object which contains the name of the - callback, the name of the class in which the callback is defined, and the - path of the library which contains the callback. If the provided handle is - invalid, nil is returned. + * Returns the callback information for the given callback handle. + * This callback information can be used when spawning a + * `FlutterHeadlessDartRunner`. + * + * @param handle The handle for a callback, provided by the + * Dart method `PluginUtilities.getCallbackHandle`. + * @return A `FlutterCallbackInformation` object which contains the name of the + * callback, the name of the class in which the callback is defined, and the + * path of the library which contains the callback. If the provided handle is + * invalid, nil is returned. */ + (FlutterCallbackInformation*)lookupCallbackInformation:(int64_t)handle; diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h b/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h index 2e6cf4a4fd825..d582ce46dc6bb 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,373 +10,359 @@ NS_ASSUME_NONNULL_BEGIN /** - A message reply callback. - - Used for submitting a reply back to a Flutter message sender. Also used in - the dual capacity for handling a message reply received from Flutter. - - - Parameter reply: The reply. + * A message reply callback. + * + * Used for submitting a reply back to a Flutter message sender. Also used in + * the dual capacity for handling a message reply received from Flutter. + * + * @param reply The reply. */ typedef void (^FlutterReply)(id _Nullable reply); /** - A strategy for handling incoming messages from Flutter and to send - asynchronous replies back to Flutter. - - - Parameters: - - message: The message. - - reply: A callback for submitting a reply to the sender. + * A strategy for handling incoming messages from Flutter and to send + * asynchronous replies back to Flutter. + * + * @param message The message. + * @param callback A callback for submitting a reply to the sender. */ typedef void (^FlutterMessageHandler)(id _Nullable message, FlutterReply callback); /** - A channel for communicating with the Flutter side using basic, asynchronous - message passing. + * A channel for communicating with the Flutter side using basic, asynchronous + * message passing. */ FLUTTER_EXPORT @interface FlutterBasicMessageChannel : NSObject /** - Creates a `FlutterBasicMessageChannel` with the specified name and binary - messenger. - - The channel name logically identifies the channel; identically named channels - interfere with each other's communication. - - The binary messenger is a facility for sending raw, binary messages to the - Flutter side. This protocol is implemented by `FlutterViewController`. - - The channel uses `FlutterStandardMessageCodec` to encode and decode messages. - - - Parameters: - - name: The channel name. - - messenger: The binary messenger. + * Creates a `FlutterBasicMessageChannel` with the specified name and binary + * messenger. + * + * The channel name logically identifies the channel; identically named channels + * interfere with each other's communication. + * + * The binary messenger is a facility for sending raw, binary messages to the + * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`. + * + * The channel uses `FlutterStandardMessageCodec` to encode and decode messages. + * + * @param name The channel name. + * @param messenger The binary messenger. */ + (instancetype)messageChannelWithName:(NSString*)name binaryMessenger:(NSObject*)messenger; /** - Creates a `FlutterBasicMessageChannel` with the specified name, binary - messenger, - and message codec. - - The channel name logically identifies the channel; identically named channels - interfere with each other's communication. - - The binary messenger is a facility for sending raw, binary messages to the - Flutter side. This protocol is implemented by `FlutterViewController`. - - - Parameters: - - name: The channel name. - - messenger: The binary messenger. - - codec: The message codec. + * Creates a `FlutterBasicMessageChannel` with the specified name, binary + * messenger, and message codec. + * + * The channel name logically identifies the channel; identically named channels + * interfere with each other's communication. + * + * The binary messenger is a facility for sending raw, binary messages to the + * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`. + * + * @param name The channel name. + * @param messenger The binary messenger. + * @param codec The message codec. */ + (instancetype)messageChannelWithName:(NSString*)name binaryMessenger:(NSObject*)messenger codec:(NSObject*)codec; /** - Initializes a `FlutterBasicMessageChannel` with the specified name, binary - messenger, and message codec. - - The channel name logically identifies the channel; identically named channels - interfere with each other's communication. - - The binary messenger is a facility for sending raw, binary messages to the - Flutter side. This protocol is implemented by `FlutterViewController`. - - - Parameters: - - name: The channel name. - - messenger: The binary messenger. - - codec: The message codec. + * Initializes a `FlutterBasicMessageChannel` with the specified name, binary + * messenger, and message codec. + * + * The channel name logically identifies the channel; identically named channels + * interfere with each other's communication. + * + * The binary messenger is a facility for sending raw, binary messages to the + * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`. + * + * @param name The channel name. + * @param messenger The binary messenger. + * @param codec The message codec. */ - (instancetype)initWithName:(NSString*)name binaryMessenger:(NSObject*)messenger codec:(NSObject*)codec; /** - Sends the specified message to the Flutter side, ignoring any reply. - - - Parameter message: The message. Must be supported by the codec of this - channel. + * Sends the specified message to the Flutter side, ignoring any reply. + * + * @param message The message. Must be supported by the codec of this + * channel. */ - (void)sendMessage:(id _Nullable)message; /** - Sends the specified message to the Flutter side, expecting an asynchronous - reply. - - - Parameters: - - message: The message. Must be supported by the codec of this channel. - - callback: A callback to be invoked with the message reply from Flutter. + * Sends the specified message to the Flutter side, expecting an asynchronous + * reply. + * + * @param message The message. Must be supported by the codec of this channel. + * @param callback A callback to be invoked with the message reply from Flutter. */ - (void)sendMessage:(id _Nullable)message reply:(FlutterReply _Nullable)callback; /** - Registers a message handler with this channel. - - Replaces any existing handler. Use a `nil` handler for unregistering the - existing handler. - - - Parameter handler: The message handler. + * Registers a message handler with this channel. + * + * Replaces any existing handler. Use a `nil` handler for unregistering the + * existing handler. + * + * @param handler The message handler. */ - (void)setMessageHandler:(FlutterMessageHandler _Nullable)handler; @end /** - A method call result callback. - - Used for submitting a method call result back to a Flutter caller. Also used in - the dual capacity for handling a method call result received from Flutter. - - - Parameter result: The result. + * A method call result callback. + * + * Used for submitting a method call result back to a Flutter caller. Also used in + * the dual capacity for handling a method call result received from Flutter. + * + * @param result The result. */ typedef void (^FlutterResult)(id _Nullable result); /** - A strategy for handling method calls. - - - Parameters: - - call: The incoming method call. - - result: A callback to asynchronously submit the result of the call. - Invoke the callback with a `FlutterError` to indicate that the call failed. - Invoke the callback with `FlutterMethodNotImplemented` to indicate that the - method was unknown. Any other values, including `nil`, are interpreted as - successful results. + * A strategy for handling method calls. + * + * @param call The incoming method call. + * @param result A callback to asynchronously submit the result of the call. + * Invoke the callback with a `FlutterError` to indicate that the call failed. + * Invoke the callback with `FlutterMethodNotImplemented` to indicate that the + * method was unknown. Any other values, including `nil`, are interpreted as + * successful results. */ typedef void (^FlutterMethodCallHandler)(FlutterMethodCall* call, FlutterResult result); /** - A constant used with `FlutterMethodCallHandler` to respond to the call of an - unknown method. + * A constant used with `FlutterMethodCallHandler` to respond to the call of an + * unknown method. */ FLUTTER_EXPORT extern NSObject const* FlutterMethodNotImplemented; /** - A channel for communicating with the Flutter side using invocation of - asynchronous methods. + * A channel for communicating with the Flutter side using invocation of + * asynchronous methods. */ FLUTTER_EXPORT @interface FlutterMethodChannel : NSObject /** - Creates a `FlutterMethodChannel` with the specified name and binary messenger. - - The channel name logically identifies the channel; identically named channels - interfere with each other's communication. - - The binary messenger is a facility for sending raw, binary messages to the - Flutter side. This protocol is implemented by `FlutterViewController`. - - The channel uses `FlutterStandardMethodCodec` to encode and decode method calls - and result envelopes. - - - Parameters: - - name: The channel name. - - messenger: The binary messenger. + * Creates a `FlutterMethodChannel` with the specified name and binary messenger. + * + * The channel name logically identifies the channel; identically named channels + * interfere with each other's communication. + * + * The binary messenger is a facility for sending raw, binary messages to the + * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`. + * + * The channel uses `FlutterStandardMethodCodec` to encode and decode method calls + * and result envelopes. + * + * @param name The channel name. + * @param messenger The binary messenger. */ + (instancetype)methodChannelWithName:(NSString*)name binaryMessenger:(NSObject*)messenger; /** - Creates a `FlutterMethodChannel` with the specified name, binary messenger, and - method codec. - - The channel name logically identifies the channel; identically named channels - interfere with each other's communication. - - The binary messenger is a facility for sending raw, binary messages to the - Flutter side. This protocol is implemented by `FlutterViewController`. - - - Parameters: - - name: The channel name. - - messenger: The binary messenger. - - codec: The method codec. + * Creates a `FlutterMethodChannel` with the specified name, binary messenger, and + * method codec. + * + * The channel name logically identifies the channel; identically named channels + * interfere with each other's communication. + * + * The binary messenger is a facility for sending raw, binary messages to the + * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`. + * + * @param name The channel name. + * @param messenger The binary messenger. + * @param codec The method codec. */ + (instancetype)methodChannelWithName:(NSString*)name binaryMessenger:(NSObject*)messenger codec:(NSObject*)codec; /** - Initializes a `FlutterMethodChannel` with the specified name, binary messenger, - and method codec. - - The channel name logically identifies the channel; identically named channels - interfere with each other's communication. - - The binary messenger is a facility for sending raw, binary messages to the - Flutter side. This protocol is implemented by `FlutterViewController`. - - - Parameters: - - name: The channel name. - - messenger: The binary messenger. - - codec: The method codec. + * Initializes a `FlutterMethodChannel` with the specified name, binary messenger, + * and method codec. + * + * The channel name logically identifies the channel; identically named channels + * interfere with each other's communication. + * + * The binary messenger is a facility for sending raw, binary messages to the + * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`. + * + * @param name The channel name. + * @param messenger The binary messenger. + * @param codec The method codec. */ - (instancetype)initWithName:(NSString*)name binaryMessenger:(NSObject*)messenger codec:(NSObject*)codec; +// clang-format off /** - Invokes the specified Flutter method with the specified arguments, expecting - no results. See - [MethodChannel.setMethodCallHandler](https://docs.flutter.io/flutter/services/MethodChannel/setMethodCallHandler.html). - - - Parameters: - - method: The name of the method to invoke. - - arguments: The arguments. Must be a value supported by the codec of this - channel. + * Invokes the specified Flutter method with the specified arguments, expecting + * no results. + * + * @see [MethodChannel.setMethodCallHandler](https://docs.flutter.io/flutter/services/MethodChannel/setMethodCallHandler.html) + * + * @param method The name of the method to invoke. + * @param arguments The arguments. Must be a value supported by the codec of this + * channel. */ +// clang-format on - (void)invokeMethod:(NSString*)method arguments:(id _Nullable)arguments; /** - Invokes the specified Flutter method with the specified arguments, expecting - an asynchronous result. - - - Parameters: - - method: The name of the method to invoke. - - arguments: The arguments. Must be a value supported by the codec of this - channel. - - result: A callback that will be invoked with the asynchronous result. - The result will be a `FlutterError` instance, if the method call resulted - in an error on the Flutter side. Will be `FlutterMethodNotImplemented`, if - the method called was not implemented on the Flutter side. Any other value, - including `nil`, should be interpreted as successful results. + * Invokes the specified Flutter method with the specified arguments, expecting + * an asynchronous result. + * + * @param method The name of the method to invoke. + * @param arguments The arguments. Must be a value supported by the codec of this + * channel. + * @param callback A callback that will be invoked with the asynchronous result. + * The result will be a `FlutterError` instance, if the method call resulted + * in an error on the Flutter side. Will be `FlutterMethodNotImplemented`, if + * the method called was not implemented on the Flutter side. Any other value, + * including `nil`, should be interpreted as successful results. */ - (void)invokeMethod:(NSString*)method arguments:(id _Nullable)arguments result:(FlutterResult _Nullable)callback; /** - Registers a handler for method calls from the Flutter side. - - Replaces any existing handler. Use a `nil` handler for unregistering the - existing handler. - - - Parameter handler: The method call handler. + * Registers a handler for method calls from the Flutter side. + * + * Replaces any existing handler. Use a `nil` handler for unregistering the + * existing handler. + * + * @param handler The method call handler. */ - (void)setMethodCallHandler:(FlutterMethodCallHandler _Nullable)handler; @end /** - An event sink callback. - - - Parameter event: The event. + * An event sink callback. + * + * @param event The event. */ typedef void (^FlutterEventSink)(id _Nullable event); /** - A strategy for exposing an event stream to the Flutter side. + * A strategy for exposing an event stream to the Flutter side. */ FLUTTER_EXPORT @protocol FlutterStreamHandler /** - Sets up an event stream and begin emitting events. - - Invoked when the first listener is registered with the Stream associated to - this channel on the Flutter side. - - - Parameters: - - arguments: Arguments for the stream. - - events: A callback to asynchronously emit events. Invoke the - callback with a `FlutterError` to emit an error event. Invoke the - callback with `FlutterEndOfEventStream` to indicate that no more - events will be emitted. Any other value, including `nil` are emitted as - successful events. - - Returns: A FlutterError instance, if setup fails. + * Sets up an event stream and begin emitting events. + * + * Invoked when the first listener is registered with the Stream associated to + * this channel on the Flutter side. + * + * @param arguments Arguments for the stream. + * @param events A callback to asynchronously emit events. Invoke the + * callback with a `FlutterError` to emit an error event. Invoke the + * callback with `FlutterEndOfEventStream` to indicate that no more + * events will be emitted. Any other value, including `nil` are emitted as + * successful events. + * @return A FlutterError instance, if setup fails. */ - (FlutterError* _Nullable)onListenWithArguments:(id _Nullable)arguments eventSink:(FlutterEventSink)events; /** - Tears down an event stream. - - Invoked when the last listener is deregistered from the Stream associated to - this channel on the Flutter side. - - The channel implementation may call this method with `nil` arguments - to separate a pair of two consecutive set up requests. Such request pairs - may occur during Flutter hot restart. - - - Parameter arguments: Arguments for the stream. - - Returns: A FlutterError instance, if teardown fails. + * Tears down an event stream. + * + * Invoked when the last listener is deregistered from the Stream associated to + * this channel on the Flutter side. + * + * The channel implementation may call this method with `nil` arguments + * to separate a pair of two consecutive set up requests. Such request pairs + * may occur during Flutter hot restart. + * + * @param arguments Arguments for the stream. + * @return A FlutterError instance, if teardown fails. */ - (FlutterError* _Nullable)onCancelWithArguments:(id _Nullable)arguments; @end /** - A constant used with `FlutterEventChannel` to indicate end of stream. + * A constant used with `FlutterEventChannel` to indicate end of stream. */ FLUTTER_EXPORT extern NSObject const* FlutterEndOfEventStream; /** - A channel for communicating with the Flutter side using event streams. + * A channel for communicating with the Flutter side using event streams. */ FLUTTER_EXPORT @interface FlutterEventChannel : NSObject /** - Creates a `FlutterEventChannel` with the specified name and binary messenger. - - The channel name logically identifies the channel; identically named channels - interfere with each other's communication. - - The binary messenger is a facility for sending raw, binary messages to the - Flutter side. This protocol is implemented by `FlutterViewController`. - - The channel uses `FlutterStandardMethodCodec` to decode stream setup and - teardown requests, and to encode event envelopes. - - - Parameters: - - name: The channel name. - - messenger: The binary messenger. - - codec: The method codec. + * Creates a `FlutterEventChannel` with the specified name and binary messenger. + * + * The channel name logically identifies the channel; identically named channels + * interfere with each other's communication. + * + * The binary messenger is a facility for sending raw, binary messages to the + * Flutter side. This protocol is implemented by `FlutterViewController`. + * + * The channel uses `FlutterStandardMethodCodec` to decode stream setup and + * teardown requests, and to encode event envelopes. + * + * @param name The channel name. + * @param messenger The binary messenger. */ + (instancetype)eventChannelWithName:(NSString*)name binaryMessenger:(NSObject*)messenger; /** - Creates a `FlutterEventChannel` with the specified name, binary messenger, - and method codec. - - The channel name logically identifies the channel; identically named channels - interfere with each other's communication. - - The binary messenger is a facility for sending raw, binary messages to the - Flutter side. This protocol is implemented by `FlutterViewController`. - - - Parameters: - - name: The channel name. - - messenger: The binary messenger. - - codec: The method codec. + * Creates a `FlutterEventChannel` with the specified name, binary messenger, + * and method codec. + * + * The channel name logically identifies the channel; identically named channels + * interfere with each other's communication. + * + * The binary messenger is a facility for sending raw, binary messages to the + * Flutter side. This protocol is implemented by `FlutterViewController`. + * + * @param name The channel name. + * @param messenger The binary messenger. + * @param codec The method codec. */ + (instancetype)eventChannelWithName:(NSString*)name binaryMessenger:(NSObject*)messenger codec:(NSObject*)codec; /** - Initializes a `FlutterEventChannel` with the specified name, binary messenger, - and method codec. - - The channel name logically identifies the channel; identically named channels - interfere with each other's communication. - - The binary messenger is a facility for sending raw, binary messages to the - Flutter side. This protocol is implemented by `FlutterViewController`. - - - Parameters: - - name: The channel name. - - messenger: The binary messenger. - - codec: The method codec. + * Initializes a `FlutterEventChannel` with the specified name, binary messenger, + * and method codec. + * + * The channel name logically identifies the channel; identically named channels + * interfere with each other's communication. + * + * The binary messenger is a facility for sending raw, binary messages to the + * Flutter side. This protocol is implemented by `FlutterEngine` and `FlutterViewController`. + * + * @param name The channel name. + * @param messenger The binary messenger. + * @param codec The method codec. */ - (instancetype)initWithName:(NSString*)name binaryMessenger:(NSObject*)messenger codec:(NSObject*)codec; /** - Registers a handler for stream setup requests from the Flutter side. - - Replaces any existing handler. Use a `nil` handler for unregistering the - existing handler. - - - Parameter handler: The stream handler. + * Registers a handler for stream setup requests from the Flutter side. + * + * Replaces any existing handler. Use a `nil` handler for unregistering the + * existing handler. + * + * @param handler The stream handler. */ - (void)setStreamHandler:(NSObject* _Nullable)handler; @end diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h b/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h index 54d7eeca54fda..0034a0709a09b 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,76 +16,76 @@ NS_ASSUME_NONNULL_BEGIN FLUTTER_EXPORT @protocol FlutterMessageCodec /** - Returns a shared instance of this `FlutterMessageCodec`. + * Returns a shared instance of this `FlutterMessageCodec`. */ + (instancetype)sharedInstance; /** - Encodes the specified message into binary. - - - Parameter message: The message. - - Returns: The binary encoding, or `nil`, if `message` was `nil`. + * Encodes the specified message into binary. + * + * @param message The message. + * @return The binary encoding, or `nil`, if `message` was `nil`. */ - (NSData* _Nullable)encode:(id _Nullable)message; /** - Decodes the specified message from binary. - - - Parameter message: The message. - - Returns: The decoded message, or `nil`, if `message` was `nil`. + * Decodes the specified message from binary. + * + * @param message The message. + * @return The decoded message, or `nil`, if `message` was `nil`. */ - (id _Nullable)decode:(NSData* _Nullable)message; @end /** - A `FlutterMessageCodec` using unencoded binary messages, represented as - `NSData` instances. - - This codec is guaranteed to be compatible with the corresponding - [BinaryCodec](https://docs.flutter.io/flutter/services/BinaryCodec-class.html) - on the Dart side. These parts of the Flutter SDK are evolved synchronously. - - On the Dart side, messages are represented using `ByteData`. + * A `FlutterMessageCodec` using unencoded binary messages, represented as + * `NSData` instances. + * + * This codec is guaranteed to be compatible with the corresponding + * [BinaryCodec](https://docs.flutter.io/flutter/services/BinaryCodec-class.html) + * on the Dart side. These parts of the Flutter SDK are evolved synchronously. + * + * On the Dart side, messages are represented using `ByteData`. */ FLUTTER_EXPORT @interface FlutterBinaryCodec : NSObject @end /** - A `FlutterMessageCodec` using UTF-8 encoded `NSString` messages. - - This codec is guaranteed to be compatible with the corresponding - [StringCodec](https://docs.flutter.io/flutter/services/StringCodec-class.html) - on the Dart side. These parts of the Flutter SDK are evolved synchronously. + * A `FlutterMessageCodec` using UTF-8 encoded `NSString` messages. + * + * This codec is guaranteed to be compatible with the corresponding + * [StringCodec](https://docs.flutter.io/flutter/services/StringCodec-class.html) + * on the Dart side. These parts of the Flutter SDK are evolved synchronously. */ FLUTTER_EXPORT @interface FlutterStringCodec : NSObject @end /** - A `FlutterMessageCodec` using UTF-8 encoded JSON messages. - - This codec is guaranteed to be compatible with the corresponding - [JSONMessageCodec](https://docs.flutter.io/flutter/services/JSONMessageCodec-class.html) - on the Dart side. These parts of the Flutter SDK are evolved synchronously. - - Supports values accepted by `NSJSONSerialization` plus top-level - `nil`, `NSNumber`, and `NSString`. - - On the Dart side, JSON messages are handled by the JSON facilities of the - [`dart:convert`](https://api.dartlang.org/stable/dart-convert/JSON-constant.html) - package. + * A `FlutterMessageCodec` using UTF-8 encoded JSON messages. + * + * This codec is guaranteed to be compatible with the corresponding + * [JSONMessageCodec](https://docs.flutter.io/flutter/services/JSONMessageCodec-class.html) + * on the Dart side. These parts of the Flutter SDK are evolved synchronously. + * + * Supports values accepted by `NSJSONSerialization` plus top-level + * `nil`, `NSNumber`, and `NSString`. + * + * On the Dart side, JSON messages are handled by the JSON facilities of the + * [`dart:convert`](https://api.dartlang.org/stable/dart-convert/JSON-constant.html) + * package. */ FLUTTER_EXPORT @interface FlutterJSONMessageCodec : NSObject @end /** - A writer of the Flutter standard binary encoding. - - See `FlutterStandardMessageCodec` for details on the encoding. - - The encoding is extensible via subclasses overriding `writeValue`. + * A writer of the Flutter standard binary encoding. + * + * See `FlutterStandardMessageCodec` for details on the encoding. + * + * The encoding is extensible via subclasses overriding `writeValue`. */ FLUTTER_EXPORT @interface FlutterStandardWriter : NSObject @@ -100,11 +100,11 @@ FLUTTER_EXPORT @end /** - A reader of the Flutter standard binary encoding. - - See `FlutterStandardMessageCodec` for details on the encoding. - - The encoding is extensible via subclasses overriding `readValueOfType`. + * A reader of the Flutter standard binary encoding. + * + * See `FlutterStandardMessageCodec` for details on the encoding. + * + * The encoding is extensible via subclasses overriding `readValueOfType`. */ FLUTTER_EXPORT @interface FlutterStandardReader : NSObject @@ -121,8 +121,8 @@ FLUTTER_EXPORT @end /** - A factory of compatible reader/writer instances using the Flutter standard - binary encoding or extensions thereof. + * A factory of compatible reader/writer instances using the Flutter standard + * binary encoding or extensions thereof. */ FLUTTER_EXPORT @interface FlutterStandardReaderWriter : NSObject @@ -131,29 +131,29 @@ FLUTTER_EXPORT @end /** - A `FlutterMessageCodec` using the Flutter standard binary encoding. - - This codec is guaranteed to be compatible with the corresponding - [StandardMessageCodec](https://docs.flutter.io/flutter/services/StandardMessageCodec-class.html) - on the Dart side. These parts of the Flutter SDK are evolved synchronously. - - Supported messages are acyclic values of these forms: - - - `nil` or `NSNull` - - `NSNumber` (including their representation of Boolean values) - - `NSString` - - `FlutterStandardTypedData` - - `NSArray` of supported values - - `NSDictionary` with supported keys and values - - On the Dart side, these values are represented as follows: - - - `nil` or `NSNull`: null - - `NSNumber`: `bool`, `int`, or `double`, depending on the contained value. - - `NSString`: `String` - - `FlutterStandardTypedData`: `Uint8List`, `Int32List`, `Int64List`, or `Float64List` - - `NSArray`: `List` - - `NSDictionary`: `Map` + * A `FlutterMessageCodec` using the Flutter standard binary encoding. + * + * This codec is guaranteed to be compatible with the corresponding + * [StandardMessageCodec](https://docs.flutter.io/flutter/services/StandardMessageCodec-class.html) + * on the Dart side. These parts of the Flutter SDK are evolved synchronously. + * + * Supported messages are acyclic values of these forms: + * + * - `nil` or `NSNull` + * - `NSNumber` (including their representation of Boolean values) + * - `NSString` + * - `FlutterStandardTypedData` + * - `NSArray` of supported values + * - `NSDictionary` with supported keys and values + * + * On the Dart side, these values are represented as follows: + * + * - `nil` or `NSNull`: null + * - `NSNumber`: `bool`, `int`, or `double`, depending on the contained value. + * - `NSString`: `String` + * - `FlutterStandardTypedData`: `Uint8List`, `Int32List`, `Int64List`, or `Float64List` + * - `NSArray`: `List` + * - `NSDictionary`: `Map` */ FLUTTER_EXPORT @interface FlutterStandardMessageCodec : NSObject @@ -166,39 +166,37 @@ FLUTTER_EXPORT FLUTTER_EXPORT @interface FlutterMethodCall : NSObject /** - Creates a method call for invoking the specified named method with the - specified arguments. - - - Parameters: - - method: the name of the method to call. - - arguments: the arguments value. + * Creates a method call for invoking the specified named method with the + * specified arguments. + * + * @param method the name of the method to call. + * @param arguments the arguments value. */ + (instancetype)methodCallWithMethodName:(NSString*)method arguments:(id _Nullable)arguments; /** - The method name. + * The method name. */ @property(readonly, nonatomic) NSString* method; /** - The arguments. + * The arguments. */ @property(readonly, nonatomic, nullable) id arguments; @end /** - Error object representing an unsuccessful outcome of invoking a method - on a `FlutterMethodChannel`, or an error event on a `FlutterEventChannel`. + * Error object representing an unsuccessful outcome of invoking a method + * on a `FlutterMethodChannel`, or an error event on a `FlutterEventChannel`. */ FLUTTER_EXPORT @interface FlutterError : NSObject /** - Creates a `FlutterError` with the specified error code, message, and details. - - - Parameters: - - code: An error code string for programmatic use. - - message: A human-readable error message. - - details: Custom error details. + * Creates a `FlutterError` with the specified error code, message, and details. + * + * @param code An error code string for programmatic use. + * @param message A human-readable error message. + * @param details Custom error details. */ + (instancetype)errorWithCode:(NSString*)code message:(NSString* _Nullable)message @@ -220,12 +218,12 @@ FLUTTER_EXPORT @end /** - Type of numeric data items encoded in a `FlutterStandardDataType`. - - - FlutterStandardDataTypeUInt8: plain bytes - - FlutterStandardDataTypeInt32: 32-bit signed integers - - FlutterStandardDataTypeInt64: 64-bit signed integers - - FlutterStandardDataTypeFloat64: 64-bit floats + * Type of numeric data items encoded in a `FlutterStandardDataType`. + * + * - FlutterStandardDataTypeUInt8: plain bytes + * - FlutterStandardDataTypeInt32: 32-bit signed integers + * - FlutterStandardDataTypeInt64: 64-bit signed integers + * - FlutterStandardDataTypeFloat64: 64-bit floats */ typedef NS_ENUM(NSInteger, FlutterStandardDataType) { FlutterStandardDataTypeUInt8, @@ -235,174 +233,173 @@ typedef NS_ENUM(NSInteger, FlutterStandardDataType) { }; /** - A byte buffer holding `UInt8`, `SInt32`, `SInt64`, or `Float64` values, used - with `FlutterStandardMessageCodec` and `FlutterStandardMethodCodec`. - - Two's complement encoding is used for signed integers. IEEE754 - double-precision representation is used for floats. The platform's native - endianness is assumed. + * A byte buffer holding `UInt8`, `SInt32`, `SInt64`, or `Float64` values, used + * with `FlutterStandardMessageCodec` and `FlutterStandardMethodCodec`. + * + * Two's complement encoding is used for signed integers. IEEE754 + * double-precision representation is used for floats. The platform's native + * endianness is assumed. */ FLUTTER_EXPORT @interface FlutterStandardTypedData : NSObject /** - Creates a `FlutterStandardTypedData` which interprets the specified data - as plain bytes. - - - Parameter data: the byte data. + * Creates a `FlutterStandardTypedData` which interprets the specified data + * as plain bytes. + * + * @param data the byte data. */ + (instancetype)typedDataWithBytes:(NSData*)data; /** - Creates a `FlutterStandardTypedData` which interprets the specified data - as 32-bit signed integers. - - - Parameter data: the byte data. The length must be divisible by 4. + * Creates a `FlutterStandardTypedData` which interprets the specified data + * as 32-bit signed integers. + * + * @param data the byte data. The length must be divisible by 4. */ + (instancetype)typedDataWithInt32:(NSData*)data; /** - Creates a `FlutterStandardTypedData` which interprets the specified data - as 64-bit signed integers. - - - Parameter data: the byte data. The length must be divisible by 8. + * Creates a `FlutterStandardTypedData` which interprets the specified data + * as 64-bit signed integers. + * + * @param data the byte data. The length must be divisible by 8. */ + (instancetype)typedDataWithInt64:(NSData*)data; /** - Creates a `FlutterStandardTypedData` which interprets the specified data - as 64-bit floats. - - - Parameter data: the byte data. The length must be divisible by 8. + * Creates a `FlutterStandardTypedData` which interprets the specified data + * as 64-bit floats. + * + * @param data the byte data. The length must be divisible by 8. */ + (instancetype)typedDataWithFloat64:(NSData*)data; /** - The raw underlying data buffer. + * The raw underlying data buffer. */ @property(readonly, nonatomic) NSData* data; /** - The type of the encoded values. + * The type of the encoded values. */ @property(readonly, nonatomic) FlutterStandardDataType type; /** - The number of value items encoded. + * The number of value items encoded. */ @property(readonly, nonatomic) UInt32 elementCount; /** - The number of bytes used by the encoding of a single value item. + * The number of bytes used by the encoding of a single value item. */ @property(readonly, nonatomic) UInt8 elementSize; @end /** - An arbitrarily large integer value, used with `FlutterStandardMessageCodec` - and `FlutterStandardMethodCodec`. + * An arbitrarily large integer value, used with `FlutterStandardMessageCodec` + * and `FlutterStandardMethodCodec`. */ FLUTTER_EXPORT -FLUTTER_UNAVAILABLE( - "Unavailable on 2018-08-31. Deprecated on 2018-01-09. " - "FlutterStandardBigInteger was needed because the Dart 1.0 int type had no " - "size limit. With Dart 2.0, the int type is a fixed-size, 64-bit signed " - "integer. If you need to communicate larger integers, use NSString encoding " - "instead.") +FLUTTER_UNAVAILABLE("Unavailable on 2018-08-31. Deprecated on 2018-01-09. " + "FlutterStandardBigInteger was needed because the Dart 1.0 int type had no " + "size limit. With Dart 2.0, the int type is a fixed-size, 64-bit signed " + "integer. If you need to communicate larger integers, use NSString encoding " + "instead.") @interface FlutterStandardBigInteger : NSObject @end /** - A codec for method calls and enveloped results. - - Method calls are encoded as binary messages with enough structure that the - codec can extract a method name `NSString` and an arguments `NSObject`, - possibly `nil`. These data items are used to populate a `FlutterMethodCall`. - - Result envelopes are encoded as binary messages with enough structure that - the codec can determine whether the result was successful or an error. In - the former case, the codec can extract the result `NSObject`, possibly `nil`. - In the latter case, the codec can extract an error code `NSString`, a - human-readable `NSString` error message (possibly `nil`), and a custom - error details `NSObject`, possibly `nil`. These data items are used to - populate a `FlutterError`. + * A codec for method calls and enveloped results. + * + * Method calls are encoded as binary messages with enough structure that the + * codec can extract a method name `NSString` and an arguments `NSObject`, + * possibly `nil`. These data items are used to populate a `FlutterMethodCall`. + * + * Result envelopes are encoded as binary messages with enough structure that + * the codec can determine whether the result was successful or an error. In + * the former case, the codec can extract the result `NSObject`, possibly `nil`. + * In the latter case, the codec can extract an error code `NSString`, a + * human-readable `NSString` error message (possibly `nil`), and a custom + * error details `NSObject`, possibly `nil`. These data items are used to + * populate a `FlutterError`. */ FLUTTER_EXPORT @protocol FlutterMethodCodec /** - Provides access to a shared instance this codec. - - - Returns: The shared instance. + * Provides access to a shared instance this codec. + * + * @return The shared instance. */ + (instancetype)sharedInstance; /** - Encodes the specified method call into binary. - - - Parameter methodCall: The method call. The arguments value - must be supported by this codec. - - Returns: The binary encoding. + * Encodes the specified method call into binary. + * + * @param methodCall The method call. The arguments value + * must be supported by this codec. + * @return The binary encoding. */ - (NSData*)encodeMethodCall:(FlutterMethodCall*)methodCall; /** - Decodes the specified method call from binary. - - - Parameter methodCall: The method call to decode. - - Returns: The decoded method call. + * Decodes the specified method call from binary. + * + * @param methodCall The method call to decode. + * @return The decoded method call. */ - (FlutterMethodCall*)decodeMethodCall:(NSData*)methodCall; /** - Encodes the specified successful result into binary. - - - Parameter result: The result. Must be a value supported by this codec. - - Returns: The binary encoding. + * Encodes the specified successful result into binary. + * + * @param result The result. Must be a value supported by this codec. + * @return The binary encoding. */ - (NSData*)encodeSuccessEnvelope:(id _Nullable)result; /** - Encodes the specified error result into binary. - - - Parameter error: The error object. The error details value must be supported - by this codec. - - Returns: The binary encoding. + * Encodes the specified error result into binary. + * + * @param error The error object. The error details value must be supported + * by this codec. + * @return The binary encoding. */ - (NSData*)encodeErrorEnvelope:(FlutterError*)error; /** - Deccodes the specified result envelope from binary. - - - Parameter error: The error object. - - Returns: The result value, if the envelope represented a successful result, - or a `FlutterError` instance, if not. + * Deccodes the specified result envelope from binary. + * + * @param envelope The error object. + * @return The result value, if the envelope represented a successful result, + * or a `FlutterError` instance, if not. */ - (id _Nullable)decodeEnvelope:(NSData*)envelope; @end /** - A `FlutterMethodCodec` using UTF-8 encoded JSON method calls and result - envelopes. - - This codec is guaranteed to be compatible with the corresponding - [JSONMethodCodec](https://docs.flutter.io/flutter/services/JSONMethodCodec-class.html) - on the Dart side. These parts of the Flutter SDK are evolved synchronously. - - Values supported as methods arguments and result payloads are - those supported as top-level or leaf values by `FlutterJSONMessageCodec`. + * A `FlutterMethodCodec` using UTF-8 encoded JSON method calls and result + * envelopes. + * + * This codec is guaranteed to be compatible with the corresponding + * [JSONMethodCodec](https://docs.flutter.io/flutter/services/JSONMethodCodec-class.html) + * on the Dart side. These parts of the Flutter SDK are evolved synchronously. + * + * Values supported as methods arguments and result payloads are + * those supported as top-level or leaf values by `FlutterJSONMessageCodec`. */ FLUTTER_EXPORT @interface FlutterJSONMethodCodec : NSObject @end /** - A `FlutterMethodCodec` using the Flutter standard binary encoding. - - This codec is guaranteed to be compatible with the corresponding - [StandardMethodCodec](https://docs.flutter.io/flutter/services/StandardMethodCodec-class.html) - on the Dart side. These parts of the Flutter SDK are evolved synchronously. - - Values supported as method arguments and result payloads are those supported by - `FlutterStandardMessageCodec`. + * A `FlutterMethodCodec` using the Flutter standard binary encoding. + * + * This codec is guaranteed to be compatible with the corresponding + * [StandardMethodCodec](https://docs.flutter.io/flutter/services/StandardMethodCodec-class.html) + * on the Dart side. These parts of the Flutter SDK are evolved synchronously. + * + * Values supported as method arguments and result payloads are those supported by + * `FlutterStandardMessageCodec`. */ FLUTTER_EXPORT @interface FlutterStandardMethodCodec : NSObject diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h b/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h index bef67aa04a937..f8850e202db4f 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,43 +9,58 @@ #include "FlutterMacros.h" +/** + * A set of Flutter and Dart assets used by a `FlutterEngine` to initialize execution. + */ FLUTTER_EXPORT @interface FlutterDartProject : NSObject +/** + * Initializes with a specific + */ - (instancetype)initWithPrecompiledDartBundle:(NSBundle*)bundle NS_DESIGNATED_INITIALIZER; +/** + * Initializes with a specific set of Flutter Assets, with a specified location of + * main() and Dart packages. + */ - (instancetype)initWithFlutterAssets:(NSURL*)flutterAssetsURL dartMain:(NSURL*)dartMainURL packages:(NSURL*)dartPackages NS_DESIGNATED_INITIALIZER; +/** + * Initializes from a specific set of Flutter Assets. + */ - (instancetype)initWithFlutterAssetsWithScriptSnapshot:(NSURL*)flutterAssetsURL NS_DESIGNATED_INITIALIZER; +/** + * Unavailable - use `init` instead. + */ - (instancetype)initFromDefaultSourceForConfiguration FLUTTER_UNAVAILABLE("Use -init instead."); /** - Returns the file name for the given asset. - The returned file name can be used to access the asset in the application's main bundle. - - - Parameter asset: The name of the asset. The name can be hierarchical. - - Returns: the file name to be used for lookup in the main bundle. + * Returns the file name for the given asset. + * The returned file name can be used to access the asset in the application's main bundle. + * + * @param asset The name of the asset. The name can be hierarchical. + * @return the file name to be used for lookup in the main bundle. */ + (NSString*)lookupKeyForAsset:(NSString*)asset; /** - Returns the file name for the given asset which originates from the specified package. - The returned file name can be used to access the asset in the application's main bundle. - - - Parameters: - - asset: The name of the asset. The name can be hierarchical. - - package: The name of the package from which the asset originates. - - Returns: the file name to be used for lookup in the main bundle. + * Returns the file name for the given asset which originates from the specified package. + * The returned file name can be used to access the asset in the application's main bundle. + * + * @param asset The name of the asset. The name can be hierarchical. + * @param package The name of the package from which the asset originates. + * @return the file name to be used for lookup in the main bundle. */ + (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package; /** - Returns the default identifier for the bundle where we expect to find the Flutter Dart - application. + * Returns the default identifier for the bundle where we expect to find the Flutter Dart + * application. */ + (NSString*)defaultBundleIdentifier; diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h b/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h new file mode 100644 index 0000000000000..1d435acd80b7f --- /dev/null +++ b/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h @@ -0,0 +1,171 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FLUTTERENGINE_H_ +#define FLUTTER_FLUTTERENGINE_H_ + +#import +#import + +#include "FlutterBinaryMessenger.h" +#include "FlutterDartProject.h" +#include "FlutterMacros.h" +#include "FlutterPlugin.h" +#include "FlutterTexture.h" + +@class FlutterViewController; + +/** + * The FlutterEngine class coordinates a single instance of execution for a + * `FlutterDartProject`. It may have zero or one `FlutterViewController` at a + * time, which can be specified via `-setViewController:`. + * `FlutterViewController`'s `initWithEngine` initializer will automatically call + * `-setViewController:` for itself. + * + * A FlutterEngine can be created independently of a `FlutterViewController` for + * headless execution. It can also persist across the lifespan of multiple + * `FlutterViewController` instances to maintain state and/or asynchronous tasks + * (such as downloading a large file). + * + * Alternatively, you can simply create a new `FlutterViewController` with only a + * `FlutterDartProject`. That `FlutterViewController` will internally manage its + * own instance of a FlutterEngine, but will not guarantee survival of the engine + * beyond the life of the ViewController. + * + * A newly initialized FlutterEngine will not actually run a Dart Isolate until + * either `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI` is invoked. + * One of these methods must be invoked before calling `-setViewController:`. + */ +FLUTTER_EXPORT +@interface FlutterEngine + : NSObject +/** + * Initialize this FlutterEngine with a `FlutterDartProject`. + * + * If the FlutterDartProject is not specified, the FlutterEngine will attempt to locate + * the project in a default location (the flutter_assets folder in the iOS application + * bundle). + * + * A newly initialized engine will not run the `FlutterDartProject` until either + * `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI:` is called. + * + * @param labelPrefix The label prefix used to identify threads for this instance. Should + * be unique across FlutterEngine instances, and is used in instrumentation to label + * the threads used by this FlutterEngine. + * @param projectOrNil The `FlutterDartProject` to run. + */ +- (instancetype)initWithName:(NSString*)labelPrefix + project:(FlutterDartProject*)projectOrNil NS_DESIGNATED_INITIALIZER; + +/** + * The default initializer is not available for this object. + * Callers must use `-[FlutterEngine initWithName:project:]`. + */ +- (instancetype)init NS_UNAVAILABLE; + +/** + * Runs a Dart program on an Isolate from the main Dart library (i.e. the library that + * contains `main()`). + * + * The first call to this method will create a new Isolate. Subsequent calls will return + * immediately. + * + * @param entrypoint The name of a top-level function from the same Dart + * library that contains the app's main() function. If this is nil, it will + * default to `main()`. If it is not the app's main() function, that function + * must be decorated with `@pragma(vm:entry-point)` to ensure the method is not + * tree-shaken by the Dart compiler. + * @return YES if the call succeeds in creating and running a Flutter Engine instance; NO otherwise. + */ +- (BOOL)runWithEntrypoint:(NSString*)entrypoint; + +/** + * Runs a Dart program on an Isolate using the specified entrypoint and Dart library, + * which may not be the same as the library containing the Dart program's `main()` function. + * + * The first call to this method will create a new Isolate. Subsequent calls will return + * immediately. + * + * @param entrypoint The name of a top-level function from a Dart library. If nil, this will + * default to `main()`. If it is not the app's main() function, that function + * must be decorated with `@pragma(vm:entry-point)` to ensure the method is not + * tree-shaken by the Dart compiler. + * @param uri The URI of the Dart library which contains the entrypoint method. IF nil, + * this will default to the same library as the `main()` function in the Dart program. + * @return YES if the call succeeds in creating and running a Flutter Engine instance; NO otherwise. + */ +- (BOOL)runWithEntrypoint:(NSString*)entrypoint libraryURI:(NSString*)uri; + +/** + * Sets the `FlutterViewController` for this instance. The FlutterEngine must be + * running (e.g. a successful call to `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI`) + * before calling this method. Callers may pass nil to remove the viewController + * and have the engine run headless in the current process. + * + * A FlutterEngine can only have one `FlutterViewController` at a time. If there is + * already a `FlutterViewController` associated with this instance, this method will replace + * the engine's current viewController with the newly specified one. + * + * Setting the viewController will signal the engine to start animations and drawing, and unsetting + * it will signal the engine to stop animations and drawing. However, neither will impact the state + * of the Dart program's execution. + */ +@property(nonatomic, weak) FlutterViewController* viewController; + +/** + * The `FlutterMethodChannel` used for localization related platform messages, such as + * setting the locale. + */ +@property(nonatomic, readonly) FlutterMethodChannel* localizationChannel; +/** + * The `FlutterMethodChannel` used for navigation related platform messages. + * + * @see [Navigation + * Channel](https://docs.flutter.io/flutter/services/SystemChannels/navigation-constant.html) + * @see [Navigator Widget](https://docs.flutter.io/flutter/widgets/Navigator-class.html) + */ +@property(nonatomic, readonly) FlutterMethodChannel* navigationChannel; + +/** + * The `FlutterMethodChannel` used for core platform messages, such as + * information about the screen orientation. + */ +@property(nonatomic, readonly) FlutterMethodChannel* platformChannel; + +/** + * The `FlutterMethodChannel` used to communicate text input events to the + * Dart Isolate. + * + * @see [Text Input + * Channel](https://docs.flutter.io/flutter/services/SystemChannels/textInput-constant.html) + */ +@property(nonatomic, readonly) FlutterMethodChannel* textInputChannel; + +/** + * The `FlutterBasicMessageChannel` used to communicate app lifecycle events + * to the Dart Isolate. + * + * @see [Lifecycle + * Channel](https://docs.flutter.io/flutter/services/SystemChannels/lifecycle-constant.html) + */ +@property(nonatomic, readonly) FlutterBasicMessageChannel* lifecycleChannel; + +/** + * The `FlutterBasicMessageChannel` used for communicating system events, such as + * memory pressure events. + * + * @see [System + * Channel](https://docs.flutter.io/flutter/services/SystemChannels/system-constant.html) + */ +@property(nonatomic, readonly) FlutterBasicMessageChannel* systemChannel; + +/** + * The `FlutterBasicMessageChannel` used for communicating user settings such as + * clock format and text scale. + */ +@property(nonatomic, readonly) FlutterBasicMessageChannel* settingsChannel; + +@end + +#endif // FLUTTER_FLUTTERENGINE_H_ diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterHeadlessDartRunner.h b/shell/platform/darwin/ios/framework/Headers/FlutterHeadlessDartRunner.h index f6f37248364ed..e51dc6d5068c0 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterHeadlessDartRunner.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterHeadlessDartRunner.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,44 +9,51 @@ #include "FlutterBinaryMessenger.h" #include "FlutterDartProject.h" +#include "FlutterEngine.h" #include "FlutterMacros.h" /** -A callback for when FlutterHeadlessDartRunner has attempted to start a Dart -Isolate in the background. - -- Parameter success: YES if the Isolate was started and run successfully, NO - otherwise. -*/ + * A callback for when FlutterHeadlessDartRunner has attempted to start a Dart + * Isolate in the background. + * + * @param success YES if the Isolate was started and run successfully, NO + * otherwise. + */ typedef void (^FlutterHeadlessDartRunnerCallback)(BOOL success); /** - The FlutterHeadlessDartRunner runs Flutter Dart code with a null rasterizer, - and no native drawing surface. It is appropriate for use in running Dart - code e.g. in the background from a plugin. -*/ + * The FlutterHeadlessDartRunner runs Flutter Dart code with a null rasterizer, + * and no native drawing surface. It is appropriate for use in running Dart + * code e.g. in the background from a plugin. + * + * Most callers should prefer using `FlutterEngine` directly; this interface exists + * for legacy support. + */ FLUTTER_EXPORT -@interface FlutterHeadlessDartRunner : NSObject +FLUTTER_DEPRECATED("FlutterEngine should be used rather than FlutterHeadlessDartRunner") +@interface FlutterHeadlessDartRunner : FlutterEngine /** - Runs a Dart function on an Isolate that is not the main application's Isolate. - The first call will create a new Isolate. Subsequent calls will return - immediately. - - - Parameter entrypoint: The name of a top-level function from the same Dart - library that contains the app's main() function. -*/ -- (void)runWithEntrypoint:(NSString*)entrypoint; + * Iniitalize this FlutterHeadlessDartRunner with a `FlutterDartProject`. + * + * If the FlutterDartProject is not specified, the FlutterHeadlessDartRunner will attempt to locate + * the project in a default location. + * + * A newly initialized engine will not run the `FlutterDartProject` until either + * `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI` is called. + * + * @param labelPrefix The label prefix used to identify threads for this instance. Should + * be unique across FlutterEngine instances + * @param projectOrNil The `FlutterDartProject` to run. + */ +- (instancetype)initWithName:(NSString*)labelPrefix + project:(FlutterDartProject*)projectOrNil NS_DESIGNATED_INITIALIZER; /** - Runs a Dart function on an Isolate that is not the main application's Isolate. - The first call will create a new Isolate. Subsequent calls will return - immediately. - - - Parameter entrypoint: The name of a top-level function from a Dart library. - - Parameter uri: The URI of the Dart library which contains entrypoint. -*/ -- (void)runWithEntrypointAndLibraryUri:(NSString*)entrypoint libraryUri:(NSString*)uri; + * Not recommended for use - will initialize with a default label ("io.flutter.headless") + * and the default FlutterDartProject. + */ +- (instancetype)init; @end diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h b/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h index e3050963192e1..51b27bb789d6e 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,19 +21,19 @@ #endif // defined(NS_ASSUME_NONNULL_BEGIN) /** - Indicates that the API has been deprecated for the specified reason. Code that - uses the deprecated API will continue to work as before. However, the API will - soon become unavailable and users are encouraged to immediately take the - appropriate action mentioned in the deprecation message and the BREAKING - CHANGES section present in the Flutter.h umbrella header. + * Indicates that the API has been deprecated for the specified reason. Code + * that uses the deprecated API will continue to work as before. However, the + * API will soon become unavailable and users are encouraged to immediately take + * the appropriate action mentioned in the deprecation message and the BREAKING + * CHANGES section present in the Flutter.h umbrella header. */ #define FLUTTER_DEPRECATED(msg) __attribute__((__deprecated__(msg))) /** - Indicates that the previously deprecated API is now unavailable. Code that - uses the API will not work and the declaration of the API is only a stub meant - to display the given message detailing the actions for the user to take - immediately. + * Indicates that the previously deprecated API is now unavailable. Code that + * uses the API will not work and the declaration of the API is only a stub + * meant to display the given message detailing the actions for the user to take + * immediately. */ #define FLUTTER_UNAVAILABLE(msg) __attribute__((__unavailable__(msg))) diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterNavigationController.h b/shell/platform/darwin/ios/framework/Headers/FlutterNavigationController.h deleted file mode 100644 index 1ff0911bd685d..0000000000000 --- a/shell/platform/darwin/ios/framework/Headers/FlutterNavigationController.h +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import - -@interface FlutterNavigationController : UINavigationController - -@end diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterPlatformViews.h b/shell/platform/darwin/ios/framework/Headers/FlutterPlatformViews.h new file mode 100644 index 0000000000000..72086dec13a83 --- /dev/null +++ b/shell/platform/darwin/ios/framework/Headers/FlutterPlatformViews.h @@ -0,0 +1,56 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FLUTTERPLATFORMVIEWS_H_ +#define FLUTTER_FLUTTERPLATFORMVIEWS_H_ + +#import + +#import "FlutterCodecs.h" +#import "FlutterMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Wraps a `UIView` for embedding in the Flutter hierarchy + */ +@protocol FlutterPlatformView +/** + * Returns a reference to the `UIView` that is wrapped by this `FlutterPlatformView`. + */ +- (UIView*)view; +@end + +FLUTTER_EXPORT +@protocol FlutterPlatformViewFactory +/** + * Create a `FlutterPlatformView`. + * + * Implemented by iOS code that expose a `UIView` for embedding in a Flutter app. + * + * The implementation of this method should create a new `UIView` and return it. + * + * @param frame The rectangle for the newly created `UIView` measued in points. + * @param viewId A unique identifier for this `UIView`. + * @param args Parameters for creating the `UIView` sent from the Dart side of the Flutter app. + * If `createArgsCodec` is not implemented, or if no creation arguments were sent from the Dart + * code, this will be null. Otherwise this will be the value sent from the Dart code as decoded by + * `createArgsCodec`. + */ +- (NSObject*)createWithFrame:(CGRect)frame + viewIdentifier:(int64_t)viewId + arguments:(id _Nullable)args; + +/** + * Returns the `FlutterMessageCodec` for decoding the args parameter of `createWithFrame`. + * + * Only needs to be implemented if `createWithFrame` needs an arguments parameter. + */ +@optional +- (NSObject*)createArgsCodec; +@end + +NS_ASSUME_NONNULL_END + +#endif // FLUTTER_FLUTTERPLATFORMVIEWS_H_ diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h b/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h index 799aa90fa0b30..bc6997f48b2be 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,85 +6,85 @@ #define FLUTTER_FLUTTERPLUGIN_H_ #import +#import #include "FlutterBinaryMessenger.h" #include "FlutterChannels.h" #include "FlutterCodecs.h" +#include "FlutterPlatformViews.h" #include "FlutterTexture.h" NS_ASSUME_NONNULL_BEGIN @protocol FlutterPluginRegistrar; /** - Implemented by the iOS part of a Flutter plugin. - - Defines a set of optional callback methods and a method to set up the plugin - and register it to be called by other application components. + * Implemented by the iOS part of a Flutter plugin. + * + * Defines a set of optional callback methods and a method to set up the plugin + * and register it to be called by other application components. */ @protocol FlutterPlugin @required /** - Registers this plugin using the context information and callback registration - methods exposed by the given registrar. - - The registrar is obtained from a `FlutterPluginRegistry` which keeps track of - the identity of registered plugins and provides basic support for cross-plugin - coordination. - - The caller of this method, a plugin registrant, is usually autogenerated by - Flutter tooling based on declared plugin dependencies. The generated registrant - asks the registry for a registrar for each plugin, and calls this method to - allow the plugin to initialize itself and register callbacks with application - objects available through the registrar protocol. - - - Parameters: - - registrar: A helper providing application context and methods for - registering callbacks. + * Registers this plugin using the context information and callback registration + * methods exposed by the given registrar. + * + * The registrar is obtained from a `FlutterPluginRegistry` which keeps track of + * the identity of registered plugins and provides basic support for cross-plugin + * coordination. + * + * The caller of this method, a plugin registrant, is usually autogenerated by + * Flutter tooling based on declared plugin dependencies. The generated registrant + * asks the registry for a registrar for each plugin, and calls this method to + * allow the plugin to initialize itself and register callbacks with application + * objects available through the registrar protocol. + * + * @param registrar A helper providing application context and methods for + * registering callbacks. */ + (void)registerWithRegistrar:(NSObject*)registrar; @optional /** - Called if this plugin has been registered to receive `FlutterMethodCall`s. - - - Parameters: - - call: The method call command object. - - result: A callback for submitting the result of the call. + * Called if this plugin has been registered to receive `FlutterMethodCall`s. + * + * @param call The method call command object. + * @param result A callback for submitting the result of the call. */ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result; /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. - - - Returns: `NO` if this plugin vetoes application launch. + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * + * @return `NO` if this plugin vetoes application launch. */ - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions; /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. - - - Returns: `NO` if this plugin vetoes application launch. + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * + * @return `NO` if this plugin vetoes application launch. */ - (BOOL)application:(UIApplication*)application willFinishLaunchingWithOptions:(NSDictionary*)launchOptions; /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. */ - (void)applicationDidBecomeActive:(UIApplication*)application; /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. */ - (void)applicationWillResignActive:(UIApplication*)application; /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. */ - (void)applicationDidEnterBackground:(UIApplication*)application; /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. */ - (void)applicationWillEnterForeground:(UIApplication*)application; @@ -94,83 +94,101 @@ NS_ASSUME_NONNULL_BEGIN - (void)applicationWillTerminate:(UIApplication*)application; /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - (void)application:(UIApplication*)application didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings; +#pragma GCC diagnostic pop /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. */ - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken; /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. - - - Returns: `YES` if this plugin handles the request. + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * + * @return `YES` if this plugin handles the request. */ - (BOOL)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler; /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * Calls all plugins registered for `UIApplicationDelegate` callbacks. + */ +- (void)application:(UIApplication*)application + didReceiveLocalNotification:(UILocalNotification*)notification; + +/** + * Calls all plugins registered for `UNUserNotificationCenterDelegate` callbacks. + */ +- (void)userNotificationCenter:(UNUserNotificationCenter*)center + willPresentNotification:(UNNotification*)notification + withCompletionHandler: + (void (^)(UNNotificationPresentationOptions options))completionHandler + API_AVAILABLE(ios(10)); - - Returns: `YES` if this plugin handles the request. -*/ +/** + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * + * @return `YES` if this plugin handles the request. + */ - (BOOL)application:(UIApplication*)application openURL:(NSURL*)url options:(NSDictionary*)options; /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. - - - Returns: `YES` if this plugin handles the request. + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * + * @return `YES` if this plugin handles the request. */ - (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url; /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. - - - Returns: `YES` if this plugin handles the request. -*/ + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * + * @return `YES` if this plugin handles the request. + */ - (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation; /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. - - - Returns: `YES` if this plugin handles the request. -*/ + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * + * @return `YES` if this plugin handles the request. + */ - (BOOL)application:(UIApplication*)application performActionForShortcutItem:(UIApplicationShortcutItem*)shortcutItem completionHandler:(void (^)(BOOL succeeded))completionHandler API_AVAILABLE(ios(9.0)); /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. - - - Returns: `YES` if this plugin handles the request. + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * + * @return `YES` if this plugin handles the request. */ - (BOOL)application:(UIApplication*)application handleEventsForBackgroundURLSession:(nonnull NSString*)identifier completionHandler:(nonnull void (^)(void))completionHandler; /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. - - - Returns: `YES` if this plugin handles the request. + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * + * @return `YES` if this plugin handles the request. */ - (BOOL)application:(UIApplication*)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler; /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. - - - Returns: `YES` if this plugin handles the request. + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * + * @return `YES` if this plugin handles the request. */ - (BOOL)application:(UIApplication*)application continueUserActivity:(NSUserActivity*)userActivity @@ -178,133 +196,144 @@ NS_ASSUME_NONNULL_BEGIN @end /** - Registration context for a single `FlutterPlugin`, providing a one stop shop - for the plugin to access contextual information and register callbacks for - various application events. - - Registrars are obtained from a `FlutterPluginRegistry` which keeps track of - the identity of registered plugins and provides basic support for cross-plugin - coordination. + *Registration context for a single `FlutterPlugin`, providing a one stop shop + *for the plugin to access contextual information and register callbacks for + *various application events. + * + *Registrars are obtained from a `FlutterPluginRegistry` which keeps track of + *the identity of registered plugins and provides basic support for cross-plugin + *coordination. */ @protocol FlutterPluginRegistrar /** - Returns a `FlutterBinaryMessenger` for creating Dart/iOS communication - channels to be used by the plugin. - - - Returns: The messenger. + * Returns a `FlutterBinaryMessenger` for creating Dart/iOS communication + * channels to be used by the plugin. + * + * @return The messenger. */ - (NSObject*)messenger; /** - Returns a `FlutterTextureRegistry` for registering textures - provided by the plugin. - - - Returns: The texture registry. + * Returns a `FlutterTextureRegistry` for registering textures + * provided by the plugin. + * + * @return The texture registry. */ - (NSObject*)textures; /** - Publishes a value for external use of the plugin. - - Plugins may publish a single value, such as an instance of the - plugin's main class, for situations where external control or - interaction is needed. - - The published value will be available from the `FlutterPluginRegistry`. - Repeated calls overwrite any previous publication. - - - Parameter value: The value to be published. + * Registers a `FlutterPlatformViewFactory` for creation of platfrom views. + * + * Plugins expose `UIView` for embedding in Flutter apps by registering a view factory. + * + * @param factory The view factory that will be registered. + * @param factoryId A unique identifier for the factory, the Dart code of the Flutter app can use + * this identifier to request creation of a `UIView` by the registered factory. + */ +- (void)registerViewFactory:(NSObject*)factory + withId:(NSString*)factoryId; + +/** + * Publishes a value for external use of the plugin. + * + * Plugins may publish a single value, such as an instance of the + * plugin's main class, for situations where external control or + * interaction is needed. + * + * The published value will be available from the `FlutterPluginRegistry`. + * Repeated calls overwrite any previous publication. + * + * @param value The value to be published. */ - (void)publish:(NSObject*)value; /** - Registers the plugin as a receiver of incoming method calls from the Dart side - on the specified `FlutterMethodChannel`. - - - Parameters: - - delegate: The receiving object, such as the plugin's main class. - - channel: The channel + * Registers the plugin as a receiver of incoming method calls from the Dart side + * on the specified `FlutterMethodChannel`. + * + * @param delegate The receiving object, such as the plugin's main class. + * @param channel The channel */ - (void)addMethodCallDelegate:(NSObject*)delegate channel:(FlutterMethodChannel*)channel; /** - Registers the plugin as a receiver of `UIApplicationDelegate` calls. - - - Parameters delegate: The receiving object, such as the plugin's main class. + * Registers the plugin as a receiver of `UIApplicationDelegate` calls. + * + * @param delegate The receiving object, such as the plugin's main class. */ - (void)addApplicationDelegate:(NSObject*)delegate; /** - Returns the file name for the given asset. - The returned file name can be used to access the asset in the application's main bundle. - - - Parameter asset: The name of the asset. The name can be hierarchical. - - Returns: the file name to be used for lookup in the main bundle. + * Returns the file name for the given asset. + * The returned file name can be used to access the asset in the application's main bundle. + * + * @param asset The name of the asset. The name can be hierarchical. + * @return the file name to be used for lookup in the main bundle. */ - (NSString*)lookupKeyForAsset:(NSString*)asset; /** - Returns the file name for the given asset which originates from the specified package. - The returned file name can be used to access the asset in the application's main bundle. - - - Parameters: - - asset: The name of the asset. The name can be hierarchical. - - package: The name of the package from which the asset originates. - - Returns: the file name to be used for lookup in the main bundle. + * Returns the file name for the given asset which originates from the specified package. + * The returned file name can be used to access the asset in the application's main bundle. + * + * + * @param asset The name of the asset. The name can be hierarchical. + * @param package The name of the package from which the asset originates. + * @return the file name to be used for lookup in the main bundle. */ - (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package; @end /** - A registry of Flutter iOS plugins. - - Plugins are identified by unique string keys, typically the name of the - plugin's main class. The registry tracks plugins by this key, mapping it to - a value published by the plugin during registration, if any. This provides a - very basic means of cross-plugin coordination with loose coupling between - unrelated plugins. - - Plugins typically need contextual information and the ability to register - callbacks for various application events. To keep the API of the registry - focused, these facilities are not provided directly by the registry, but by - a `FlutterPluginRegistrar`, created by the registry in exchange for the unique - key of the plugin. - - There is no implied connection between the registry and the registrar. - Specifically, callbacks registered by the plugin via the registrar may be - relayed directly to the underlying iOS application objects. + * A registry of Flutter iOS plugins. + * + * Plugins are identified by unique string keys, typically the name of the + * plugin's main class. The registry tracks plugins by this key, mapping it to + * a value published by the plugin during registration, if any. This provides a + * very basic means of cross-plugin coordination with loose coupling between + * unrelated plugins. + * + * Plugins typically need contextual information and the ability to register + * callbacks for various application events. To keep the API of the registry + * focused, these facilities are not provided directly by the registry, but by + * a `FlutterPluginRegistrar`, created by the registry in exchange for the unique + * key of the plugin. + * + * There is no implied connection between the registry and the registrar. + * Specifically, callbacks registered by the plugin via the registrar may be + * relayed directly to the underlying iOS application objects. */ @protocol FlutterPluginRegistry /** - Returns a registrar for registering a plugin. - - - Parameter pluginKey: The unique key identifying the plugin. + * Returns a registrar for registering a plugin. + * + * @param pluginKey The unique key identifying the plugin. */ - (NSObject*)registrarForPlugin:(NSString*)pluginKey; /** - Returns whether the specified plugin has been registered. - - - Parameter pluginKey: The unique key identifying the plugin. - - Returns: `YES` if `registrarForPlugin` has been called with `pluginKey`. + * Returns whether the specified plugin has been registered. + * + * @param pluginKey The unique key identifying the plugin. + * @return `YES` if `registrarForPlugin` has been called with `pluginKey`. */ - (BOOL)hasPlugin:(NSString*)pluginKey; /** - Returns a value published by the specified plugin. - - - Parameter pluginKey: The unique key identifying the plugin. - - Returns: An object published by the plugin, if any. Will be `NSNull` if - nothing has been published. Will be `nil` if the plugin has not been - registered. + * Returns a value published by the specified plugin. + * + * @param pluginKey The unique key identifying the plugin. + * @return An object published by the plugin, if any. Will be `NSNull` if + * nothing has been published. Will be `nil` if the plugin has not been + * registered. */ - (NSObject*)valuePublishedByPlugin:(NSString*)pluginKey; @end /** - Implement this in the `UIAppDelegate` of your app to enable Flutter plugins to register themselves - to the application life cycle events. -*/ + * Implement this in the `UIAppDelegate` of your app to enable Flutter plugins to register + * themselves to the application life cycle events. + */ @protocol FlutterAppLifeCycleProvider - (void)addApplicationLifeCycleDelegate:(NSObject*)delegate; @end diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h b/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h index 8c9c0358669ed..a8dda282b56fd 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,139 +10,158 @@ NS_ASSUME_NONNULL_BEGIN /** - Propagates `UIAppDelegate` callbacks to registered plugins. -*/ + * Propagates `UIAppDelegate` callbacks to registered plugins. + */ FLUTTER_EXPORT @interface FlutterPluginAppLifeCycleDelegate : NSObject /** - Registers `delegate` to receive life cycle callbacks via this FlutterPluginAppLifecycleDelegate as - long as it is alive. - - `delegate` will only referenced weakly. -*/ + * Registers `delegate` to receive life cycle callbacks via this FlutterPluginAppLifecycleDelegate + * as long as it is alive. + * + * `delegate` will only referenced weakly. + */ - (void)addDelegate:(NSObject*)delegate; /** - Calls all plugins registered for `UIApplicationDelegate` callbacks. - - - Returns: `NO` if any plugin vetoes application launch. + * Calls all plugins registered for `UIApplicationDelegate` callbacks. + * + * @return `NO` if any plugin vetoes application launch. */ - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions; /** - Calls all plugins registered for `UIApplicationDelegate` callbacks. - - - Returns: `NO` if any plugin vetoes application launch. + * Calls all plugins registered for `UIApplicationDelegate` callbacks. + * + * @return `NO` if any plugin vetoes application launch. */ - (BOOL)application:(UIApplication*)application willFinishLaunchingWithOptions:(NSDictionary*)launchOptions; /** - Calls all plugins registered for `UIApplicationDelegate` callbacks. + * Calls all plugins registered for `UIApplicationDelegate` callbacks. */ - (void)applicationDidBecomeActive:(UIApplication*)application; /** - Calls all plugins registered for `UIApplicationDelegate` callbacks. + * Calls all plugins registered for `UIApplicationDelegate` callbacks. */ - (void)applicationWillResignActive:(UIApplication*)application; /** - Calls all plugins registered for `UIApplicationDelegate` callbacks. + * Calls all plugins registered for `UIApplicationDelegate` callbacks. */ - (void)applicationDidEnterBackground:(UIApplication*)application; /** - Calls all plugins registered for `UIApplicationDelegate` callbacks. + * Calls all plugins registered for `UIApplicationDelegate` callbacks. */ - (void)applicationWillEnterForeground:(UIApplication*)application; /** - Calls all plugins registered for `UIApplicationDelegate` callbacks. + * Calls all plugins registered for `UIApplicationDelegate` callbacks. */ - (void)applicationWillTerminate:(UIApplication*)application; /** - Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - (void)application:(UIApplication*)application didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings; +#pragma GCC diagnostic pop /** - Calls all plugins registered for `UIApplicationDelegate` callbacks. + * Calls all plugins registered for `UIApplicationDelegate` callbacks. */ - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken; /** - Calls all plugins registered for `UIApplicationDelegate` callbacks. + * Calls all plugins registered for `UIApplicationDelegate` callbacks. */ - (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler; /** - Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until - some plugin handles the request. + * Calls all plugins registered for `UIApplicationDelegate` callbacks. + */ +- (void)application:(UIApplication*)application + didReceiveLocalNotification:(UILocalNotification*)notification; - - Returns: `YES` if any plugin handles the request. -*/ +/** + * Calls all plugins registered for `UNUserNotificationCenterDelegate` callbacks. + */ +- (void)userNotificationCenter:(UNUserNotificationCenter*)center + willPresentNotification:(UNNotification*)notification + withCompletionHandler: + (void (^)(UNNotificationPresentationOptions options))completionHandler + API_AVAILABLE(ios(10)); + +/** + * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until + * some plugin handles the request. + * + * @return `YES` if any plugin handles the request. + */ - (BOOL)application:(UIApplication*)application openURL:(NSURL*)url options:(NSDictionary*)options; /** - Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until - some plugin handles the request. - - - Returns: `YES` if any plugin handles the request. + * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until + * some plugin handles the request. + * + * @return `YES` if any plugin handles the request. */ - (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url; /** - Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until - some plugin handles the request. - - - Returns: `YES` if any plugin handles the request. -*/ + * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until + * some plugin handles the request. + * + * @return `YES` if any plugin handles the request. + */ - (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation; /** - Calls all plugins registered for `UIApplicationDelegate` callbacks. -*/ + * Calls all plugins registered for `UIApplicationDelegate` callbacks. + */ - (void)application:(UIApplication*)application performActionForShortcutItem:(UIApplicationShortcutItem*)shortcutItem completionHandler:(void (^)(BOOL succeeded))completionHandler API_AVAILABLE(ios(9.0)); /** - Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until - some plugin handles the request. - - - Returns: `YES` if any plugin handles the request. -*/ + * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until + * some plugin handles the request. + * + * @return `YES` if any plugin handles the request. + */ - (BOOL)application:(UIApplication*)application handleEventsForBackgroundURLSession:(nonnull NSString*)identifier completionHandler:(nonnull void (^)(void))completionHandler; /** - Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until - some plugin handles the request. - - - Returns: `YES` if any plugin handles the request. -*/ + * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until + * some plugin handles the request. + * + * @returns `YES` if any plugin handles the request. + */ - (BOOL)application:(UIApplication*)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler; /** - Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until - some plugin handles the request. - - Returns: `YES` if any plugin handles the request. -*/ + * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until + * some plugin handles the request. + * + * @return `YES` if any plugin handles the request. + */ - (BOOL)application:(UIApplication*)application continueUserActivity:(NSUserActivity*)userActivity restorationHandler:(void (^)(NSArray*))restorationHandler; diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterTexture.h b/shell/platform/darwin/ios/framework/Headers/FlutterTexture.h index f2b8670a8a9e2..e7cd01337deb9 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterTexture.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterTexture.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,12 +13,12 @@ NS_ASSUME_NONNULL_BEGIN FLUTTER_EXPORT -@protocol FlutterTexture +@protocol FlutterTexture - (CVPixelBufferRef _Nullable)copyPixelBuffer; @end FLUTTER_EXPORT -@protocol FlutterTextureRegistry +@protocol FlutterTextureRegistry - (int64_t)registerTexture:(NSObject*)texture; - (void)textureFrameAvailable:(int64_t)textureId; - (void)unregisterTexture:(int64_t)textureId; diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h b/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h index 2e8b02d05195f..53f3adc855d5d 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,14 +10,52 @@ #include "FlutterBinaryMessenger.h" #include "FlutterDartProject.h" +#include "FlutterEngine.h" #include "FlutterMacros.h" #include "FlutterPlugin.h" #include "FlutterTexture.h" +@class FlutterEngine; + +/** + * A `UIViewController` implementation for Flutter views. + * + * Dart execution, channel communication, texture registration, and plugin registration + * are all handled by `FlutterEngine`. Calls on this class to those members all proxy + * through to the `FlutterEngine` attached FlutterViewController. + * + * A FlutterViewController can be initialized either with an already-running `FlutterEngine`, + * or it can be initialized with a `FlutterDartProject` that will be used to spin up + * a new `FlutterEngine`. Developers looking to present and hide FlutterViewControllers + * in native iOS applications will usually want to maintain the `FlutterEngine` instance + * so as not to lose Dart-related state and asynchronous tasks when navigating back and + * forth between a FlutterViewController and other `UIViewController`s. + */ FLUTTER_EXPORT @interface FlutterViewController : UIViewController +/** + * Initializes this FlutterViewController with the specified `FlutterEngine`. + * + * The initialized viewcontroller will attach itself to the engine as part of this process. + * + * @param engine The `FlutterEngine` instance to attach to. + * @param nibNameOrNil The NIB name to initialize this UIViewController with. + * @param nibBundleOrNil The NIB bundle. + */ +- (instancetype)initWithEngine:(FlutterEngine*)engine + nibName:(NSString*)nibNameOrNil + bundle:(NSBundle*)nibBundleOrNil NS_DESIGNATED_INITIALIZER; + +/** + * Initializes a new FlutterViewController and `FlutterEngine` with the specified + * `FlutterDartProject`. + * + * @param projectOrNil The `FlutterDartProject` to initialize the `FlutterEngine` with. + * @param nibNameOrNil The NIB name to initialize this UIViewController with. + * @param nibBundleOrNil The NIB bundle. + */ - (instancetype)initWithProject:(FlutterDartProject*)projectOrNil nibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil NS_DESIGNATED_INITIALIZER; @@ -25,65 +63,93 @@ FLUTTER_EXPORT - (void)handleStatusBarTouches:(UIEvent*)event; /** - Returns the file name for the given asset. - The returned file name can be used to access the asset in the application's main bundle. + * Registers a callback that will be invoked when the Flutter view has been rendered. + * The callback will be fired only once. + * + * Replaces an existing callback. Use a `nil` callback to unregister the existing one. + */ +- (void)setFlutterViewDidRenderCallback:(void (^)(void))callback; - - Parameter asset: The name of the asset. The name can be hierarchical. - - Returns: the file name to be used for lookup in the main bundle. +/** + * Returns the file name for the given asset. + * The returned file name can be used to access the asset in the application's + * main bundle. + * + * @param asset The name of the asset. The name can be hierarchical. + * @return The file name to be used for lookup in the main bundle. */ - (NSString*)lookupKeyForAsset:(NSString*)asset; /** - Returns the file name for the given asset which originates from the specified package. - The returned file name can be used to access the asset in the application's main bundle. - - - Parameters: - - asset: The name of the asset. The name can be hierarchical. - - package: The name of the package from which the asset originates. - - Returns: the file name to be used for lookup in the main bundle. + * Returns the file name for the given asset which originates from the specified + * package. + * The returned file name can be used to access the asset in the application's + * main bundle. + * + * @param asset The name of the asset. The name can be hierarchical. + * @param package The name of the package from which the asset originates. + * @return The file name to be used for lookup in the main bundle. */ - (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package; /** - Sets the first route that the Flutter app shows. The default is "/". - This method will guarnatee that the initial route is delivered, even if the - Flutter window hasn't been created yet when called. It cannot be used to update - the current route being shown in a visible FlutterViewController (see pushRoute - and popRoute). - - - Parameter route: The name of the first route to show. + * Sets the first route that the Flutter app shows. The default is "/". + * This method will guarnatee that the initial route is delivered, even if the + * Flutter window hasn't been created yet when called. It cannot be used to update + * the current route being shown in a visible FlutterViewController (see pushRoute + * and popRoute). + * + * @param route The name of the first route to show. */ - (void)setInitialRoute:(NSString*)route; /** - Instructs the Flutter Navigator (if any) to go back. + * Instructs the Flutter Navigator (if any) to go back. */ - (void)popRoute; /** - Instructs the Flutter Navigator (if any) to push a route on to the navigation - stack. The setInitialRoute method should be prefered if this is called before the - FlutterViewController has come into view. - - - Parameter route: The name of the route to push to the navigation stack. + * Instructs the Flutter Navigator (if any) to push a route on to the navigation + * stack. The setInitialRoute method should be prefered if this is called before the + * FlutterViewController has come into view. + * + * @param route The name of the route to push to the navigation stack. */ - (void)pushRoute:(NSString*)route; +/** + * The `FlutterPluginRegistry` used by this FlutterViewController. + */ - (id)pluginRegistry; /** - Specifies the view to use as a splash screen. Flutter's rendering is asynchronous, so the first - frame rendered by the Flutter application might not immediately appear when the Flutter view is - initially placed in the view hierarchy. The splash screen view will be used as a replacement - until the first frame is rendered. + * Specifies the view to use as a splash screen. Flutter's rendering is asynchronous, so the first + * frame rendered by the Flutter application might not immediately appear when theFlutter view is + * initially placed in the view hierarchy. The splash screen view will be used as + * a replacement until the first frame is rendered. + * + * The view used should be appropriate for multiple sizes; an autoresizing mask to + * have a flexible width and height will be applied automatically. + */ +@property(strong, nonatomic) UIView* splashScreenView; - The view used should be appropriate for multiple sizes; an autoresizing mask to have a flexible - width and height will be applied automatically. +/** + * Attempts to set the `splashScreenView` property from the `UILaunchStoryboardName` from the + * main bundle's `Info.plist` file. This method will not change the value of `splashScreenView` + * if it cannot find a default one from a storyboard or nib. + * + * @return `YES` if successful, `NO` otherwise. + */ +- (BOOL)loadDefaultSplashScreenView; - If not specified, uses a view generated from `UILaunchStoryboardName` from the main bundle's - `Info.plist` file. +/** + * Controls whether the created view will be opaque or not. + * + * Default is `YES`. Note that setting this to `NO` may negatively impact performance + * when using hardware acceleration, and toggling this will trigger a re-layout of the + * view. */ -@property(strong, nonatomic) UIView* splashScreenView; +@property(nonatomic, getter=isViewOpaque) BOOL viewOpaque; @end diff --git a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm index a7921be5c6d32..f3f1786e4555a 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -71,11 +71,14 @@ - (void)applicationWillTerminate:(UIApplication*)application { [_lifeCycleDelegate applicationWillTerminate:application]; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - (void)application:(UIApplication*)application didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings { [_lifeCycleDelegate application:application didRegisterUserNotificationSettings:notificationSettings]; } +#pragma GCC diagnostic pop - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken { @@ -91,6 +94,23 @@ - (void)application:(UIApplication*)application fetchCompletionHandler:completionHandler]; } +- (void)application:(UIApplication*)application + didReceiveLocalNotification:(UILocalNotification*)notification { + [_lifeCycleDelegate application:application didReceiveLocalNotification:notification]; +} + +- (void)userNotificationCenter:(UNUserNotificationCenter*)center + willPresentNotification:(UNNotification*)notification + withCompletionHandler: + (void (^)(UNNotificationPresentationOptions options))completionHandler + API_AVAILABLE(ios(10)) { + if (@available(iOS 10.0, *)) { + [_lifeCycleDelegate userNotificationCenter:center + willPresentNotification:notification + withCompletionHandler:completionHandler]; + } +} + - (BOOL)application:(UIApplication*)application openURL:(NSURL*)url options:(NSDictionary*)options { diff --git a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate_Internal.h index c01a33d6f3266..999e56c534ac0 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate_Internal.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache.mm b/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache.mm index eb353e019bed4..562155d319130 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache.mm @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache_Internal.h index 553c485dc2e9d..5bb2e7bf7646e 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache_Internal.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterChannels.mm b/shell/platform/darwin/ios/framework/Source/FlutterChannels.mm index c9a75b0f49c67..732c983f0e3b1 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterChannels.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterChannels.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,9 +21,9 @@ + (instancetype)messageChannelWithName:(NSString*)name + (instancetype)messageChannelWithName:(NSString*)name binaryMessenger:(NSObject*)messenger codec:(NSObject*)codec { - return - [[[FlutterBasicMessageChannel alloc] initWithName:name binaryMessenger:messenger codec:codec] - autorelease]; + return [[[FlutterBasicMessageChannel alloc] initWithName:name + binaryMessenger:messenger + codec:codec] autorelease]; } - (instancetype)initWithName:(NSString*)name @@ -162,8 +162,8 @@ + (instancetype)methodChannelWithName:(NSString*)name + (instancetype)methodChannelWithName:(NSString*)name binaryMessenger:(NSObject*)messenger codec:(NSObject*)codec { - return [[[FlutterMethodChannel alloc] initWithName:name binaryMessenger:messenger codec:codec] - autorelease]; + return [[[FlutterMethodChannel alloc] initWithName:name binaryMessenger:messenger + codec:codec] autorelease]; } - (instancetype)initWithName:(NSString*)name @@ -185,15 +185,15 @@ - (void)dealloc { } - (void)invokeMethod:(NSString*)method arguments:(id)arguments { - FlutterMethodCall* methodCall = - [FlutterMethodCall methodCallWithMethodName:method arguments:arguments]; + FlutterMethodCall* methodCall = [FlutterMethodCall methodCallWithMethodName:method + arguments:arguments]; NSData* message = [_codec encodeMethodCall:methodCall]; [_messenger sendOnChannel:_name message:message]; } - (void)invokeMethod:(NSString*)method arguments:(id)arguments result:(FlutterResult)callback { - FlutterMethodCall* methodCall = - [FlutterMethodCall methodCallWithMethodName:method arguments:arguments]; + FlutterMethodCall* methodCall = [FlutterMethodCall methodCallWithMethodName:method + arguments:arguments]; NSData* message = [_codec encodeMethodCall:methodCall]; FlutterBinaryReply reply = ^(NSData* data) { if (callback) { @@ -241,8 +241,8 @@ + (instancetype)eventChannelWithName:(NSString*)name + (instancetype)eventChannelWithName:(NSString*)name binaryMessenger:(NSObject*)messenger codec:(NSObject*)codec { - return [[[FlutterEventChannel alloc] initWithName:name binaryMessenger:messenger codec:codec] - autorelease]; + return [[[FlutterEventChannel alloc] initWithName:name binaryMessenger:messenger + codec:codec] autorelease]; } - (instancetype)initWithName:(NSString*)name @@ -256,6 +256,13 @@ - (instancetype)initWithName:(NSString*)name return self; } +- (void)dealloc { + [_name release]; + [_codec release]; + [_messenger release]; + [super dealloc]; +} + - (void)setStreamHandler:(NSObject*)handler { if (!handler) { [_messenger setMessageHandlerOnChannel:_name binaryMessageHandler:nil]; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterCodecs.mm b/shell/platform/darwin/ios/framework/Source/FlutterCodecs.mm index e49ec86aadff1..0c2340038b828 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterCodecs.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterCodecs.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index 22d39950d93f1..0e5bf4fdcbf8a 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -193,7 +193,24 @@ - (instancetype)initWithFlutterAssetsWithScriptSnapshot:(NSURL*)flutterAssetsURL } - (shell::RunConfiguration)runConfiguration { - return shell::RunConfiguration::InferFromSettings(_settings); + return [self runConfigurationForEntrypoint:nil]; +} + +- (shell::RunConfiguration)runConfigurationForEntrypoint:(NSString*)entrypointOrNil { + return [self runConfigurationForEntrypoint:entrypointOrNil libraryOrNil:nil]; +} + +- (shell::RunConfiguration)runConfigurationForEntrypoint:(NSString*)entrypointOrNil + libraryOrNil:(NSString*)dartLibraryOrNil { + shell::RunConfiguration config = shell::RunConfiguration::InferFromSettings(_settings); + if (dartLibraryOrNil && entrypointOrNil) { + config.SetEntrypointAndLibrary(std::string([entrypointOrNil UTF8String]), + std::string([dartLibraryOrNil UTF8String])); + + } else if (entrypointOrNil) { + config.SetEntrypoint(std::string([entrypointOrNil UTF8String])); + } + return config; } #pragma mark - Assets-related utilities diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h index 155f3c8ef4533..844c74d01ad34 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -14,6 +14,9 @@ - (const blink::Settings&)settings; - (shell::RunConfiguration)runConfiguration; +- (shell::RunConfiguration)runConfigurationForEntrypoint:(NSString*)entrypointOrNil; +- (shell::RunConfiguration)runConfigurationForEntrypoint:(NSString*)entrypointOrNil + libraryOrNil:(NSString*)dartLibraryOrNil; + (NSString*)flutterAssetsName:(NSBundle*)bundle; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm new file mode 100644 index 0000000000000..c5f3b8d9accf0 --- /dev/null +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -0,0 +1,567 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#define FML_USED_ON_EMBEDDER + +#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h" + +#include + +#include "flutter/fml/message_loop.h" +#include "flutter/fml/platform/darwin/platform_version.h" +#include "flutter/shell/common/engine.h" +#include "flutter/shell/common/platform_view.h" +#include "flutter/shell/common/shell.h" +#include "flutter/shell/common/switches.h" +#include "flutter/shell/common/thread_host.h" +#include "flutter/shell/platform/darwin/common/command_line.h" +#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h" +#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.h" +#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h" +#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h" +#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h" +#include "flutter/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h" +#include "flutter/shell/platform/darwin/ios/ios_surface.h" +#include "flutter/shell/platform/darwin/ios/platform_view_ios.h" + +@interface FlutterEngine () +// Maintains a dictionary of plugin names that have registered with the engine. Used by +// FlutterEngineRegistrar to implement a FlutterPluginRegistrar. +@property(nonatomic, readonly) NSMutableDictionary* pluginPublications; +@end + +@interface FlutterEngineRegistrar : NSObject +- (instancetype)initWithPlugin:(NSString*)pluginKey flutterEngine:(FlutterEngine*)flutterEngine; +@end + +@implementation FlutterEngine { + fml::scoped_nsobject _dartProject; + shell::ThreadHost _threadHost; + std::unique_ptr _shell; + NSString* _labelPrefix; + std::unique_ptr> _weakFactory; + + fml::WeakPtr _viewController; + fml::scoped_nsobject _publisher; + + std::unique_ptr _platformViewsController; + + // Channels + fml::scoped_nsobject _platformPlugin; + fml::scoped_nsobject _textInputPlugin; + fml::scoped_nsobject _localizationChannel; + fml::scoped_nsobject _navigationChannel; + fml::scoped_nsobject _platformChannel; + fml::scoped_nsobject _platformViewsChannel; + fml::scoped_nsobject _textInputChannel; + fml::scoped_nsobject _lifecycleChannel; + fml::scoped_nsobject _systemChannel; + fml::scoped_nsobject _settingsChannel; + + int64_t _nextTextureId; +} + +- (instancetype)initWithName:(NSString*)labelPrefix project:(FlutterDartProject*)projectOrNil { + self = [super init]; + NSAssert(self, @"Super init cannot be nil"); + NSAssert(labelPrefix, @"labelPrefix is required"); + _labelPrefix = [labelPrefix copy]; + + _weakFactory = std::make_unique>(self); + + if (projectOrNil == nil) + _dartProject.reset([[FlutterDartProject alloc] init]); + else + _dartProject.reset([projectOrNil retain]); + + _pluginPublications = [NSMutableDictionary new]; + _publisher.reset([[FlutterObservatoryPublisher alloc] init]); + _platformViewsController.reset(new shell::FlutterPlatformViewsController()); + + [self setupChannels]; + + return self; +} + +- (void)dealloc { + [_pluginPublications release]; + [super dealloc]; +} + +- (shell::Shell&)shell { + FML_DCHECK(_shell); + return *_shell; +} + +- (fml::WeakPtr)getWeakPtr { + return _weakFactory->GetWeakPtr(); +} + +- (void)updateViewportMetrics:(blink::ViewportMetrics)viewportMetrics { + self.shell.GetTaskRunners().GetUITaskRunner()->PostTask( + [engine = self.shell.GetEngine(), metrics = viewportMetrics]() { + if (engine) { + engine->SetViewportMetrics(std::move(metrics)); + } + }); +} + +- (void)dispatchPointerDataPacket:(std::unique_ptr)packet { + self.shell.GetTaskRunners().GetUITaskRunner()->PostTask( + fml::MakeCopyable([engine = self.shell.GetEngine(), packet = std::move(packet)] { + if (engine) { + engine->DispatchPointerDataPacket(*packet); + } + })); +} + +- (fml::WeakPtr)platformView { + FML_DCHECK(_shell); + return _shell->GetPlatformView(); +} + +- (shell::PlatformViewIOS*)iosPlatformView { + FML_DCHECK(_shell); + return static_cast(_shell->GetPlatformView().get()); +} + +- (fml::RefPtr)platformTaskRunner { + FML_DCHECK(_shell); + return _shell->GetTaskRunners().GetPlatformTaskRunner(); +} + +- (void)setViewController:(FlutterViewController*)viewController { + FML_DCHECK(self.iosPlatformView); + _viewController = [viewController getWeakPtr]; + self.iosPlatformView->SetOwnerViewController(_viewController); + [self maybeSetupPlatformViewChannels]; +} + +- (FlutterViewController*)viewController { + if (!_viewController) { + return nil; + } + return _viewController.get(); +} + +- (FlutterPlatformPlugin*)platformPlugin { + return _platformPlugin.get(); +} +- (shell::FlutterPlatformViewsController*)platformViewsController { + return _platformViewsController.get(); +} +- (FlutterTextInputPlugin*)textInputPlugin { + return _textInputPlugin.get(); +} +- (FlutterMethodChannel*)localizationChannel { + return _localizationChannel.get(); +} +- (FlutterMethodChannel*)navigationChannel { + return _navigationChannel.get(); +} +- (FlutterMethodChannel*)platformChannel { + return _platformChannel.get(); +} +- (FlutterMethodChannel*)textInputChannel { + return _textInputChannel.get(); +} +- (FlutterBasicMessageChannel*)lifecycleChannel { + return _lifecycleChannel.get(); +} +- (FlutterBasicMessageChannel*)systemChannel { + return _systemChannel.get(); +} +- (FlutterBasicMessageChannel*)settingsChannel { + return _settingsChannel.get(); +} + +- (void)setupChannels { + _localizationChannel.reset([[FlutterMethodChannel alloc] + initWithName:@"flutter/localization" + binaryMessenger:self + codec:[FlutterJSONMethodCodec sharedInstance]]); + + _navigationChannel.reset([[FlutterMethodChannel alloc] + initWithName:@"flutter/navigation" + binaryMessenger:self + codec:[FlutterJSONMethodCodec sharedInstance]]); + + _platformChannel.reset([[FlutterMethodChannel alloc] + initWithName:@"flutter/platform" + binaryMessenger:self + codec:[FlutterJSONMethodCodec sharedInstance]]); + + _platformViewsChannel.reset([[FlutterMethodChannel alloc] + initWithName:@"flutter/platform_views" + binaryMessenger:self + codec:[FlutterStandardMethodCodec sharedInstance]]); + + _textInputChannel.reset([[FlutterMethodChannel alloc] + initWithName:@"flutter/textinput" + binaryMessenger:self + codec:[FlutterJSONMethodCodec sharedInstance]]); + + _lifecycleChannel.reset([[FlutterBasicMessageChannel alloc] + initWithName:@"flutter/lifecycle" + binaryMessenger:self + codec:[FlutterStringCodec sharedInstance]]); + + _systemChannel.reset([[FlutterBasicMessageChannel alloc] + initWithName:@"flutter/system" + binaryMessenger:self + codec:[FlutterJSONMessageCodec sharedInstance]]); + + _settingsChannel.reset([[FlutterBasicMessageChannel alloc] + initWithName:@"flutter/settings" + binaryMessenger:self + codec:[FlutterJSONMessageCodec sharedInstance]]); + + _textInputPlugin.reset([[FlutterTextInputPlugin alloc] init]); + _textInputPlugin.get().textInputDelegate = self; + + _platformPlugin.reset([[FlutterPlatformPlugin alloc] initWithEngine:[self getWeakPtr]]); + + [self maybeSetupPlatformViewChannels]; +} + +- (void)maybeSetupPlatformViewChannels { + if (_shell && self.shell.IsSetup()) { + [_platformChannel.get() setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { + [_platformPlugin.get() handleMethodCall:call result:result]; + }]; + + [_platformViewsChannel.get() + setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { + _platformViewsController->OnMethodCall(call, result); + }]; + + [_textInputChannel.get() setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { + [_textInputPlugin.get() handleMethodCall:call result:result]; + }]; + self.iosPlatformView->SetTextInputPlugin(_textInputPlugin); + } +} + +- (shell::Rasterizer::Screenshot)screenshot:(shell::Rasterizer::ScreenshotType)type + base64Encode:(bool)base64Encode { + return self.shell.Screenshot(type, base64Encode); +} + +- (void)launchEngine:(NSString*)entrypoint libraryURI:(NSString*)libraryOrNil { + // Launch the Dart application with the inferred run configuration. + self.shell.GetTaskRunners().GetUITaskRunner()->PostTask(fml::MakeCopyable( + [engine = _shell->GetEngine(), + config = [_dartProject.get() runConfigurationForEntrypoint:entrypoint + libraryOrNil:libraryOrNil] // + ]() mutable { + if (engine) { + auto result = engine->Run(std::move(config)); + if (result == shell::Engine::RunStatus::Failure) { + FML_LOG(ERROR) << "Could not launch engine with configuration."; + } + } + })); +} + +- (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryURI { + if (_shell != nullptr) { + FML_LOG(WARNING) << "This FlutterEngine was already invoked."; + return NO; + } + + static size_t shellCount = 1; + + auto settings = [_dartProject.get() settings]; + + if (libraryURI) { + FML_DCHECK(entrypoint) << "Must specify entrypoint if specifying library"; + settings.advisory_script_entrypoint = entrypoint.UTF8String; + settings.advisory_script_uri = libraryURI.UTF8String; + } else if (entrypoint) { + settings.advisory_script_entrypoint = entrypoint.UTF8String; + settings.advisory_script_entrypoint = std::string("main.dart"); + } else { + settings.advisory_script_entrypoint = std::string("main"); + settings.advisory_script_entrypoint = std::string("main.dart"); + } + + const auto threadLabel = [NSString stringWithFormat:@"%@.%zu", _labelPrefix, shellCount++]; + FML_DLOG(INFO) << "Creating threadHost for " << threadLabel.UTF8String; + // The current thread will be used as the platform thread. Ensure that the message loop is + // initialized. + fml::MessageLoop::EnsureInitializedForCurrentThread(); + + _threadHost = { + threadLabel.UTF8String, // label + shell::ThreadHost::Type::UI | shell::ThreadHost::Type::GPU | shell::ThreadHost::Type::IO}; + + // Lambda captures by pointers to ObjC objects are fine here because the + // create call is + // synchronous. + shell::Shell::CreateCallback on_create_platform_view = + [](shell::Shell& shell) { + return std::make_unique(shell, shell.GetTaskRunners()); + }; + + shell::Shell::CreateCallback on_create_rasterizer = [](shell::Shell& shell) { + return std::make_unique(shell.GetTaskRunners()); + }; + + if (shell::IsIosEmbeddedViewsPreviewEnabled()) { + // Embedded views requires the gpu and the platform views to be the same. + // The plan is to eventually dynamically merge the threads when there's a + // platform view in the layer tree. + // For now we run in a single threaded configuration. + // TODO(amirh/chinmaygarde): merge only the gpu and platform threads. + // https://github.com/flutter/flutter/issues/23974 + // TODO(amirh/chinmaygarde): remove this, and dynamically change the thread configuration. + // https://github.com/flutter/flutter/issues/23975 + blink::TaskRunners task_runners(threadLabel.UTF8String, // label + fml::MessageLoop::GetCurrent().GetTaskRunner(), // platform + fml::MessageLoop::GetCurrent().GetTaskRunner(), // gpu + fml::MessageLoop::GetCurrent().GetTaskRunner(), // ui + fml::MessageLoop::GetCurrent().GetTaskRunner() // io + ); + // Create the shell. This is a blocking operation. + _shell = shell::Shell::Create(std::move(task_runners), // task runners + std::move(settings), // settings + on_create_platform_view, // platform view creation + on_create_rasterizer // rasterzier creation + ); + } else { + blink::TaskRunners task_runners(threadLabel.UTF8String, // label + fml::MessageLoop::GetCurrent().GetTaskRunner(), // platform + _threadHost.gpu_thread->GetTaskRunner(), // gpu + _threadHost.ui_thread->GetTaskRunner(), // ui + _threadHost.io_thread->GetTaskRunner() // io + ); + // Create the shell. This is a blocking operation. + _shell = shell::Shell::Create(std::move(task_runners), // task runners + std::move(settings), // settings + on_create_platform_view, // platform view creation + on_create_rasterizer // rasterzier creation + ); + } + + if (_shell == nullptr) { + FML_LOG(ERROR) << "Could not start a shell FlutterEngine with entrypoint: " + << entrypoint.UTF8String; + } else { + [self maybeSetupPlatformViewChannels]; + } + + return _shell != nullptr; +} + +- (BOOL)runWithEntrypoint:(NSString*)entrypoint libraryURI:(NSString*)libraryURI { + if ([self createShell:entrypoint libraryURI:libraryURI]) { + [self launchEngine:entrypoint libraryURI:libraryURI]; + } + + return _shell != nullptr; +} + +- (BOOL)runWithEntrypoint:(NSString*)entrypoint { + return [self runWithEntrypoint:entrypoint libraryURI:nil]; +} + +#pragma mark - Text input delegate + +- (void)updateEditingClient:(int)client withState:(NSDictionary*)state { + [_textInputChannel.get() invokeMethod:@"TextInputClient.updateEditingState" + arguments:@[ @(client), state ]]; +} + +- (void)performAction:(FlutterTextInputAction)action withClient:(int)client { + NSString* actionString; + switch (action) { + case FlutterTextInputActionUnspecified: + // Where did the term "unspecified" come from? iOS has a "default" and Android + // has "unspecified." These 2 terms seem to mean the same thing but we need + // to pick just one. "unspecified" was chosen because "default" is often a + // reserved word in languages with switch statements (dart, java, etc). + actionString = @"TextInputAction.unspecified"; + break; + case FlutterTextInputActionDone: + actionString = @"TextInputAction.done"; + break; + case FlutterTextInputActionGo: + actionString = @"TextInputAction.go"; + break; + case FlutterTextInputActionSend: + actionString = @"TextInputAction.send"; + break; + case FlutterTextInputActionSearch: + actionString = @"TextInputAction.search"; + break; + case FlutterTextInputActionNext: + actionString = @"TextInputAction.next"; + break; + case FlutterTextInputActionContinue: + actionString = @"TextInputAction.continue"; + break; + case FlutterTextInputActionJoin: + actionString = @"TextInputAction.join"; + break; + case FlutterTextInputActionRoute: + actionString = @"TextInputAction.route"; + break; + case FlutterTextInputActionEmergencyCall: + actionString = @"TextInputAction.emergencyCall"; + break; + case FlutterTextInputActionNewline: + actionString = @"TextInputAction.newline"; + break; + } + [_textInputChannel.get() invokeMethod:@"TextInputClient.performAction" + arguments:@[ @(client), actionString ]]; +} + +#pragma mark - Screenshot Delegate + +- (shell::Rasterizer::Screenshot)takeScreenshot:(shell::Rasterizer::ScreenshotType)type + asBase64Encoded:(BOOL)base64Encode { + FML_DCHECK(_shell) << "Cannot takeScreenshot without a shell"; + return _shell->Screenshot(type, base64Encode); +} + +#pragma mark - FlutterBinaryMessenger + +- (void)sendOnChannel:(NSString*)channel message:(NSData*)message { + [self sendOnChannel:channel message:message binaryReply:nil]; +} + +- (void)sendOnChannel:(NSString*)channel + message:(NSData*)message + binaryReply:(FlutterBinaryReply)callback { + NSAssert(channel, @"The channel must not be null"); + fml::RefPtr response = + (callback == nil) ? nullptr + : fml::MakeRefCounted( + ^(NSData* reply) { + callback(reply); + }, + _shell->GetTaskRunners().GetPlatformTaskRunner()); + fml::RefPtr platformMessage = + (message == nil) ? fml::MakeRefCounted(channel.UTF8String, response) + : fml::MakeRefCounted( + channel.UTF8String, shell::GetVectorFromNSData(message), response); + + _shell->GetPlatformView()->DispatchPlatformMessage(platformMessage); +} + +- (void)setMessageHandlerOnChannel:(NSString*)channel + binaryMessageHandler:(FlutterBinaryMessageHandler)handler { + NSAssert(channel, @"The channel must not be null"); + FML_DCHECK(_shell && _shell->IsSetup()); + self.iosPlatformView->GetPlatformMessageRouter().SetMessageHandler(channel.UTF8String, handler); +} + +#pragma mark - FlutterTextureRegistry + +- (int64_t)registerTexture:(NSObject*)texture { + int64_t textureId = _nextTextureId++; + self.iosPlatformView->RegisterExternalTexture(textureId, texture); + return textureId; +} + +- (void)unregisterTexture:(int64_t)textureId { + _shell->GetPlatformView()->UnregisterTexture(textureId); +} + +- (void)textureFrameAvailable:(int64_t)textureId { + _shell->GetPlatformView()->MarkTextureFrameAvailable(textureId); +} + +- (NSString*)lookupKeyForAsset:(NSString*)asset { + return [FlutterDartProject lookupKeyForAsset:asset]; +} + +- (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package { + return [FlutterDartProject lookupKeyForAsset:asset fromPackage:package]; +} + +- (id)pluginRegistry { + return self; +} + +#pragma mark - FlutterPluginRegistry + +- (NSObject*)registrarForPlugin:(NSString*)pluginKey { + NSAssert(self.pluginPublications[pluginKey] == nil, @"Duplicate plugin key: %@", pluginKey); + self.pluginPublications[pluginKey] = [NSNull null]; + return [[FlutterEngineRegistrar alloc] initWithPlugin:pluginKey flutterEngine:self]; +} + +- (BOOL)hasPlugin:(NSString*)pluginKey { + return _pluginPublications[pluginKey] != nil; +} + +- (NSObject*)valuePublishedByPlugin:(NSString*)pluginKey { + return _pluginPublications[pluginKey]; +} + +@end + +@implementation FlutterEngineRegistrar { + NSString* _pluginKey; + FlutterEngine* _flutterEngine; +} + +- (instancetype)initWithPlugin:(NSString*)pluginKey flutterEngine:(FlutterEngine*)flutterEngine { + self = [super init]; + NSAssert(self, @"Super init cannot be nil"); + _pluginKey = [pluginKey retain]; + _flutterEngine = [flutterEngine retain]; + return self; +} + +- (void)dealloc { + [_pluginKey release]; + [_flutterEngine release]; + [super dealloc]; +} + +- (NSObject*)messenger { + return _flutterEngine; +} + +- (NSObject*)textures { + return _flutterEngine; +} + +- (void)publish:(NSObject*)value { + _flutterEngine.pluginPublications[_pluginKey] = value; +} + +- (void)addMethodCallDelegate:(NSObject*)delegate + channel:(FlutterMethodChannel*)channel { + [channel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { + [delegate handleMethodCall:call result:result]; + }]; +} + +- (void)addApplicationDelegate:(NSObject*)delegate { + id appDelegate = [[UIApplication sharedApplication] delegate]; + if ([appDelegate conformsToProtocol:@protocol(FlutterAppLifeCycleProvider)]) { + id lifeCycleProvider = + (id)appDelegate; + [lifeCycleProvider addApplicationLifeCycleDelegate:delegate]; + } +} + +- (NSString*)lookupKeyForAsset:(NSString*)asset { + return [_flutterEngine lookupKeyForAsset:asset]; +} + +- (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package { + return [_flutterEngine lookupKeyForAsset:asset fromPackage:package]; +} + +- (void)registerViewFactory:(NSObject*)factory + withId:(NSString*)factoryId { + [_flutterEngine platformViewsController] -> RegisterViewFactory(factory, factoryId); +} + +@end diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h new file mode 100644 index 0000000000000..3627ae26e08ae --- /dev/null +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h @@ -0,0 +1,49 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERENGINE_INTERNAL_H_ +#define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERENGINE_INTERNAL_H_ + +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h" + +#import "FlutterPlatformViews_Internal.h" + +#include "flutter/fml/memory/weak_ptr.h" +#include "flutter/fml/task_runner.h" +#include "flutter/lib/ui/window/pointer_data_packet.h" +#include "flutter/lib/ui/window/viewport_metrics.h" +#include "flutter/shell/common/platform_view.h" +#include "flutter/shell/common/rasterizer.h" +#include "flutter/shell/common/shell.h" +#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h" +#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h" +#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h" +#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h" +#include "flutter/shell/platform/darwin/ios/platform_view_ios.h" + +#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h" + +@interface FlutterEngine () + +- (shell::Shell&)shell; + +- (void)updateViewportMetrics:(blink::ViewportMetrics)viewportMetrics; +- (void)dispatchPointerDataPacket:(std::unique_ptr)packet; + +- (fml::RefPtr)platformTaskRunner; + +- (fml::WeakPtr)platformView; + +- (shell::Rasterizer::Screenshot)screenshot:(shell::Rasterizer::ScreenshotType)type + base64Encode:(bool)base64Encode; + +- (FlutterPlatformPlugin*)platformPlugin; +- (shell::FlutterPlatformViewsController*)platformViewsController; +- (FlutterTextInputPlugin*)textInputPlugin; +- (void)launchEngine:(NSString*)entrypoint libraryURI:(NSString*)libraryOrNil; +- (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryOrNil; + +@end + +#endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERENGINE_INTERNAL_H_ diff --git a/shell/platform/darwin/ios/framework/Source/FlutterHeadlessDartRunner.mm b/shell/platform/darwin/ios/framework/Source/FlutterHeadlessDartRunner.mm index 5d0f42af6c1e0..8e7cb26d48a1d 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterHeadlessDartRunner.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterHeadlessDartRunner.mm @@ -1,14 +1,14 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #define FML_USED_ON_EMBEDDER +#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h" + #import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterHeadlessDartRunner.h" -#include #include -#include #include "flutter/fml/make_copyable.h" #include "flutter/fml/message_loop.h" @@ -22,128 +22,15 @@ #include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h" #include "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h" #include "flutter/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h" -#include "flutter/shell/platform/darwin/ios/headless_platform_view_ios.h" #include "flutter/shell/platform/darwin/ios/platform_view_ios.h" -static std::unique_ptr CreateHeadlessPlatformView( - shell::Shell& shell) { - return std::make_unique(shell, shell.GetTaskRunners()); -} - -static std::unique_ptr CreateHeadlessRasterizer(shell::Shell& shell) { - return std::make_unique(shell.GetTaskRunners()); -} - -static std::string CreateShellLabel() { - static size_t count = 1; - std::stringstream stream; - stream << "io.flutter.headless."; - stream << count++; - return stream.str(); -} - @implementation FlutterHeadlessDartRunner { - shell::ThreadHost _threadHost; - std::unique_ptr _shell; } -- (void)runWithEntrypointAndLibraryUri:(NSString*)entrypoint libraryUri:(NSString*)uri { - if (_shell != nullptr || entrypoint.length == 0) { - FML_LOG(ERROR) << "This headless dart runner was already used to run some code."; - return; - } - - const auto label = CreateShellLabel(); - - // Create the threads to run the shell on. - _threadHost = { - label, // native thread label - shell::ThreadHost::Type::UI // managed threads to create - }; - - // Configure shell task runners. - auto current_task_runner = fml::MessageLoop::GetCurrent().GetTaskRunner(); - auto single_task_runner = _threadHost.ui_thread->GetTaskRunner(); - blink::TaskRunners task_runners(label, // dart thread label - current_task_runner, // platform - single_task_runner, // gpu - single_task_runner, // ui - single_task_runner // io - ); - - auto settings = shell::SettingsFromCommandLine(shell::CommandLineFromNSProcessInfo()); - - // These values set the name of the isolate for debugging. - settings.advisory_script_entrypoint = entrypoint.UTF8String; - settings.advisory_script_uri = uri.UTF8String; - - // Create the shell. This is a blocking operation. - _shell = shell::Shell::Create( - std::move(task_runners), // task runners - std::move(settings), // settings - std::bind(&CreateHeadlessPlatformView, std::placeholders::_1), // platform view creation - std::bind(&CreateHeadlessRasterizer, std::placeholders::_1) // rasterzier creation - ); - - if (_shell == nullptr) { - FML_LOG(ERROR) << "Could not start a shell for the headless dart runner with entrypoint: " - << entrypoint.UTF8String; - return; - } - - FlutterDartProject* project = [[[FlutterDartProject alloc] init] autorelease]; - - auto config = project.runConfiguration; - config.SetEntrypointAndLibrary(entrypoint.UTF8String, uri.UTF8String); - - // Override the default run configuration with the specified entrypoint. - _shell->GetTaskRunners().GetUITaskRunner()->PostTask( - fml::MakeCopyable([engine = _shell->GetEngine(), config = std::move(config)]() mutable { - BOOL success = NO; - FML_LOG(INFO) << "Attempting to launch background engine configuration..."; - if (!engine || engine->Run(std::move(config)) == shell::Engine::RunStatus::Failure) { - FML_LOG(ERROR) << "Could not launch engine with configuration."; - } else { - FML_LOG(INFO) << "Background Isolate successfully started and run."; - success = YES; - } - })); +- (instancetype)initWithName:(NSString*)labelPrefix project:(FlutterDartProject*)projectOrNil { + return [super initWithName:labelPrefix project:projectOrNil]; } - -- (void)runWithEntrypoint:(NSString*)entrypoint { - [self runWithEntrypointAndLibraryUri:entrypoint libraryUri:nil]; -} - -#pragma mark - FlutterBinaryMessenger - -- (void)sendOnChannel:(NSString*)channel message:(NSData*)message { - [self sendOnChannel:channel message:message binaryReply:nil]; +- (instancetype)init { + return [self initWithName:@"io.flutter.headless" project:nil]; } - -- (void)sendOnChannel:(NSString*)channel - message:(NSData*)message - binaryReply:(FlutterBinaryReply)callback { - NSAssert(channel, @"The channel must not be null"); - fml::RefPtr response = - (callback == nil) ? nullptr - : fml::MakeRefCounted( - ^(NSData* reply) { - callback(reply); - }, - _shell->GetTaskRunners().GetPlatformTaskRunner()); - fml::RefPtr platformMessage = - (message == nil) ? fml::MakeRefCounted(channel.UTF8String, response) - : fml::MakeRefCounted( - channel.UTF8String, shell::GetVectorFromNSData(message), response); - - _shell->GetPlatformView()->DispatchPlatformMessage(platformMessage); -} - -- (void)setMessageHandlerOnChannel:(NSString*)channel - binaryMessageHandler:(FlutterBinaryMessageHandler)handler { - reinterpret_cast(_shell->GetPlatformView().get()) - ->GetPlatformMessageRouter() - .SetMessageHandler(channel.UTF8String, handler); -} - @end diff --git a/shell/platform/darwin/ios/framework/Source/FlutterNavigationController.mm b/shell/platform/darwin/ios/framework/Source/FlutterNavigationController.mm deleted file mode 100644 index 2ca2978a548f1..0000000000000 --- a/shell/platform/darwin/ios/framework/Source/FlutterNavigationController.mm +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterNavigationController.h" - -@implementation FlutterNavigationController - -- (void)viewWillAppear:(BOOL)animated { - [self setNavigationBarHidden:YES]; - [super viewWillAppear:animated]; -} - -@end diff --git a/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.h b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.h new file mode 100644 index 0000000000000..68f97c6b6698e --- /dev/null +++ b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.h @@ -0,0 +1,14 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FLUTTEROBSERVATORYPUBLISHER_H_ +#define FLUTTER_FLUTTEROBSERVATORYPUBLISHER_H_ + +#import + +@interface FlutterObservatoryPublisher : NSObject + +@end + +#endif // FLUTTER_FLUTTEROBSERVATORYPUBLISHER_H_ diff --git a/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm new file mode 100644 index 0000000000000..c0add5502389c --- /dev/null +++ b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm @@ -0,0 +1,156 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#define FML_USED_ON_EMBEDDER + +#import + +// NSNetService works fine on physical devices, but doesn't expose the services to regular mDNS +// queries on the Simulator. We can work around this by using the lower level C API, but that's +// only available from iOS 9.3+/macOS 10.11.4+. +#if TARGET_IPHONE_SIMULATOR +#include // nogncheck +#include // nogncheck +#endif // TARGET_IPHONE_SIMLUATOR + +#import "FlutterObservatoryPublisher.h" + +#include "flutter/fml/logging.h" +#include "flutter/fml/make_copyable.h" +#include "flutter/fml/memory/weak_ptr.h" +#include "flutter/fml/message_loop.h" +#include "flutter/fml/platform/darwin/scoped_nsobject.h" +#include "flutter/fml/task_runner.h" +#include "flutter/runtime/dart_service_isolate.h" + +#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_RELEASE || \ + FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE + +@implementation FlutterObservatoryPublisher { +} + +#else + +@interface FlutterObservatoryPublisher () +@end + +@implementation FlutterObservatoryPublisher { +#if TARGET_IPHONE_SIMULATOR + DNSServiceRef _dnsServiceRef; +#else // TARGET_IPHONE_SIMULATOR + fml::scoped_nsobject _netService; +#endif // TARGET_IPHONE_SIMULATOR + + blink::DartServiceIsolate::CallbackHandle _callbackHandle; + std::unique_ptr> _weakFactory; +} + +- (instancetype)init { + self = [super init]; + NSAssert(self, @"Super must not return null on init."); + + _weakFactory = std::make_unique>(self); + + fml::MessageLoop::EnsureInitializedForCurrentThread(); + + _callbackHandle = blink::DartServiceIsolate::AddServerStatusCallback( + [weak = _weakFactory->GetWeakPtr(), + runner = fml::MessageLoop::GetCurrent().GetTaskRunner()](const std::string& uri) { + runner->PostTask([weak, uri]() { + if (weak) { + [weak.get() publishServiceProtocolPort:std::move(uri)]; + } + }); + }); + + return self; +} + +- (void)stopService { +#if TARGET_IPHONE_SIMULATOR + if (_dnsServiceRef) { + DNSServiceRefDeallocate(_dnsServiceRef); + _dnsServiceRef = NULL; + } +#else // TARGET_IPHONE_SIMULATOR + [_netService.get() stop]; +#endif // TARGET_IPHONE_SIMULATOR +} + +- (void)dealloc { + [self stopService]; + + blink::DartServiceIsolate::RemoveServerStatusCallback(std::move(_callbackHandle)); + [super dealloc]; +} + +- (void)publishServiceProtocolPort:(std::string)uri { + [self stopService]; + if (uri.empty()) { + return; + } + // uri comes in as something like 'http://127.0.0.1:XXXXX/' where XXXXX is the port + // number. + NSURL* url = + [[[NSURL alloc] initWithString:[NSString stringWithUTF8String:uri.c_str()]] autorelease]; + + NSString* serviceName = + [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"]; + +#if TARGET_IPHONE_SIMULATOR + DNSServiceFlags flags = kDNSServiceFlagsDefault; + uint32_t interfaceIndex = if_nametoindex("lo0"); + const char* registrationType = "_dartobservatory._tcp"; + const char* domain = "local."; // default domain + uint16_t port = [[url port] intValue]; + + int err = DNSServiceRegister(&_dnsServiceRef, flags, interfaceIndex, [serviceName UTF8String], + registrationType, domain, NULL, htons(port), 0, NULL, + registrationCallback, NULL); + + if (err != 0) { + FML_LOG(ERROR) << "Failed to register observatory port with mDNS."; + } else { + DNSServiceSetDispatchQueue(_dnsServiceRef, dispatch_get_main_queue()); + } +#else // TARGET_IPHONE_SIMULATOR + _netService.reset([[NSNetService alloc] initWithDomain:@"local." + type:@"_dartobservatory._tcp." + name:serviceName + port:[[url port] intValue]]); + [_netService.get() setDelegate:self]; + [_netService.get() publish]; +#endif // TARGET_IPHONE_SIMULATOR +} + +- (void)netServiceDidPublish:(NSNetService*)sender { + FML_DLOG(INFO) << "FlutterObservatoryPublisher is ready!"; +} + +- (void)netService:(NSNetService*)sender didNotPublish:(NSDictionary*)errorDict { + FML_LOG(ERROR) << "Could not register as server for FlutterObservatoryPublisher. Check your " + "network settings and relaunch the application."; +} + +#if TARGET_IPHONE_SIMULATOR +static void DNSSD_API registrationCallback(DNSServiceRef sdRef, + DNSServiceFlags flags, + DNSServiceErrorType errorCode, + const char* name, + const char* regType, + const char* domain, + void* context) { + if (errorCode == kDNSServiceErr_NoError) { + FML_DLOG(INFO) << "FlutterObservatoryPublisher is ready!"; + } else { + FML_LOG(ERROR) << "Could not register as server for FlutterObservatoryPublisher. Check your " + "network settings and relaunch the application."; + } +} +#endif // TARGET_IPHONE_SIMULATOR + +#endif // FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE && FLUTTER_RUNTIME_MODE != + // FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE + +@end diff --git a/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h b/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h new file mode 100644 index 0000000000000..a344179057bab --- /dev/null +++ b/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h @@ -0,0 +1,32 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTER_OVERLAY_VIEW_H_ +#define SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTER_OVERLAY_VIEW_H_ + +#include + +#include + +#import "FlutterPlatformViews_Internal.h" + +#include "flutter/fml/memory/weak_ptr.h" +#include "flutter/shell/common/shell.h" +#include "flutter/shell/platform/darwin/ios/ios_gl_context.h" +#include "flutter/shell/platform/darwin/ios/ios_surface.h" +#include "flutter/shell/platform/darwin/ios/ios_surface_gl.h" + +@interface FlutterOverlayView : UIView + +- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; +- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; + +- (instancetype)init NS_DESIGNATED_INITIALIZER; +- (std::unique_ptr)createSoftwareSurface; +- (std::unique_ptr)createGLSurfaceWithContext: + (std::shared_ptr)gl_context; + +@end + +#endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTER_OVERLAY_VIEW_H_ diff --git a/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm b/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm new file mode 100644 index 0000000000000..83f59d24e0b81 --- /dev/null +++ b/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm @@ -0,0 +1,84 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h" + +#include "flutter/common/settings.h" +#include "flutter/common/task_runners.h" +#include "flutter/flow/layers/layer_tree.h" +#include "flutter/fml/platform/darwin/cf_utils.h" +#include "flutter/fml/synchronization/waitable_event.h" +#include "flutter/fml/trace_event.h" +#include "flutter/shell/common/platform_view.h" +#include "flutter/shell/common/rasterizer.h" +#include "flutter/shell/platform/darwin/ios/ios_surface_gl.h" +#include "flutter/shell/platform/darwin/ios/ios_surface_software.h" +#include "third_party/skia/include/utils/mac/SkCGUtils.h" + +// This is mostly a duplication of FlutterView. +// TODO(amirh): once GL support is in evaluate if we can merge this with FlutterView. +@implementation FlutterOverlayView + +- (instancetype)initWithFrame:(CGRect)frame { + @throw([NSException exceptionWithName:@"FlutterOverlayView must initWithDelegate" + reason:nil + userInfo:nil]); +} + +- (instancetype)initWithCoder:(NSCoder*)aDecoder { + @throw([NSException exceptionWithName:@"FlutterOverlayView must initWithDelegate" + reason:nil + userInfo:nil]); +} + +- (instancetype)init { + self = [super initWithFrame:CGRectZero]; + + if (self) { + self.layer.opaque = NO; + self.userInteractionEnabled = NO; + } + + return self; +} + +- (void)layoutSubviews { + if ([self.layer isKindOfClass:[CAEAGLLayer class]]) { + CAEAGLLayer* layer = reinterpret_cast(self.layer); + layer.allowsGroupOpacity = NO; + CGFloat screenScale = [UIScreen mainScreen].scale; + layer.contentsScale = screenScale; + layer.rasterizationScale = screenScale; + } + + [super layoutSubviews]; +} + ++ (Class)layerClass { +#if TARGET_IPHONE_SIMULATOR + return [CALayer class]; +#else // TARGET_IPHONE_SIMULATOR + return [CAEAGLLayer class]; +#endif // TARGET_IPHONE_SIMULATOR +} + +- (std::unique_ptr)createSoftwareSurface { + fml::scoped_nsobject layer(reinterpret_cast([self.layer retain])); + return std::make_unique(std::move(layer), nullptr); +} + +- (std::unique_ptr)createGLSurfaceWithContext: + (std::shared_ptr)gl_context { + fml::scoped_nsobject eagl_layer(reinterpret_cast([self.layer retain])); + // TODO(amirh): We can lower this to iOS 8.0 once we have a Metal rendering backend. + // https://github.com/flutter/flutter/issues/24132 + if (@available(iOS 9.0, *)) { + eagl_layer.get().presentsWithTransaction = YES; + } + return std::make_unique(eagl_layer, std::move(gl_context)); +} + +// TODO(amirh): implement drawLayer to suppoer snapshotting. + +@end diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h index 09bdfa8b0ea47..b221134efd499 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,13 +7,11 @@ #include "flutter/fml/memory/weak_ptr.h" #include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h" - -#include +#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h" @interface FlutterPlatformPlugin : NSObject - (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithViewController:(fml::WeakPtr)viewController - NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithEngine:(fml::WeakPtr)engine NS_DESIGNATED_INITIALIZER; - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result; @end diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm index 54873532ae18b..bfb3032dcc267 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -33,21 +33,21 @@ using namespace shell; @implementation FlutterPlatformPlugin { - fml::WeakPtr _viewController; + fml::WeakPtr _engine; } - (instancetype)init { - @throw([NSException exceptionWithName:@"FlutterPlatformPlugin must initWithViewController" + @throw([NSException exceptionWithName:@"FlutterPlatformPlugin must initWithEngine" reason:nil userInfo:nil]); } -- (instancetype)initWithViewController:(fml::WeakPtr)viewController { - FML_DCHECK(viewController) << "viewController must be set"; +- (instancetype)initWithEngine:(fml::WeakPtr)engine { + FML_DCHECK(engine) << "engine must be set"; self = [super init]; if (self) { - _viewController = viewController; + _engine = engine; } return self; @@ -203,8 +203,11 @@ - (void)popSystemNavigator { UIViewController* viewController = [UIApplication sharedApplication].keyWindow.rootViewController; if ([viewController isKindOfClass:[UINavigationController class]]) { [((UINavigationController*)viewController) popViewControllerAnimated:NO]; - } else if (viewController != _viewController.get()) { - [_viewController.get() dismissViewControllerAnimated:NO completion:nil]; + } else { + auto engineViewController = static_cast([_engine.get() viewController]); + if (engineViewController != viewController) { + [engineViewController dismissViewControllerAnimated:NO completion:nil]; + } } } diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm new file mode 100644 index 0000000000000..6ca2f334dd488 --- /dev/null +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm @@ -0,0 +1,396 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import + +#import "FlutterOverlayView.h" +#import "flutter/shell/platform/darwin/ios/ios_surface.h" +#import "flutter/shell/platform/darwin/ios/ios_surface_gl.h" + +#include +#include +#include + +#include "FlutterPlatformViews_Internal.h" +#include "flutter/fml/platform/darwin/scoped_nsobject.h" +#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h" + +namespace shell { + +void FlutterPlatformViewsController::SetFlutterView(UIView* flutter_view) { + flutter_view_.reset([flutter_view retain]); +} + +void FlutterPlatformViewsController::OnMethodCall(FlutterMethodCall* call, FlutterResult& result) { + if ([[call method] isEqualToString:@"create"]) { + OnCreate(call, result); + } else if ([[call method] isEqualToString:@"dispose"]) { + OnDispose(call, result); + } else if ([[call method] isEqualToString:@"acceptGesture"]) { + OnAcceptGesture(call, result); + } else { + result(FlutterMethodNotImplemented); + } +} + +void FlutterPlatformViewsController::OnCreate(FlutterMethodCall* call, FlutterResult& result) { + if (!flutter_view_.get()) { + // Right now we assume we have a reference to FlutterView when creating a new view. + // TODO(amirh): support this by setting the refernce to FlutterView when it becomes available. + // https://github.com/flutter/flutter/issues/23787 + result([FlutterError errorWithCode:@"create_failed" + message:@"can't create a view on a headless engine" + details:nil]); + return; + } + NSDictionary* args = [call arguments]; + + long viewId = [args[@"id"] longValue]; + std::string viewType([args[@"viewType"] UTF8String]); + + if (views_.count(viewId) != 0) { + result([FlutterError errorWithCode:@"recreating_view" + message:@"trying to create an already created view" + details:[NSString stringWithFormat:@"view id: '%ld'", viewId]]); + } + + NSObject* factory = factories_[viewType].get(); + if (factory == nil) { + result([FlutterError errorWithCode:@"unregistered_view_type" + message:@"trying to create a view with an unregistered type" + details:[NSString stringWithFormat:@"unregistered view type: '%@'", + args[@"viewType"]]]); + return; + } + + id params = nil; + if ([factory respondsToSelector:@selector(createArgsCodec)]) { + NSObject* codec = [factory createArgsCodec]; + if (codec != nil && args[@"params"] != nil) { + FlutterStandardTypedData* paramsData = args[@"params"]; + params = [codec decode:paramsData.data]; + } + } + + NSObject* embedded_view = [factory createWithFrame:CGRectZero + viewIdentifier:viewId + arguments:params]; + views_[viewId] = fml::scoped_nsobject>([embedded_view retain]); + + FlutterTouchInterceptingView* touch_interceptor = + [[[FlutterTouchInterceptingView alloc] initWithEmbeddedView:embedded_view.view + flutterView:flutter_view_] autorelease]; + + touch_interceptors_[viewId] = + fml::scoped_nsobject([touch_interceptor retain]); + + result(nil); +} + +void FlutterPlatformViewsController::OnDispose(FlutterMethodCall* call, FlutterResult& result) { + NSNumber* arg = [call arguments]; + int64_t viewId = [arg longLongValue]; + + if (views_.count(viewId) == 0) { + result([FlutterError errorWithCode:@"unknown_view" + message:@"trying to dispose an unknown" + details:[NSString stringWithFormat:@"view id: '%lld'", viewId]]); + return; + } + + UIView* touch_interceptor = touch_interceptors_[viewId].get(); + [touch_interceptor removeFromSuperview]; + views_.erase(viewId); + touch_interceptors_.erase(viewId); + overlays_.erase(viewId); + result(nil); +} + +void FlutterPlatformViewsController::OnAcceptGesture(FlutterMethodCall* call, + FlutterResult& result) { + NSDictionary* args = [call arguments]; + int64_t viewId = [args[@"id"] longLongValue]; + + if (views_.count(viewId) == 0) { + result([FlutterError errorWithCode:@"unknown_view" + message:@"trying to set gesture state for an unknown view" + details:[NSString stringWithFormat:@"view id: '%lld'", viewId]]); + return; + } + + FlutterTouchInterceptingView* view = touch_interceptors_[viewId].get(); + [view releaseGesture]; + + result(nil); +} + +void FlutterPlatformViewsController::RegisterViewFactory( + NSObject* factory, + NSString* factoryId) { + std::string idString([factoryId UTF8String]); + FML_CHECK(factories_.count(idString) == 0); + factories_[idString] = + fml::scoped_nsobject>([factory retain]); +} + +void FlutterPlatformViewsController::SetFrameSize(SkISize frame_size) { + frame_size_ = frame_size; +} + +void FlutterPlatformViewsController::PrerollCompositeEmbeddedView(int view_id) { + picture_recorders_[view_id] = std::make_unique(); + picture_recorders_[view_id]->beginRecording(SkRect::Make(frame_size_)); + picture_recorders_[view_id]->getRecordingCanvas()->clear(SK_ColorTRANSPARENT); + composition_order_.push_back(view_id); +} + +std::vector FlutterPlatformViewsController::GetCurrentCanvases() { + std::vector canvases; + for (size_t i = 0; i < composition_order_.size(); i++) { + int64_t view_id = composition_order_[i]; + canvases.push_back(picture_recorders_[view_id]->getRecordingCanvas()); + } + return canvases; +} + +SkCanvas* FlutterPlatformViewsController::CompositeEmbeddedView( + int view_id, + const flow::EmbeddedViewParams& params) { + // TODO(amirh): assert that this is running on the platform thread once we support the iOS + // embedded views thread configuration. + // TODO(amirh): do nothing if the params didn't change. + CGFloat screenScale = [[UIScreen mainScreen] scale]; + CGRect rect = + CGRectMake(params.offsetPixels.x() / screenScale, params.offsetPixels.y() / screenScale, + params.sizePoints.width(), params.sizePoints.height()); + + UIView* touch_interceptor = touch_interceptors_[view_id].get(); + [touch_interceptor setFrame:rect]; + + return picture_recorders_[view_id]->getRecordingCanvas(); +} + +void FlutterPlatformViewsController::Reset() { + UIView* flutter_view = flutter_view_.get(); + for (UIView* sub_view in [flutter_view subviews]) { + [sub_view removeFromSuperview]; + } + views_.clear(); + overlays_.clear(); + composition_order_.clear(); + active_composition_order_.clear(); + picture_recorders_.clear(); +} + +bool FlutterPlatformViewsController::SubmitFrame(bool gl_rendering, + GrContext* gr_context, + std::shared_ptr gl_context) { + bool did_submit = true; + for (size_t i = 0; i < composition_order_.size(); i++) { + int64_t view_id = composition_order_[i]; + if (gl_rendering) { + EnsureGLOverlayInitialized(view_id, gl_context, gr_context); + } else { + EnsureOverlayInitialized(view_id); + } + auto frame = overlays_[view_id]->surface->AcquireFrame(frame_size_); + SkCanvas* canvas = frame->SkiaCanvas(); + canvas->drawPicture(picture_recorders_[view_id]->finishRecordingAsPicture()); + canvas->flush(); + did_submit &= frame->Submit(); + } + picture_recorders_.clear(); + if (composition_order_ == active_composition_order_) { + composition_order_.clear(); + return did_submit; + } + UIView* flutter_view = flutter_view_.get(); + + // This can be more efficient, instead of removing all views and then re-attaching them, + // we should only remove the views that has been completly removed from the layer tree, and + // reorder the views using UIView's bringSubviewToFront. + // TODO(amirh): make this more efficient. + // https://github.com/flutter/flutter/issues/23793 + for (UIView* sub_view in [flutter_view subviews]) { + [sub_view removeFromSuperview]; + } + + active_composition_order_.clear(); + for (size_t i = 0; i < composition_order_.size(); i++) { + int view_id = composition_order_[i]; + [flutter_view addSubview:touch_interceptors_[view_id].get()]; + [flutter_view addSubview:overlays_[view_id]->overlay_view.get()]; + active_composition_order_.push_back(view_id); + } + + composition_order_.clear(); + return did_submit; +} + +void FlutterPlatformViewsController::EnsureOverlayInitialized(int64_t overlay_id) { + if (overlays_.count(overlay_id) != 0) { + return; + } + FlutterOverlayView* overlay_view = [[FlutterOverlayView alloc] init]; + overlay_view.frame = flutter_view_.get().bounds; + overlay_view.autoresizingMask = + (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); + std::unique_ptr ios_surface = overlay_view.createSoftwareSurface; + std::unique_ptr surface = ios_surface->CreateGPUSurface(); + overlays_[overlay_id] = std::make_unique( + fml::scoped_nsobject(overlay_view), std::move(ios_surface), std::move(surface)); +} + +void FlutterPlatformViewsController::EnsureGLOverlayInitialized( + int64_t overlay_id, + std::shared_ptr gl_context, + GrContext* gr_context) { + if (overlays_.count(overlay_id) != 0) { + return; + } + FlutterOverlayView* overlay_view = [[FlutterOverlayView alloc] init]; + overlay_view.frame = flutter_view_.get().bounds; + overlay_view.autoresizingMask = + (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); + std::unique_ptr ios_surface = + [overlay_view createGLSurfaceWithContext:std::move(gl_context)]; + std::unique_ptr surface = ios_surface->CreateSecondaryGPUSurface(gr_context); + overlays_[overlay_id] = std::make_unique( + fml::scoped_nsobject(overlay_view), std::move(ios_surface), std::move(surface)); +} + +} // namespace shell + +// This recognizers delays touch events from being dispatched to the responder chain until it failed +// recognizing a gesture. +// +// We only fail this recognizer when asked to do so by the Flutter framework (which does so by +// invoking an acceptGesture method on the platform_views channel). And this is how we allow the +// Flutter framework to delay or prevent the embedded view from getting a touch sequence. +@interface DelayingGestureRecognizer : UIGestureRecognizer +@end + +// While the DelayingGestureRecognizer is preventing touches from hitting the responder chain +// the touch events are not arriving to the FlutterView (and thus not arriving to the Flutter +// framework). We use this gesture recognizer to dispatch the events directly to the FlutterView +// while during this phase. +// +// If the Flutter framework decides to dispatch events to the embedded view, we fail the +// DelayingGestureRecognizer which sends the events up the responder chain. But since the events +// are handled by the embedded view they are not delivered to the Flutter framework in this phase +// as well. So during this phase as well the ForwardingGestureRecognizer dispatched the events +// directly to the FlutterView. +@interface ForwardingGestureRecognizer : UIGestureRecognizer +- (instancetype)initWithTarget:(id)target flutterView:(UIView*)flutterView; +@end + +@implementation FlutterTouchInterceptingView { + fml::scoped_nsobject _delayingRecognizer; +} +- (instancetype)initWithEmbeddedView:(UIView*)embeddedView flutterView:(UIView*)flutterView { + self = [super initWithFrame:embeddedView.frame]; + if (self) { + self.multipleTouchEnabled = YES; + embeddedView.autoresizingMask = + (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); + + [self addSubview:embeddedView]; + + ForwardingGestureRecognizer* forwardingRecognizer = + [[[ForwardingGestureRecognizer alloc] initWithTarget:self + flutterView:flutterView] autorelease]; + + _delayingRecognizer.reset([[DelayingGestureRecognizer alloc] initWithTarget:self action:nil]); + + [self addGestureRecognizer:_delayingRecognizer.get()]; + [self addGestureRecognizer:forwardingRecognizer]; + } + return self; +} + +- (void)releaseGesture { + _delayingRecognizer.get().state = UIGestureRecognizerStateFailed; +} +@end + +@implementation DelayingGestureRecognizer +- (instancetype)initWithTarget:(id)target action:(SEL)action { + self = [super initWithTarget:target action:action]; + if (self) { + self.delaysTouchesBegan = YES; + self.delegate = self; + } + return self; +} + +- (BOOL)gestureRecognizer:(UIGestureRecognizer*)gestureRecognizer + shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer*)otherGestureRecognizer { + return otherGestureRecognizer != self; +} + +- (BOOL)gestureRecognizer:(UIGestureRecognizer*)gestureRecognizer + shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer*)otherGestureRecognizer { + return otherGestureRecognizer == self; +} + +- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event { + // The gesture has ended, and the delaying gesture recognizer was not failed, we recognize + // the gesture to prevent the touches from being dispatched to the embedded view. + // + // This doesn't work well with gestures that are recognized by the Flutter framework after + // all pointers are up. + // + // TODO(amirh): explore if we can instead set this to recognized when the next touch sequence + // begins, or we can use a framework signal for restarting the recognizers (e.g when the + // gesture arena is resolved). + self.state = UIGestureRecognizerStateRecognized; +} + +- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event { + self.state = UIGestureRecognizerStateRecognized; +} +@end + +@implementation ForwardingGestureRecognizer { + // We can't dispatch events to the framework without this back pointer. + // This is a weak reference, the ForwardingGestureRecognizer is owned by the + // FlutterTouchInterceptingView which is strong referenced only by the FlutterView. + // So this is safe as when FlutterView is deallocated the reference to ForwardingGestureRecognizer + // will go away. + UIView* _flutterView; +} + +- (instancetype)initWithTarget:(id)target flutterView:(UIView*)flutterView { + self = [super initWithTarget:target action:nil]; + if (self) { + self.delegate = self; + _flutterView = flutterView; + } + return self; +} + +- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { + [_flutterView touchesBegan:touches withEvent:event]; +} + +- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event { + [_flutterView touchesMoved:touches withEvent:event]; +} + +- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event { + [_flutterView touchesEnded:touches withEvent:event]; + self.state = UIGestureRecognizerStateRecognized; +} + +- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event { + [_flutterView touchesCancelled:touches withEvent:event]; + self.state = UIGestureRecognizerStateRecognized; +} + +- (BOOL)gestureRecognizer:(UIGestureRecognizer*)gestureRecognizer + shouldRecognizeSimultaneouslyWithGestureRecognizer: + (UIGestureRecognizer*)otherGestureRecognizer { + return YES; +} +@end diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h new file mode 100644 index 0000000000000..4173a1ebf6871 --- /dev/null +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h @@ -0,0 +1,103 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWS_INTERNAL_H_ +#define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWS_INTERNAL_H_ + +#include "flutter/flow/embedded_views.h" +#include "flutter/fml/platform/darwin/scoped_nsobject.h" +#include "flutter/shell/common/shell.h" +#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h" +#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h" +#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterPlatformViews.h" + +// A UIView that is used as the parent for embedded UIViews. +// +// This view has 2 roles: +// 1. Delay or prevent touch events from arriving the embedded view. +// 2. Dispatching all events that are hittested to the embedded view to the FlutterView. +@interface FlutterTouchInterceptingView : UIView +- (instancetype)initWithEmbeddedView:(UIView*)embeddedView flutterView:(UIView*)flutterView; + +// Stop delaying any active touch sequence (and let it arrive the embedded view). +- (void)releaseGesture; +@end + +namespace shell { + +class IOSGLContext; +class IOSSurface; + +struct FlutterPlatformViewLayer { + FlutterPlatformViewLayer(fml::scoped_nsobject overlay_view, + std::unique_ptr ios_surface, + std::unique_ptr surface); + + ~FlutterPlatformViewLayer(); + + fml::scoped_nsobject overlay_view; + std::unique_ptr ios_surface; + std::unique_ptr surface; +}; + +class FlutterPlatformViewsController { + public: + FlutterPlatformViewsController(); + + ~FlutterPlatformViewsController(); + + void SetFlutterView(UIView* flutter_view); + + void RegisterViewFactory(NSObject* factory, NSString* factoryId); + + void SetFrameSize(SkISize frame_size); + + void PrerollCompositeEmbeddedView(int view_id); + + std::vector GetCurrentCanvases(); + + SkCanvas* CompositeEmbeddedView(int view_id, const flow::EmbeddedViewParams& params); + + // Discards all platform views instances and auxiliary resources. + void Reset(); + + bool SubmitFrame(bool gl_rendering, + GrContext* gr_context, + std::shared_ptr gl_context); + + void OnMethodCall(FlutterMethodCall* call, FlutterResult& result); + + private: + fml::scoped_nsobject channel_; + fml::scoped_nsobject flutter_view_; + std::map>> factories_; + std::map>> views_; + std::map> touch_interceptors_; + std::map> overlays_; + SkISize frame_size_; + + // A vector of embedded view IDs according to their composition order. + // The last ID in this vector belond to the that is composited on top of all others. + std::vector composition_order_; + + // The latest composition order that was presented in Present(). + std::vector active_composition_order_; + + std::map> picture_recorders_; + + void OnCreate(FlutterMethodCall* call, FlutterResult& result); + void OnDispose(FlutterMethodCall* call, FlutterResult& result); + void OnAcceptGesture(FlutterMethodCall* call, FlutterResult& result); + + void EnsureOverlayInitialized(int64_t overlay_id); + void EnsureGLOverlayInitialized(int64_t overlay_id, + std::shared_ptr gl_context, + GrContext* gr_context); + + FML_DISALLOW_COPY_AND_ASSIGN(FlutterPlatformViewsController); +}; + +} // namespace shell + +#endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWS_INTERNAL_H_ diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm new file mode 100644 index 0000000000000..b6c85c60974fb --- /dev/null +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm @@ -0,0 +1,23 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h" + +#include "flutter/shell/platform/darwin/ios/ios_surface.h" + +namespace shell { +FlutterPlatformViewLayer::FlutterPlatformViewLayer(fml::scoped_nsobject overlay_view, + std::unique_ptr ios_surface, + std::unique_ptr surface) + : overlay_view(std::move(overlay_view)), + ios_surface(std::move(ios_surface)), + surface(std::move(surface)){}; + +FlutterPlatformViewLayer::~FlutterPlatformViewLayer() = default; + +FlutterPlatformViewsController::FlutterPlatformViewsController() = default; + +FlutterPlatformViewsController::~FlutterPlatformViewsController() = default; + +} // namespace shell diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm b/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm index e4d9c03cf9fe1..70b54b0f29231 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -158,6 +158,8 @@ - (void)applicationWillTerminate:(UIApplication*)application { } } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - (void)application:(UIApplication*)application didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings { for (id plugin in _pluginDelegates) { @@ -169,6 +171,7 @@ - (void)application:(UIApplication*)application } } } +#pragma GCC diagnostic pop - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken { @@ -199,6 +202,36 @@ - (void)application:(UIApplication*)application } } +- (void)application:(UIApplication*)application + didReceiveLocalNotification:(UILocalNotification*)notification { + for (id plugin in _pluginDelegates) { + if (!plugin) { + continue; + } + if ([plugin respondsToSelector:_cmd]) { + [plugin application:application didReceiveLocalNotification:notification]; + } + } +} + +- (void)userNotificationCenter:(UNUserNotificationCenter*)center + willPresentNotification:(UNNotification*)notification + withCompletionHandler: + (void (^)(UNNotificationPresentationOptions options))completionHandler { + if (@available(iOS 10.0, *)) { + for (id plugin in _pluginDelegates) { + if (!plugin) { + continue; + } + if ([plugin respondsToSelector:_cmd]) { + [plugin userNotificationCenter:center + willPresentNotification:notification + withCompletionHandler:completionHandler]; + } + } + } +} + - (BOOL)application:(UIApplication*)application openURL:(NSURL*)url options:(NSDictionary*)options { diff --git a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm index bd25217679c9b..c96887feb7b2c 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h index 24197e1ea8d6a..c1eab20fa1ac3 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h b/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h index 3136eb08ccafe..11e9f5bd5f86c 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,7 +21,7 @@ typedef NS_ENUM(NSInteger, FlutterTextInputAction) { FlutterTextInputActionNewline, }; -@protocol FlutterTextInputDelegate +@protocol FlutterTextInputDelegate - (void)updateEditingClient:(int)client withState:(NSDictionary*)state; - (void)performAction:(FlutterTextInputAction)action withClient:(int)client; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h index 198381e4ebbce..9283dd9b809a3 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -36,7 +36,7 @@ @end /** A range of text in the buffer of a Flutter text editing widget. */ -@interface FlutterTextRange : UITextRange +@interface FlutterTextRange : UITextRange @property(nonatomic, readonly) NSRange range; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm index da64123432f93..1e0bead42e5eb 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -289,6 +289,13 @@ - (void)setSelectedTextRange:(UITextRange*)selectedTextRange updateEditingState: } } +- (id)insertDictationResultPlaceholder { + return @""; +} + +- (void)removeDictationResultPlaceholder:(id)placeholder willInsertResult:(BOOL)willInsertResult { +} + - (NSString*)textInRange:(UITextRange*)range { NSRange textRange = ((FlutterTextRange*)range).range; return [self.text substringWithRange:textRange]; @@ -297,7 +304,6 @@ - (NSString*)textInRange:(UITextRange*)range { - (void)replaceRange:(UITextRange*)range withText:(NSString*)text { NSRange replaceRange = ((FlutterTextRange*)range).range; NSRange selectedRange = _selectedTextRange.range; - // Adjust the text selection: // * reduce the length by the intersection length // * adjust the location by newLength - oldLength + intersectionLength diff --git a/shell/platform/darwin/ios/framework/Source/FlutterUmbrellaImport.m b/shell/platform/darwin/ios/framework/Source/FlutterUmbrellaImport.m index dbdce3c596da9..b567d90dadee4 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterUmbrellaImport.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterUmbrellaImport.m @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterView.h b/shell/platform/darwin/ios/framework/Source/FlutterView.h index 5e3d303401725..88196def7a898 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterView.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterView.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,10 +9,29 @@ #include +#import "FlutterPlatformViews_Internal.h" + +#include "flutter/fml/memory/weak_ptr.h" +#include "flutter/shell/common/shell.h" #include "flutter/shell/platform/darwin/ios/ios_surface.h" +@protocol FlutterViewEngineDelegate + +- (shell::Rasterizer::Screenshot)takeScreenshot:(shell::Rasterizer::ScreenshotType)type + asBase64Encoded:(BOOL)base64Encode; + +- (shell::FlutterPlatformViewsController*)platformViewsController; + +@end + @interface FlutterView : UIView +- (instancetype)init NS_UNAVAILABLE; +- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; +- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; + +- (instancetype)initWithDelegate:(id)delegate + opaque:(BOOL)opaque NS_DESIGNATED_INITIALIZER; - (std::unique_ptr)createSurface; @end diff --git a/shell/platform/darwin/ios/framework/Source/FlutterView.mm b/shell/platform/darwin/ios/framework/Source/FlutterView.mm index 32c54f632992f..f60f114f2ea1c 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterView.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterView.mm @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,7 +12,6 @@ #include "flutter/fml/trace_event.h" #include "flutter/shell/common/platform_view.h" #include "flutter/shell/common/rasterizer.h" -#include "flutter/shell/common/shell.h" #include "flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h" #include "flutter/shell/platform/darwin/ios/ios_surface_gl.h" #include "flutter/shell/platform/darwin/ios/ios_surface_software.h" @@ -24,28 +23,42 @@ @interface FlutterView () @implementation FlutterView -- (FlutterViewController*)flutterViewController { - // Find the first view controller in the responder chain and see if it is a FlutterViewController. - for (UIResponder* responder = self.nextResponder; responder != nil; - responder = responder.nextResponder) { - if ([responder isKindOfClass:[UIViewController class]]) { - if ([responder isKindOfClass:[FlutterViewController class]]) { - return reinterpret_cast(responder); - } else { - // Should only happen if a non-FlutterViewController tries to somehow (via dynamic class - // resolution or reparenting) set a FlutterView as its view. - return nil; - } - } +id _delegate; + +- (instancetype)init { + @throw([NSException exceptionWithName:@"FlutterView must initWithDelegate" + reason:nil + userInfo:nil]); +} + +- (instancetype)initWithFrame:(CGRect)frame { + @throw([NSException exceptionWithName:@"FlutterView must initWithDelegate" + reason:nil + userInfo:nil]); +} + +- (instancetype)initWithCoder:(NSCoder*)aDecoder { + @throw([NSException exceptionWithName:@"FlutterView must initWithDelegate" + reason:nil + userInfo:nil]); +} + +- (instancetype)initWithDelegate:(id)delegate opaque:(BOOL)opaque { + FML_DCHECK(delegate) << "Delegate must not be nil."; + self = [super initWithFrame:CGRectNull]; + + if (self) { + _delegate = delegate; + self.layer.opaque = opaque; } - return nil; + + return self; } - (void)layoutSubviews { if ([self.layer isKindOfClass:[CAEAGLLayer class]]) { CAEAGLLayer* layer = reinterpret_cast(self.layer); layer.allowsGroupOpacity = YES; - layer.opaque = YES; CGFloat screenScale = [UIScreen mainScreen].scale; layer.contentsScale = screenScale; layer.rasterizationScale = screenScale; @@ -66,10 +79,21 @@ + (Class)layerClass { if ([self.layer isKindOfClass:[CAEAGLLayer class]]) { fml::scoped_nsobject eagl_layer( reinterpret_cast([self.layer retain])); - return std::make_unique(std::move(eagl_layer)); + if (shell::IsIosEmbeddedViewsPreviewEnabled()) { + // TODO(amirh): We can lower this to iOS 8.0 once we have a Metal rendering backend. + // https://github.com/flutter/flutter/issues/24132 + if (@available(iOS 9.0, *)) { + // TODO(amirh): only do this if there's an embedded view. + // https://github.com/flutter/flutter/issues/24133 + eagl_layer.get().presentsWithTransaction = YES; + } + } + return std::make_unique(std::move(eagl_layer), + [_delegate platformViewsController]); } else { fml::scoped_nsobject layer(reinterpret_cast([self.layer retain])); - return std::make_unique(std::move(layer)); + return std::make_unique(std::move(layer), + [_delegate platformViewsController]); } } @@ -84,16 +108,8 @@ - (void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context { return; } - FlutterViewController* controller = [self flutterViewController]; - - if (controller == nil) { - return; - } - - auto& shell = [controller shell]; - - auto screenshot = shell.Screenshot(shell::Rasterizer::ScreenshotType::UncompressedImage, - false /* base64 encode */); + auto screenshot = [_delegate takeScreenshot:shell::Rasterizer::ScreenshotType::UncompressedImage + asBase64Encoded:NO]; if (!screenshot.data || screenshot.data->isEmpty() || screenshot.frame_size.isEmpty()) { return; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 2c42c14911e57..5a367bdeae6e1 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -1,9 +1,10 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #define FML_USED_ON_EMBEDDER +#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h" #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h" #include @@ -13,66 +14,64 @@ #include "flutter/fml/platform/darwin/platform_version.h" #include "flutter/fml/platform/darwin/scoped_nsobject.h" #include "flutter/shell/common/thread_host.h" -#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h" +#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h" #include "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h" #include "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h" #include "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h" #include "flutter/shell/platform/darwin/ios/framework/Source/FlutterView.h" -#include "flutter/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.h" #include "flutter/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h" #include "flutter/shell/platform/darwin/ios/platform_view_ios.h" -@interface FlutterViewController () -@property(nonatomic, readonly) NSMutableDictionary* pluginPublications; -@end - -@interface FlutterViewControllerRegistrar : NSObject -- (instancetype)initWithPlugin:(NSString*)pluginKey - flutterViewController:(FlutterViewController*)flutterViewController; -@end - @implementation FlutterViewController { - fml::scoped_nsobject _dartProject; - shell::ThreadHost _threadHost; - std::unique_ptr _shell; std::unique_ptr> _weakFactory; - - // Channels - fml::scoped_nsobject _platformPlugin; - fml::scoped_nsobject _textInputPlugin; - fml::scoped_nsobject _localizationChannel; - fml::scoped_nsobject _navigationChannel; - fml::scoped_nsobject _platformChannel; - fml::scoped_nsobject _textInputChannel; - fml::scoped_nsobject _lifecycleChannel; - fml::scoped_nsobject _systemChannel; - fml::scoped_nsobject _settingsChannel; + fml::scoped_nsobject _engine; // We keep a separate reference to this and create it ahead of time because we want to be able to // setup a shell along with its platform view before the view has to appear. fml::scoped_nsobject _flutterView; fml::scoped_nsobject _splashScreenView; + fml::ScopedBlock _flutterViewRenderedCallback; UIInterfaceOrientationMask _orientationPreferences; UIStatusBarStyle _statusBarStyle; blink::ViewportMetrics _viewportMetrics; - shell::TouchMapper _touchMapper; - int64_t _nextTextureId; BOOL _initialized; + BOOL _viewOpaque; + BOOL _engineNeedsLaunch; } #pragma mark - Manage and override all designated initializers +- (instancetype)initWithEngine:(FlutterEngine*)engine + nibName:(NSString*)nibNameOrNil + bundle:(NSBundle*)nibBundleOrNil { + NSAssert(engine != nil, @"Engine is required"); + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + _viewOpaque = YES; + _engine.reset([engine retain]); + _engineNeedsLaunch = NO; + _flutterView.reset([[FlutterView alloc] initWithDelegate:_engine opaque:self.isViewOpaque]); + _weakFactory = std::make_unique>(self); + + [self performCommonViewControllerInitialization]; + [engine setViewController:self]; + } + + return self; +} + - (instancetype)initWithProject:(FlutterDartProject*)projectOrNil nibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { + _viewOpaque = YES; _weakFactory = std::make_unique>(self); - if (projectOrNil == nil) - _dartProject.reset([[FlutterDartProject alloc] init]); - else - _dartProject.reset([projectOrNil retain]); - + _engine.reset([[FlutterEngine alloc] initWithName:@"io.flutter" project:projectOrNil]); + _flutterView.reset([[FlutterView alloc] initWithDelegate:_engine opaque:self.isViewOpaque]); + [_engine.get() createShell:nil libraryURI:nil]; + _engineNeedsLaunch = YES; + [self loadDefaultSplashScreenView]; [self performCommonViewControllerInitialization]; } @@ -91,6 +90,18 @@ - (instancetype)init { return [self initWithProject:nil nibName:nil bundle:nil]; } +- (BOOL)isViewOpaque { + return _viewOpaque; +} + +- (void)setViewOpaque:(BOOL)value { + _viewOpaque = value; + if (_flutterView.get().layer.opaque != value) { + _flutterView.get().layer.opaque = value; + [_flutterView.get().layer setNeedsLayout]; + } +} + #pragma mark - Common view controller initialization tasks - (void)performCommonViewControllerInitialization { @@ -102,129 +113,15 @@ - (void)performCommonViewControllerInitialization { _orientationPreferences = UIInterfaceOrientationMaskAll; _statusBarStyle = UIStatusBarStyleDefault; - if ([self setupShell]) { - [self setupChannels]; - [self setupNotificationCenterObservers]; - - _pluginPublications = [NSMutableDictionary new]; - } -} - -- (shell::Shell&)shell { - FML_DCHECK(_shell); - return *_shell; + [self setupNotificationCenterObservers]; } -- (fml::WeakPtr)iosPlatformView { - FML_DCHECK(_shell); - return _shell->GetPlatformView(); +- (fml::scoped_nsobject)engine { + return _engine; } -- (BOOL)setupShell { - FML_DCHECK(_shell == nullptr); - - static size_t shell_count = 1; - - auto threadLabel = [NSString stringWithFormat:@"io.flutter.%zu", shell_count++]; - - _threadHost = { - threadLabel.UTF8String, // label - shell::ThreadHost::Type::UI | shell::ThreadHost::Type::GPU | shell::ThreadHost::Type::IO}; - - // The current thread will be used as the platform thread. Ensure that the message loop is - // initialized. - fml::MessageLoop::EnsureInitializedForCurrentThread(); - - blink::TaskRunners task_runners(threadLabel.UTF8String, // label - fml::MessageLoop::GetCurrent().GetTaskRunner(), // platform - _threadHost.gpu_thread->GetTaskRunner(), // gpu - _threadHost.ui_thread->GetTaskRunner(), // ui - _threadHost.io_thread->GetTaskRunner() // io - ); - - _flutterView.reset([[FlutterView alloc] init]); - - // Lambda captures by pointers to ObjC objects are fine here because the create call is - // synchronous. - shell::Shell::CreateCallback on_create_platform_view = - [flutter_view_controller = self, flutter_view = _flutterView.get()](shell::Shell& shell) { - auto platform_view_ios = std::make_unique( - shell, // delegate - shell.GetTaskRunners(), // task runners - flutter_view_controller, // flutter view controller owner - flutter_view // flutter view owner - ); - return platform_view_ios; - }; - - shell::Shell::CreateCallback on_create_rasterizer = [](shell::Shell& shell) { - return std::make_unique(shell.GetTaskRunners()); - }; - - // Create the shell. - _shell = shell::Shell::Create(std::move(task_runners), // - [_dartProject settings], // - on_create_platform_view, // - on_create_rasterizer // - ); - - if (!_shell) { - FML_LOG(ERROR) << "Could not setup a shell to run the Dart application."; - return false; - } - - return true; -} - -- (void)setupChannels { - _localizationChannel.reset([[FlutterMethodChannel alloc] - initWithName:@"flutter/localization" - binaryMessenger:self - codec:[FlutterJSONMethodCodec sharedInstance]]); - - _navigationChannel.reset([[FlutterMethodChannel alloc] - initWithName:@"flutter/navigation" - binaryMessenger:self - codec:[FlutterJSONMethodCodec sharedInstance]]); - - _platformChannel.reset([[FlutterMethodChannel alloc] - initWithName:@"flutter/platform" - binaryMessenger:self - codec:[FlutterJSONMethodCodec sharedInstance]]); - - _textInputChannel.reset([[FlutterMethodChannel alloc] - initWithName:@"flutter/textinput" - binaryMessenger:self - codec:[FlutterJSONMethodCodec sharedInstance]]); - - _lifecycleChannel.reset([[FlutterBasicMessageChannel alloc] - initWithName:@"flutter/lifecycle" - binaryMessenger:self - codec:[FlutterStringCodec sharedInstance]]); - - _systemChannel.reset([[FlutterBasicMessageChannel alloc] - initWithName:@"flutter/system" - binaryMessenger:self - codec:[FlutterJSONMessageCodec sharedInstance]]); - - _settingsChannel.reset([[FlutterBasicMessageChannel alloc] - initWithName:@"flutter/settings" - binaryMessenger:self - codec:[FlutterJSONMessageCodec sharedInstance]]); - - _platformPlugin.reset( - [[FlutterPlatformPlugin alloc] initWithViewController:_weakFactory->GetWeakPtr()]); - [_platformChannel.get() setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { - [_platformPlugin.get() handleMethodCall:call result:result]; - }]; - - _textInputPlugin.reset([[FlutterTextInputPlugin alloc] init]); - _textInputPlugin.get().textInputDelegate = self; - [_textInputChannel.get() setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { - [_textInputPlugin.get() handleMethodCall:call result:result]; - }]; - static_cast(_shell->GetPlatformView().get()) - ->SetTextInputPlugin(_textInputPlugin); +- (fml::WeakPtr)getWeakPtr { + return _weakFactory->GetWeakPtr(); } - (void)setupNotificationCenterObservers { @@ -316,15 +213,15 @@ - (void)setupNotificationCenterObservers { } - (void)setInitialRoute:(NSString*)route { - [_navigationChannel.get() invokeMethod:@"setInitialRoute" arguments:route]; + [[_engine.get() navigationChannel] invokeMethod:@"setInitialRoute" arguments:route]; } - (void)popRoute { - [_navigationChannel.get() invokeMethod:@"popRoute" arguments:nil]; + [[_engine.get() navigationChannel] invokeMethod:@"popRoute" arguments:nil]; } - (void)pushRoute:(NSString*)route { - [_navigationChannel.get() invokeMethod:@"pushRoute" arguments:route]; + [[_engine.get() navigationChannel] invokeMethod:@"pushRoute" arguments:route]; } #pragma mark - Loading the view @@ -342,7 +239,7 @@ - (void)loadView { - (void)installSplashScreenViewIfNecessary { // Show the launch screen view again on top of the FlutterView if available. // This launch screen view will be removed once the first Flutter frame is rendered. - if (self.isBeingPresented || self.isMovingToParentViewController) { + if (_splashScreenView && (self.isBeingPresented || self.isMovingToParentViewController)) { [_splashScreenView.get() removeFromSuperview]; _splashScreenView.reset(); return; @@ -369,53 +266,68 @@ - (void)removeSplashScreenViewIfPresent { completion:^(BOOL finished) { [_splashScreenView.get() removeFromSuperview]; _splashScreenView.reset(); + if (_flutterViewRenderedCallback != nil) { + _flutterViewRenderedCallback.get()(); + _flutterViewRenderedCallback.reset(); + } }]; } - (void)installSplashScreenViewCallback { - if (!_shell || !_splashScreenView) { + if (!_splashScreenView) { return; } - auto weak_platform_view = _shell->GetPlatformView(); + auto weak_platform_view = [_engine.get() platformView]; if (!weak_platform_view) { return; } __unsafe_unretained auto weak_flutter_view_controller = self; // This is on the platform thread. - weak_platform_view->SetNextFrameCallback( - [weak_platform_view, weak_flutter_view_controller, - task_runner = _shell->GetTaskRunners().GetPlatformTaskRunner()]() { - // This is on the GPU thread. - task_runner->PostTask([weak_platform_view, weak_flutter_view_controller]() { - // We check if the weak platform view is alive. If it is alive, then the view controller - // also has to be alive since the view controller owns the platform view via the shell - // association. Thus, we are not convinced that the unsafe unretained weak object is in - // fact alive. - if (weak_platform_view) { - [weak_flutter_view_controller removeSplashScreenViewIfPresent]; - } - }); - }); + weak_platform_view->SetNextFrameCallback([weak_platform_view, weak_flutter_view_controller, + task_runner = [_engine.get() platformTaskRunner]]() { + // This is on the GPU thread. + task_runner->PostTask([weak_platform_view, weak_flutter_view_controller]() { + // We check if the weak platform view is alive. If it is alive, then the view controller + // also has to be alive since the view controller owns the platform view via the shell + // association. Thus, we are not convinced that the unsafe unretained weak object is in + // fact alive. + if (weak_platform_view) { + [weak_flutter_view_controller removeSplashScreenViewIfPresent]; + } + }); + }); } #pragma mark - Properties +- (FlutterView*)flutterView { + return _flutterView; +} + - (UIView*)splashScreenView { - if (_splashScreenView == nullptr) { - NSString* launchscreenName = - [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UILaunchStoryboardName"]; - if (launchscreenName == nil) { - return nil; - } - UIView* splashView = [self splashScreenFromStoryboard:launchscreenName]; - if (!splashView) { - splashView = [self splashScreenFromXib:launchscreenName]; - } - self.splashScreenView = splashView; + if (!_splashScreenView) { + return nil; } return _splashScreenView.get(); } +- (BOOL)loadDefaultSplashScreenView { + NSString* launchscreenName = + [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UILaunchStoryboardName"]; + if (launchscreenName == nil) { + return NO; + } + UIView* splashView = [self splashScreenFromStoryboard:launchscreenName]; + if (!splashView) { + splashView = [self splashScreenFromXib:launchscreenName]; + } + if (!splashView) { + return NO; + } + self.splashScreenView = splashView; + return YES; +} + - (UIView*)splashScreenFromStoryboard:(NSString*)name { UIStoryboard* storyboard = nil; @try { @@ -440,21 +352,33 @@ - (UIView*)splashScreenFromXib:(NSString*)name { } - (void)setSplashScreenView:(UIView*)view { + if (!view) { + // Special case: user wants to remove the splash screen view. + [self removeSplashScreenViewIfPresent]; + _splashScreenView.reset(); + return; + } + _splashScreenView.reset([view retain]); _splashScreenView.get().autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; } +- (void)setFlutterViewDidRenderCallback:(void (^)(void))callback { + _flutterViewRenderedCallback.reset(callback, fml::OwnershipPolicy::Retain); +} + #pragma mark - Surface creation and teardown updates - (void)surfaceUpdated:(BOOL)appeared { // NotifyCreated/NotifyDestroyed are synchronous and require hops between the UI and GPU thread. if (appeared) { [self installSplashScreenViewCallback]; - _shell->GetPlatformView()->NotifyCreated(); - + [_engine.get() platformViewsController] -> SetFlutterView(_flutterView.get()); + [_engine.get() platformView] -> NotifyCreated(); } else { - _shell->GetPlatformView()->NotifyDestroyed(); + [_engine.get() platformView] -> NotifyDestroyed(); + [_engine.get() platformViewsController] -> SetFlutterView(nullptr); } } @@ -463,24 +387,17 @@ - (void)surfaceUpdated:(BOOL)appeared { - (void)viewWillAppear:(BOOL)animated { TRACE_EVENT0("flutter", "viewWillAppear"); - // Launch the Dart application with the inferred run configuration. - _shell->GetTaskRunners().GetUITaskRunner()->PostTask( - fml::MakeCopyable([engine = _shell->GetEngine(), // - config = [_dartProject.get() runConfiguration] // - ]() mutable { - if (engine) { - auto result = engine->Run(std::move(config)); - if (result == shell::Engine::RunStatus::Failure) { - FML_LOG(ERROR) << "Could not launch engine with configuration."; - } - } - })); + if (_engineNeedsLaunch) { + [_engine.get() launchEngine:nil libraryURI:nil]; + [_engine.get() setViewController:self]; + _engineNeedsLaunch = NO; + } // Only recreate surface on subsequent appearances when viewport metrics are known. // First time surface creation is done on viewDidLayoutSubviews. if (_viewportMetrics.physical_width) [self surfaceUpdated:YES]; - [_lifecycleChannel.get() sendMessage:@"AppLifecycleState.inactive"]; + [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.inactive"]; [super viewWillAppear:animated]; } @@ -490,14 +407,14 @@ - (void)viewDidAppear:(BOOL)animated { [self onLocaleUpdated:nil]; [self onUserSettingsChanged:nil]; [self onAccessibilityStatusChanged:nil]; - [_lifecycleChannel.get() sendMessage:@"AppLifecycleState.resumed"]; + [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.resumed"]; [super viewDidAppear:animated]; } - (void)viewWillDisappear:(BOOL)animated { TRACE_EVENT0("flutter", "viewWillDisappear"); - [_lifecycleChannel.get() sendMessage:@"AppLifecycleState.inactive"]; + [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.inactive"]; [super viewWillDisappear:animated]; } @@ -505,14 +422,13 @@ - (void)viewWillDisappear:(BOOL)animated { - (void)viewDidDisappear:(BOOL)animated { TRACE_EVENT0("flutter", "viewDidDisappear"); [self surfaceUpdated:NO]; - [_lifecycleChannel.get() sendMessage:@"AppLifecycleState.paused"]; + [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.paused"]; [super viewDidDisappear:animated]; } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - [_pluginPublications release]; [super dealloc]; } @@ -520,55 +436,48 @@ - (void)dealloc { - (void)applicationBecameActive:(NSNotification*)notification { TRACE_EVENT0("flutter", "applicationBecameActive"); - [_lifecycleChannel.get() sendMessage:@"AppLifecycleState.resumed"]; + [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.resumed"]; } - (void)applicationWillResignActive:(NSNotification*)notification { TRACE_EVENT0("flutter", "applicationWillResignActive"); - [_lifecycleChannel.get() sendMessage:@"AppLifecycleState.inactive"]; + [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.inactive"]; } - (void)applicationDidEnterBackground:(NSNotification*)notification { TRACE_EVENT0("flutter", "applicationDidEnterBackground"); [self surfaceUpdated:NO]; - [_lifecycleChannel.get() sendMessage:@"AppLifecycleState.paused"]; + [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.paused"]; } - (void)applicationWillEnterForeground:(NSNotification*)notification { TRACE_EVENT0("flutter", "applicationWillEnterForeground"); if (_viewportMetrics.physical_width) [self surfaceUpdated:YES]; - [_lifecycleChannel.get() sendMessage:@"AppLifecycleState.inactive"]; + [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.inactive"]; } #pragma mark - Touch event handling -enum MapperPhase { - Accessed, - Added, - Removed, -}; - -using PointerChangeMapperPhase = std::pair; -static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(UITouchPhase phase) { +static blink::PointerData::Change PointerDataChangeFromUITouchPhase(UITouchPhase phase) { switch (phase) { case UITouchPhaseBegan: - return PointerChangeMapperPhase(blink::PointerData::Change::kDown, MapperPhase::Added); + return blink::PointerData::Change::kDown; case UITouchPhaseMoved: case UITouchPhaseStationary: // There is no EVENT_TYPE_POINTER_STATIONARY. So we just pass a move type // with the same coordinates - return PointerChangeMapperPhase(blink::PointerData::Change::kMove, MapperPhase::Accessed); + return blink::PointerData::Change::kMove; case UITouchPhaseEnded: - return PointerChangeMapperPhase(blink::PointerData::Change::kUp, MapperPhase::Removed); + return blink::PointerData::Change::kUp; case UITouchPhaseCancelled: - return PointerChangeMapperPhase(blink::PointerData::Change::kCancel, MapperPhase::Removed); + return blink::PointerData::Change::kCancel; } - return PointerChangeMapperPhase(blink::PointerData::Change::kCancel, MapperPhase::Accessed); + return blink::PointerData::Change::kCancel; } -static inline blink::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* touch) { +static blink::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* touch) { if (@available(iOS 9, *)) { switch (touch.type) { case UITouchTypeDirect: @@ -584,33 +493,18 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(UITouc return blink::PointerData::DeviceKind::kTouch; } -- (void)dispatchTouches:(NSSet*)touches phase:(UITouchPhase)phase { - // Note: we cannot rely on touch.phase, since in some cases, e.g., - // handleStatusBarTouches, we synthesize touches from existing events. - // - // TODO(cbracken) consider creating out own class with the touch fields we - // need. - auto eventTypePhase = PointerChangePhaseFromUITouchPhase(phase); +// Dispatches the UITouches to the engine. Usually, the type of change of the touch is determined +// from the UITouch's phase. However, FlutterAppDelegate fakes touches to ensure that touch events +// in the status bar area are available to framework code. The change type (optional) of the faked +// touch is specified in the second argument. +- (void)dispatchTouches:(NSSet*)touches + pointerDataChangeOverride:(blink::PointerData::Change*)overridden_change { const CGFloat scale = [UIScreen mainScreen].scale; auto packet = std::make_unique(touches.count); - int i = 0; - for (UITouch* touch in touches) { - int device_id = 0; - - switch (eventTypePhase.second) { - case Accessed: - device_id = _touchMapper.identifierOf(touch); - break; - case Added: - device_id = _touchMapper.registerTouch(touch); - break; - case Removed: - device_id = _touchMapper.unregisterTouch(touch); - break; - } + size_t pointer_index = 0; - FML_DCHECK(device_id != 0); + for (UITouch* touch in touches) { CGPoint windowCoordinates = [touch locationInView:self.view]; blink::PointerData pointer_data; @@ -619,11 +513,13 @@ - (void)dispatchTouches:(NSSet*)touches phase:(UITouchPhase)phase { constexpr int kMicrosecondsPerSecond = 1000 * 1000; pointer_data.time_stamp = touch.timestamp * kMicrosecondsPerSecond; - pointer_data.change = eventTypePhase.first; + pointer_data.change = overridden_change != nullptr + ? *overridden_change + : PointerDataChangeFromUITouchPhase(touch.phase); pointer_data.kind = DeviceKindFromTouchType(touch); - pointer_data.device = device_id; + pointer_data.device = reinterpret_cast(touch); pointer_data.physical_x = windowCoordinates.x * scale; pointer_data.physical_y = windowCoordinates.y * scale; @@ -681,42 +577,32 @@ - (void)dispatchTouches:(NSSet*)touches phase:(UITouchPhase)phase { pointer_data.orientation = [touch azimuthAngleInView:nil] - M_PI_2; } - packet->SetPointerData(i++, pointer_data); + packet->SetPointerData(pointer_index++, pointer_data); } - _shell->GetTaskRunners().GetUITaskRunner()->PostTask( - fml::MakeCopyable([engine = _shell->GetEngine(), packet = std::move(packet)] { - if (engine) { - engine->DispatchPointerDataPacket(*packet); - } - })); + [_engine.get() dispatchPointerDataPacket:std::move(packet)]; } - (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { - [self dispatchTouches:touches phase:UITouchPhaseBegan]; + [self dispatchTouches:touches pointerDataChangeOverride:nullptr]; } - (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event { - [self dispatchTouches:touches phase:UITouchPhaseMoved]; + [self dispatchTouches:touches pointerDataChangeOverride:nullptr]; } - (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event { - [self dispatchTouches:touches phase:UITouchPhaseEnded]; + [self dispatchTouches:touches pointerDataChangeOverride:nullptr]; } - (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event { - [self dispatchTouches:touches phase:UITouchPhaseCancelled]; + [self dispatchTouches:touches pointerDataChangeOverride:nullptr]; } #pragma mark - Handle view resizing - (void)updateViewportMetrics { - _shell->GetTaskRunners().GetUITaskRunner()->PostTask( - [engine = _shell->GetEngine(), metrics = _viewportMetrics]() { - if (engine) { - engine->SetViewportMetrics(std::move(metrics)); - } - }); + [_engine.get() updateViewportMetrics:_viewportMetrics]; } - (CGFloat)statusBarPadding { @@ -796,58 +682,6 @@ - (void)keyboardWillBeHidden:(NSNotification*)notification { [self updateViewportMetrics]; } -#pragma mark - Text input delegate - -- (void)updateEditingClient:(int)client withState:(NSDictionary*)state { - [_textInputChannel.get() invokeMethod:@"TextInputClient.updateEditingState" - arguments:@[ @(client), state ]]; -} - -- (void)performAction:(FlutterTextInputAction)action withClient:(int)client { - NSString* actionString; - switch (action) { - case FlutterTextInputActionUnspecified: - // Where did the term "unspecified" come from? iOS has a "default" and Android - // has "unspecified." These 2 terms seem to mean the same thing but we need - // to pick just one. "unspecified" was chosen because "default" is often a - // reserved word in languages with switch statements (dart, java, etc). - actionString = @"TextInputAction.unspecified"; - break; - case FlutterTextInputActionDone: - actionString = @"TextInputAction.done"; - break; - case FlutterTextInputActionGo: - actionString = @"TextInputAction.go"; - break; - case FlutterTextInputActionSend: - actionString = @"TextInputAction.send"; - break; - case FlutterTextInputActionSearch: - actionString = @"TextInputAction.search"; - break; - case FlutterTextInputActionNext: - actionString = @"TextInputAction.next"; - break; - case FlutterTextInputActionContinue: - actionString = @"TextInputAction.continue"; - break; - case FlutterTextInputActionJoin: - actionString = @"TextInputAction.join"; - break; - case FlutterTextInputActionRoute: - actionString = @"TextInputAction.route"; - break; - case FlutterTextInputActionEmergencyCall: - actionString = @"TextInputAction.emergencyCall"; - break; - case FlutterTextInputActionNewline: - actionString = @"TextInputAction.newline"; - break; - } - [_textInputChannel.get() invokeMethod:@"TextInputClient.performAction" - arguments:@[ @(client), actionString ]]; -} - #pragma mark - Orientation updates - (void)onOrientationPreferencesUpdated:(NSNotification*)notification { @@ -881,14 +715,14 @@ - (NSUInteger)supportedInterfaceOrientations { #pragma mark - Accessibility - (void)onAccessibilityStatusChanged:(NSNotification*)notification { - auto platformView = _shell->GetPlatformView(); + auto platformView = [_engine.get() platformView]; int32_t flags = 0; if (UIAccessibilityIsInvertColorsEnabled()) - flags ^= static_cast(blink::AccessibilityFeatureFlag::kInvertColors); + flags |= static_cast(blink::AccessibilityFeatureFlag::kInvertColors); if (UIAccessibilityIsReduceMotionEnabled()) - flags ^= static_cast(blink::AccessibilityFeatureFlag::kReduceMotion); + flags |= static_cast(blink::AccessibilityFeatureFlag::kReduceMotion); if (UIAccessibilityIsBoldTextEnabled()) - flags ^= static_cast(blink::AccessibilityFeatureFlag::kBoldText); + flags |= static_cast(blink::AccessibilityFeatureFlag::kBoldText); #if TARGET_OS_SIMULATOR // There doesn't appear to be any way to determine whether the accessibility // inspector is enabled on the simulator. We conservatively always turn on the @@ -897,8 +731,8 @@ - (void)onAccessibilityStatusChanged:(NSNotification*)notification { platformView->SetAccessibilityFeatures(flags); #else bool enabled = UIAccessibilityIsVoiceOverRunning() || UIAccessibilityIsSwitchControlRunning(); - if (UIAccessibilityIsVoiceOverRunning() || UIAccessibilityIsSwitchControlRunning()) - flags ^= static_cast(blink::AccessibilityFeatureFlag::kAccessibleNavigation); + if (enabled) + flags |= static_cast(blink::AccessibilityFeatureFlag::kAccessibleNavigation); platformView->SetSemanticsEnabled(enabled || UIAccessibilityIsSpeakScreenEnabled()); platformView->SetAccessibilityFeatures(flags); #endif @@ -907,23 +741,55 @@ - (void)onAccessibilityStatusChanged:(NSNotification*)notification { #pragma mark - Memory Notifications - (void)onMemoryWarning:(NSNotification*)notification { - [_systemChannel.get() sendMessage:@{@"type" : @"memoryPressure"}]; + [[_engine.get() systemChannel] sendMessage:@{@"type" : @"memoryPressure"}]; } #pragma mark - Locale updates - (void)onLocaleUpdated:(NSNotification*)notification { + NSArray* preferredLocales = [NSLocale preferredLanguages]; + NSMutableArray* data = [[NSMutableArray new] autorelease]; + + // Force prepend the [NSLocale currentLocale] to the front of the list + // to ensure we are including the full default locale. preferredLocales + // is not guaranteed to include anything beyond the languageCode. NSLocale* currentLocale = [NSLocale currentLocale]; NSString* languageCode = [currentLocale objectForKey:NSLocaleLanguageCode]; NSString* countryCode = [currentLocale objectForKey:NSLocaleCountryCode]; - if (languageCode && countryCode) - [_localizationChannel.get() invokeMethod:@"setLocale" arguments:@[ languageCode, countryCode ]]; + NSString* scriptCode = [currentLocale objectForKey:NSLocaleScriptCode]; + NSString* variantCode = [currentLocale objectForKey:NSLocaleVariantCode]; + if (languageCode) { + [data addObject:languageCode]; + [data addObject:(countryCode ? countryCode : @"")]; + [data addObject:(scriptCode ? scriptCode : @"")]; + [data addObject:(variantCode ? variantCode : @"")]; + } + + // Add any secondary locales/languages to the list. + for (NSString* localeID in preferredLocales) { + NSLocale* currentLocale = [[[NSLocale alloc] initWithLocaleIdentifier:localeID] autorelease]; + NSString* languageCode = [currentLocale objectForKey:NSLocaleLanguageCode]; + NSString* countryCode = [currentLocale objectForKey:NSLocaleCountryCode]; + NSString* scriptCode = [currentLocale objectForKey:NSLocaleScriptCode]; + NSString* variantCode = [currentLocale objectForKey:NSLocaleVariantCode]; + if (!languageCode) { + continue; + } + [data addObject:languageCode]; + [data addObject:(countryCode ? countryCode : @"")]; + [data addObject:(scriptCode ? scriptCode : @"")]; + [data addObject:(variantCode ? variantCode : @"")]; + } + if (data.count == 0) { + return; + } + [[_engine.get() localizationChannel] invokeMethod:@"setLocale" arguments:data]; } #pragma mark - Set user settings - (void)onUserSettingsChanged:(NSNotification*)notification { - [_settingsChannel.get() sendMessage:@{ + [[_engine.get() settingsChannel] sendMessage:@{ @"textScaleFactor" : @([self textScaleFactor]), @"alwaysUse24HourFormat" : @([self isAlwaysUse24HourFormat]), }]; @@ -1024,8 +890,11 @@ - (void)handleStatusBarTouches:(UIEvent*)event { CGPoint screenLoc = [touch.window convertPoint:windowLoc toWindow:nil]; if (CGRectContainsPoint(statusBarFrame, screenLoc)) { NSSet* statusbarTouches = [NSSet setWithObject:touch]; - [self dispatchTouches:statusbarTouches phase:UITouchPhaseBegan]; - [self dispatchTouches:statusbarTouches phase:UITouchPhaseEnded]; + + blink::PointerData::Change change = blink::PointerData::Change::kDown; + [self dispatchTouches:statusbarTouches pointerDataChangeOverride:&change]; + change = blink::PointerData::Change::kUp; + [self dispatchTouches:statusbarTouches pointerDataChangeOverride:&change]; return; } } @@ -1058,52 +927,43 @@ - (void)onPreferredStatusBarStyleUpdated:(NSNotification*)notification { }); } +#pragma mark - Platform views + +- (shell::FlutterPlatformViewsController*)platformViewsController { + return [_engine.get() platformViewsController]; +} + #pragma mark - FlutterBinaryMessenger - (void)sendOnChannel:(NSString*)channel message:(NSData*)message { - [self sendOnChannel:channel message:message binaryReply:nil]; + [_engine.get() sendOnChannel:channel message:message]; } - (void)sendOnChannel:(NSString*)channel message:(NSData*)message binaryReply:(FlutterBinaryReply)callback { NSAssert(channel, @"The channel must not be null"); - fml::RefPtr response = - (callback == nil) ? nullptr - : fml::MakeRefCounted( - ^(NSData* reply) { - callback(reply); - }, - _shell->GetTaskRunners().GetPlatformTaskRunner()); - fml::RefPtr platformMessage = - (message == nil) ? fml::MakeRefCounted(channel.UTF8String, response) - : fml::MakeRefCounted( - channel.UTF8String, shell::GetVectorFromNSData(message), response); - - _shell->GetPlatformView()->DispatchPlatformMessage(platformMessage); + [_engine.get() sendOnChannel:channel message:message binaryReply:callback]; } - (void)setMessageHandlerOnChannel:(NSString*)channel binaryMessageHandler:(FlutterBinaryMessageHandler)handler { NSAssert(channel, @"The channel must not be null"); - [self iosPlatformView] -> GetPlatformMessageRouter().SetMessageHandler(channel.UTF8String, - handler); + [_engine.get() setMessageHandlerOnChannel:channel binaryMessageHandler:handler]; } #pragma mark - FlutterTextureRegistry - (int64_t)registerTexture:(NSObject*)texture { - int64_t textureId = _nextTextureId++; - [self iosPlatformView] -> RegisterExternalTexture(textureId, texture); - return textureId; + return [_engine.get() registerTexture:texture]; } - (void)unregisterTexture:(int64_t)textureId { - _shell->GetPlatformView()->UnregisterTexture(textureId); + [_engine.get() unregisterTexture:textureId]; } - (void)textureFrameAvailable:(int64_t)textureId { - _shell->GetPlatformView()->MarkTextureFrameAvailable(textureId); + [_engine.get() textureFrameAvailable:textureId]; } - (NSString*)lookupKeyForAsset:(NSString*)asset { @@ -1115,81 +975,21 @@ - (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package { } - (id)pluginRegistry { - return self; + return _engine; } #pragma mark - FlutterPluginRegistry - (NSObject*)registrarForPlugin:(NSString*)pluginKey { - NSAssert(self.pluginPublications[pluginKey] == nil, @"Duplicate plugin key: %@", pluginKey); - self.pluginPublications[pluginKey] = [NSNull null]; - return [[FlutterViewControllerRegistrar alloc] initWithPlugin:pluginKey - flutterViewController:self]; + return [_engine.get() registrarForPlugin:pluginKey]; } - (BOOL)hasPlugin:(NSString*)pluginKey { - return _pluginPublications[pluginKey] != nil; + return [_engine.get() hasPlugin:pluginKey]; } - (NSObject*)valuePublishedByPlugin:(NSString*)pluginKey { - return _pluginPublications[pluginKey]; -} -@end - -@implementation FlutterViewControllerRegistrar { - NSString* _pluginKey; - FlutterViewController* _flutterViewController; -} - -- (instancetype)initWithPlugin:(NSString*)pluginKey - flutterViewController:(FlutterViewController*)flutterViewController { - self = [super init]; - NSAssert(self, @"Super init cannot be nil"); - _pluginKey = [pluginKey retain]; - _flutterViewController = [flutterViewController retain]; - return self; -} - -- (void)dealloc { - [_pluginKey release]; - [_flutterViewController release]; - [super dealloc]; -} - -- (NSObject*)messenger { - return _flutterViewController; -} - -- (NSObject*)textures { - return _flutterViewController; -} - -- (void)publish:(NSObject*)value { - _flutterViewController.pluginPublications[_pluginKey] = value; -} - -- (void)addMethodCallDelegate:(NSObject*)delegate - channel:(FlutterMethodChannel*)channel { - [channel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { - [delegate handleMethodCall:call result:result]; - }]; -} - -- (void)addApplicationDelegate:(NSObject*)delegate { - id appDelegate = [[UIApplication sharedApplication] delegate]; - if ([appDelegate conformsToProtocol:@protocol(FlutterAppLifeCycleProvider)]) { - id lifeCycleProvider = - (id)appDelegate; - [lifeCycleProvider addApplicationLifeCycleDelegate:delegate]; - } -} - -- (NSString*)lookupKeyForAsset:(NSString*)asset { - return [_flutterViewController lookupKeyForAsset:asset]; -} - -- (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package { - return [_flutterViewController lookupKeyForAsset:asset fromPackage:package]; + return [_engine.get() valuePublishedByPlugin:pluginKey]; } @end diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h index 482379c8f17eb..46705b9be8d23 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h @@ -1,16 +1,23 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERVIEWCONTROLLER_INTERNAL_H_ #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERVIEWCONTROLLER_INTERNAL_H_ +#include "flutter/flow/embedded_views.h" +#include "flutter/fml/memory/weak_ptr.h" +#include "flutter/fml/platform/darwin/scoped_nsobject.h" #include "flutter/shell/common/shell.h" #include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h" +#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h" @interface FlutterViewController () -- (shell::Shell&)shell; +- (fml::WeakPtr)getWeakPtr; +- (shell::FlutterPlatformViewsController*)platformViewsController; + +@property(readonly) fml::scoped_nsobject engine; @end diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h index 3c90a23af0851..465abc5035191 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h +++ b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -129,11 +129,12 @@ class AccessibilityBridge final { fml::WeakPtr GetWeakPtr(); + void clearState(); + private: SemanticsObject* GetOrCreateObject(int32_t id, blink::SemanticsNodeUpdates& updates); void VisitObjectsRecursivelyAndRemove(SemanticsObject* object, NSMutableArray* doomed_uids); - void ReleaseObjects(std::unordered_map& objects); void HandleEvent(NSDictionary* annotatedEvent); UIView* view_; diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm index 6b60bc6b3ba68..d744e5fc06605 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm +++ b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -257,7 +257,7 @@ - (CGRect)globalRect { // `rect` is in the physical pixel coordinate system. iOS expects the accessibility frame in // the logical pixel coordinate system. Therefore, we divide by the `scale` (pixel ratio) to // convert. - CGFloat scale = [[[self bridge] -> view() window] screen].scale; + CGFloat scale = [[[self bridge]->view() window] screen].scale; auto result = CGRectMake(rect.x() / scale, rect.y() / scale, rect.width() / scale, rect.height() / scale); return UIAccessibilityConvertFrameToScreenCoordinates(result, [self bridge] -> view()); @@ -268,8 +268,8 @@ - (CGRect)globalRect { - (id)accessibilityContainer { if ([self hasChildren] || [self uid] == kRootNodeId) { if (_container == nil) - _container = - [[SemanticsObjectContainer alloc] initWithSemanticsObject:self bridge:[self bridge]]; + _container = [[SemanticsObjectContainer alloc] initWithSemanticsObject:self + bridge:[self bridge]]; return _container; } if ([self parent] == nil) { @@ -498,7 +498,7 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction { previous_routes_({}) { accessibility_channel_.reset([[FlutterBasicMessageChannel alloc] initWithName:@"flutter/accessibility" - binaryMessenger:platform_view->GetOwnerViewController() + binaryMessenger:platform_view->GetOwnerViewController().get() codec:[FlutterStandardMessageCodec sharedInstance]]); [accessibility_channel_.get() setMessageHandler:^(id message, FlutterReply reply) { HandleEvent((NSDictionary*)message); @@ -654,11 +654,11 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction { [objects_ removeObjectForKey:@(node.id)]; if (isTextField) { // Text fields are backed by objects that implement UITextInput. - object = - [[[TextInputSemanticsObject alloc] initWithBridge:GetWeakPtr() uid:uid] autorelease]; + object = [[[TextInputSemanticsObject alloc] initWithBridge:GetWeakPtr() + uid:uid] autorelease]; } else { - object = - [[[FlutterSemanticsObject alloc] initWithBridge:GetWeakPtr() uid:uid] autorelease]; + object = [[[FlutterSemanticsObject alloc] initWithBridge:GetWeakPtr() + uid:uid] autorelease]; } [object.parent.children replaceObjectAtIndex:positionInChildlist withObject:object]; objects_.get()[@(node.id)] = object; @@ -687,4 +687,10 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction { return weak_factory_.GetWeakPtr(); } +void AccessibilityBridge::clearState() { + [objects_ removeAllObjects]; + previous_route_id_ = 0; + previous_routes_.clear(); +} + } // namespace shell diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.h b/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.h index bcdebfc689deb..163346d7b04dd 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.h +++ b/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,7 +11,7 @@ * * This class is used by `TextInputSemanticsObject`. */ -@interface FlutterInactiveTextInput : UIView +@interface FlutterInactiveTextInput : UIView @property(nonatomic, copy) NSString* text; @property(nonatomic, readonly) NSMutableString* markedText; @@ -30,7 +30,7 @@ * field that currently owns input focus. Delegates to * `FlutterInactiveTextInput` otherwise. */ -@interface TextInputSemanticsObject : SemanticsObject +@interface TextInputSemanticsObject : SemanticsObject @end #endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_ACCESSIBILITY_TEXT_ENTRY_H_ diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.mm b/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.mm index ec98c5d003204..0edde04a2c2c1 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.mm +++ b/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.mm @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -343,8 +343,9 @@ - (UITextPosition*)positionFromPosition:(UITextPosition*)position offset:(NSInte - (UITextPosition*)positionFromPosition:(UITextPosition*)position inDirection:(UITextLayoutDirection)direction offset:(NSInteger)offset { - return - [[self textInputSurrogate] positionFromPosition:position inDirection:direction offset:offset]; + return [[self textInputSurrogate] positionFromPosition:position + inDirection:direction + offset:offset]; } - (NSComparisonResult)comparePosition:(UITextPosition*)position toPosition:(UITextPosition*)other { @@ -362,8 +363,8 @@ - (UITextPosition*)positionWithinRange:(UITextRange*)range - (UITextRange*)characterRangeByExtendingPosition:(UITextPosition*)position inDirection:(UITextLayoutDirection)direction { - return - [[self textInputSurrogate] characterRangeByExtendingPosition:position inDirection:direction]; + return [[self textInputSurrogate] characterRangeByExtendingPosition:position + inDirection:direction]; } - (UITextWritingDirection)baseWritingDirectionForPosition:(UITextPosition*)position diff --git a/shell/platform/darwin/ios/framework/Source/flutter_codecs_unittest.mm b/shell/platform/darwin/ios/framework/Source/flutter_codecs_unittest.mm index b94793d39e812..0e257a42c634b 100644 --- a/shell/platform/darwin/ios/framework/Source/flutter_codecs_unittest.mm +++ b/shell/platform/darwin/ios/framework/Source/flutter_codecs_unittest.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -56,7 +56,7 @@ } TEST(FlutterJSONCodec, CanEncodeAndDecodeDictionary) { - NSDictionary* value = @{ @"a" : @3.14, @"b" : @47, @"c" : [NSNull null], @"d" : @[ @"nested" ] }; + NSDictionary* value = @{@"a" : @3.14, @"b" : @47, @"c" : [NSNull null], @"d" : @[ @"nested" ]}; FlutterJSONMessageCodec* codec = [FlutterJSONMessageCodec sharedInstance]; NSData* encoded = [codec encode:value]; NSDictionary* decoded = [codec decode:encoded]; diff --git a/shell/platform/darwin/ios/framework/Source/flutter_standard_codec_unittest.mm b/shell/platform/darwin/ios/framework/Source/flutter_standard_codec_unittest.mm index 41cb39a0792af..381b87f96ac20 100644 --- a/shell/platform/darwin/ios/framework/Source/flutter_standard_codec_unittest.mm +++ b/shell/platform/darwin/ios/framework/Source/flutter_standard_codec_unittest.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.h b/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.h deleted file mode 100644 index e88b35d4ed5ad..0000000000000 --- a/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_TOUCH_MAPPER_H_ -#define SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_TOUCH_MAPPER_H_ - -#include - -#include "flutter/fml/macros.h" - -#include - -namespace shell { - -/// UITouch pointers cannot be used as touch ids (even though they remain -/// constant throughout the multitouch sequence) because internal components -/// assume that ids are < 16. This class maps touch pointers to ids -class TouchMapper { - public: - TouchMapper(); - ~TouchMapper(); - - int registerTouch(UITouch* touch); - - int unregisterTouch(UITouch* touch); - - int identifierOf(UITouch* touch) const; - - private: - using BitSet = long long int; - BitSet free_spots_; - std::map touch_map_; - - FML_DISALLOW_COPY_AND_ASSIGN(TouchMapper); -}; - -} // namespace shell - -#endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_TOUCH_MAPPER_H_ diff --git a/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.mm b/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.mm deleted file mode 100644 index b0a69b03acd47..0000000000000 --- a/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.mm +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "flutter/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.h" - -namespace shell { - -TouchMapper::TouchMapper() : free_spots_(~0) {} - -TouchMapper::~TouchMapper() = default; - -int TouchMapper::registerTouch(UITouch* touch) { - int freeSpot = ffsll(free_spots_); - touch_map_[touch] = freeSpot; - free_spots_ &= ~(1 << (freeSpot - 1)); - return freeSpot; -} - -int TouchMapper::unregisterTouch(UITouch* touch) { - auto index = touch_map_[touch]; - free_spots_ |= 1 << (index - 1); - touch_map_.erase(touch); - return index; -} - -int TouchMapper::identifierOf(UITouch* touch) const { - return touch_map_.at(touch); -} - -} // namespace shell diff --git a/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h b/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h index dd6ec72d56db4..ee6b929bc9843 100644 --- a/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h +++ b/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,24 +20,15 @@ namespace shell { class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse { public: - void Complete(std::unique_ptr data) override { - fml::RefPtr self(this); - platform_task_runner_->PostTask(fml::MakeCopyable([self, data = std::move(data)]() mutable { - self->callback_.get()(shell::GetNSDataFromMapping(std::move(data))); - })); - } - - void CompleteEmpty() override { - fml::RefPtr self(this); - platform_task_runner_->PostTask( - fml::MakeCopyable([self]() mutable { self->callback_.get()(nil); })); - } + void Complete(std::unique_ptr data) override; + + void CompleteEmpty() override; private: explicit PlatformMessageResponseDarwin(PlatformMessageResponseCallback callback, - fml::RefPtr platform_task_runner) - : callback_(callback, fml::OwnershipPolicy::Retain), - platform_task_runner_(std::move(platform_task_runner)) {} + fml::RefPtr platform_task_runner); + + ~PlatformMessageResponseDarwin() override; fml::ScopedBlock callback_; fml::RefPtr platform_task_runner_; diff --git a/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.mm b/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.mm index 8590b4e36942b..0d45e4e2ff4e1 100644 --- a/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.mm +++ b/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.mm @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,25 @@ namespace shell { -// +PlatformMessageResponseDarwin::PlatformMessageResponseDarwin( + PlatformMessageResponseCallback callback, + fml::RefPtr platform_task_runner) + : callback_(callback, fml::OwnershipPolicy::Retain), + platform_task_runner_(std::move(platform_task_runner)) {} + +PlatformMessageResponseDarwin::~PlatformMessageResponseDarwin() = default; + +void PlatformMessageResponseDarwin::Complete(std::unique_ptr data) { + fml::RefPtr self(this); + platform_task_runner_->PostTask(fml::MakeCopyable([self, data = std::move(data)]() mutable { + self->callback_.get()(shell::GetNSDataFromMapping(std::move(data))); + })); +} + +void PlatformMessageResponseDarwin::CompleteEmpty() { + fml::RefPtr self(this); + platform_task_runner_->PostTask( + fml::MakeCopyable([self]() mutable { self->callback_.get()(nil); })); +} } // namespace shell diff --git a/shell/platform/darwin/ios/framework/Source/platform_message_router.h b/shell/platform/darwin/ios/framework/Source/platform_message_router.h index 4013dc947da0b..1949d817d888d 100644 --- a/shell/platform/darwin/ios/framework/Source/platform_message_router.h +++ b/shell/platform/darwin/ios/framework/Source/platform_message_router.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/ios/framework/Source/platform_message_router.mm b/shell/platform/darwin/ios/framework/Source/platform_message_router.mm index 0378539deefab..6cfb3049ac63a 100644 --- a/shell/platform/darwin/ios/framework/Source/platform_message_router.mm +++ b/shell/platform/darwin/ios/framework/Source/platform_message_router.mm @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h b/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h index 000f84a4a35b9..335d47892ae81 100644 --- a/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h +++ b/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm b/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm index 6b80c12946b85..702fdc9a51e13 100644 --- a/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm +++ b/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/ios/headless_platform_view_ios.h b/shell/platform/darwin/ios/headless_platform_view_ios.h deleted file mode 100644 index 940e2ade4af58..0000000000000 --- a/shell/platform/darwin/ios/headless_platform_view_ios.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SHELL_PLATFORM_IOS_HEADLESS_PLATFORM_VIEW_IOS_H_ -#define SHELL_PLATFORM_IOS_HEADLESS_PLATFORM_VIEW_IOS_H_ - -#include - -#include "flutter/fml/closure.h" -#include "flutter/fml/macros.h" -#include "flutter/fml/memory/weak_ptr.h" -#include "flutter/fml/platform/darwin/scoped_nsobject.h" -#include "flutter/shell/common/platform_view.h" -#include "flutter/shell/platform/darwin/ios/framework/Source/platform_message_router.h" - -namespace shell { - -class HeadlessPlatformViewIOS : public PlatformView { - public: - explicit HeadlessPlatformViewIOS(Delegate& delegate, - blink::TaskRunners task_runners); - virtual ~HeadlessPlatformViewIOS(); - - PlatformMessageRouter& GetPlatformMessageRouter(); - - private: - PlatformMessageRouter platform_message_router_; - - // |shell::PlatformView| - void HandlePlatformMessage(fml::RefPtr message); - - FML_DISALLOW_COPY_AND_ASSIGN(HeadlessPlatformViewIOS); -}; - -} // namespace shell - -#endif // SHELL_PLATFORM_IOS_HEADLESS_PLATFORM_VIEW_IOS_H_ diff --git a/shell/platform/darwin/ios/headless_platform_view_ios.mm b/shell/platform/darwin/ios/headless_platform_view_ios.mm deleted file mode 100644 index c496253494398..0000000000000 --- a/shell/platform/darwin/ios/headless_platform_view_ios.mm +++ /dev/null @@ -1,20 +0,0 @@ - -#include "flutter/shell/platform/darwin/ios/headless_platform_view_ios.h" - -namespace shell { - -HeadlessPlatformViewIOS::HeadlessPlatformViewIOS(PlatformView::Delegate& delegate, - blink::TaskRunners task_runners) - : PlatformView(delegate, std::move(task_runners)) {} - -HeadlessPlatformViewIOS::~HeadlessPlatformViewIOS() = default; - -PlatformMessageRouter& HeadlessPlatformViewIOS::GetPlatformMessageRouter() { - return platform_message_router_; -} - -// |shell::PlatformView| -void HeadlessPlatformViewIOS::HandlePlatformMessage(fml::RefPtr message) { - platform_message_router_.HandlePlatformMessage(std::move(message)); -} -} diff --git a/shell/platform/darwin/ios/ios_external_texture_gl.h b/shell/platform/darwin/ios/ios_external_texture_gl.h index 0ad69483385f2..d258234708a0b 100644 --- a/shell/platform/darwin/ios/ios_external_texture_gl.h +++ b/shell/platform/darwin/ios/ios_external_texture_gl.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,21 +13,18 @@ namespace shell { class IOSExternalTextureGL : public flow::Texture { public: - IOSExternalTextureGL(int64_t textureId, - NSObject* externalTexture); + IOSExternalTextureGL(int64_t textureId, NSObject* externalTexture); ~IOSExternalTextureGL() override; // Called from GPU thread. - virtual void Paint(SkCanvas& canvas, - const SkRect& bounds, - bool freeze) override; + void Paint(SkCanvas& canvas, const SkRect& bounds, bool freeze) override; - virtual void OnGrContextCreated() override; + void OnGrContextCreated() override; - virtual void OnGrContextDestroyed() override; + void OnGrContextDestroyed() override; - virtual void MarkNewFrameAvailable() override; + void MarkNewFrameAvailable() override; private: NSObject* external_texture_; diff --git a/shell/platform/darwin/ios/ios_external_texture_gl.mm b/shell/platform/darwin/ios/ios_external_texture_gl.mm index 638894b8aba5b..e77970697d079 100644 --- a/shell/platform/darwin/ios/ios_external_texture_gl.mm +++ b/shell/platform/darwin/ios/ios_external_texture_gl.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/darwin/ios/ios_gl_context.h b/shell/platform/darwin/ios/ios_gl_context.h index e81954d58a0ef..08778d21319a7 100644 --- a/shell/platform/darwin/ios/ios_gl_context.h +++ b/shell/platform/darwin/ios/ios_gl_context.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,22 +13,18 @@ #include "flutter/fml/macros.h" #include "flutter/fml/platform/darwin/scoped_nsobject.h" #include "flutter/shell/common/platform_view.h" +#include "ios_gl_render_target.h" namespace shell { class IOSGLContext { public: - IOSGLContext(fml::scoped_nsobject layer); + IOSGLContext(); ~IOSGLContext(); - bool IsValid() const; - - bool PresentRenderBuffer() const; - - GLuint framebuffer() const { return framebuffer_; } - - bool UpdateStorageSizeIfNecessary(); + std::unique_ptr CreateRenderTarget( + fml::scoped_nsobject layer); bool MakeCurrent(); @@ -37,15 +33,9 @@ class IOSGLContext { sk_sp ColorSpace() const { return color_space_; } private: - fml::scoped_nsobject layer_; fml::scoped_nsobject context_; fml::scoped_nsobject resource_context_; - GLuint framebuffer_; - GLuint colorbuffer_; - GLint storage_size_width_; - GLint storage_size_height_; sk_sp color_space_; - bool valid_; FML_DISALLOW_COPY_AND_ASSIGN(IOSGLContext); }; diff --git a/shell/platform/darwin/ios/ios_gl_context.mm b/shell/platform/darwin/ios/ios_gl_context.mm index 765e3c3650589..c8819a78b8372 100644 --- a/shell/platform/darwin/ios/ios_gl_context.mm +++ b/shell/platform/darwin/ios/ios_gl_context.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,13 +12,7 @@ namespace shell { -IOSGLContext::IOSGLContext(fml::scoped_nsobject layer) - : layer_(std::move(layer)), - framebuffer_(GL_NONE), - colorbuffer_(GL_NONE), - storage_size_width_(0), - storage_size_height_(0), - valid_(false) { +IOSGLContext::IOSGLContext() { context_.reset([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]); if (context_ != nullptr) { resource_context_.reset([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3 @@ -29,35 +23,6 @@ sharegroup:context_.get().sharegroup]); } - FML_DCHECK(layer_ != nullptr); - FML_DCHECK(context_ != nullptr); - FML_DCHECK(resource_context_ != nullptr); - - bool context_current = [EAGLContext setCurrentContext:context_]; - - FML_DCHECK(context_current); - FML_DCHECK(glGetError() == GL_NO_ERROR); - - // Generate the framebuffer - - glGenFramebuffers(1, &framebuffer_); - FML_DCHECK(glGetError() == GL_NO_ERROR); - FML_DCHECK(framebuffer_ != GL_NONE); - - glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_); - FML_DCHECK(glGetError() == GL_NO_ERROR); - - // Setup color attachment - - glGenRenderbuffers(1, &colorbuffer_); - FML_DCHECK(colorbuffer_ != GL_NONE); - - glBindRenderbuffer(GL_RENDERBUFFER, colorbuffer_); - FML_DCHECK(glGetError() == GL_NO_ERROR); - - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorbuffer_); - FML_DCHECK(glGetError() == GL_NO_ERROR); - // TODO: // iOS displays are more variable than just P3 or sRGB. Reading the display // gamut just tells us what color space it makes sense to render into. We @@ -78,84 +43,18 @@ break; } } - - NSString* drawableColorFormat = kEAGLColorFormatRGBA8; - layer_.get().drawableProperties = @{ - kEAGLDrawablePropertyColorFormat : drawableColorFormat, - kEAGLDrawablePropertyRetainedBacking : @(NO), - }; - - valid_ = true; -} - -IOSGLContext::~IOSGLContext() { - FML_DCHECK(glGetError() == GL_NO_ERROR); - - // Deletes on GL_NONEs are ignored - glDeleteFramebuffers(1, &framebuffer_); - glDeleteRenderbuffers(1, &colorbuffer_); - - FML_DCHECK(glGetError() == GL_NO_ERROR); -} - -bool IOSGLContext::IsValid() const { - return valid_; -} - -bool IOSGLContext::PresentRenderBuffer() const { - const GLenum discards[] = { - GL_DEPTH_ATTACHMENT, - GL_STENCIL_ATTACHMENT, - }; - - glDiscardFramebufferEXT(GL_FRAMEBUFFER, sizeof(discards) / sizeof(GLenum), discards); - - glBindRenderbuffer(GL_RENDERBUFFER, colorbuffer_); - return [[EAGLContext currentContext] presentRenderbuffer:GL_RENDERBUFFER]; } -bool IOSGLContext::UpdateStorageSizeIfNecessary() { - const CGSize layer_size = [layer_.get() bounds].size; - const CGFloat contents_scale = layer_.get().contentsScale; - const GLint size_width = layer_size.width * contents_scale; - const GLint size_height = layer_size.height * contents_scale; - - if (size_width == storage_size_width_ && size_height == storage_size_height_) { - // Nothing to since the stoage size is already consistent with the layer. - return true; - } - TRACE_EVENT_INSTANT0("flutter", "IOSGLContext::UpdateStorageSizeIfNecessary"); - FML_DLOG(INFO) << "Updating render buffer storage size."; - - if (![EAGLContext setCurrentContext:context_]) { - return false; - } - - FML_DCHECK(glGetError() == GL_NO_ERROR); - - glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_); - - glBindRenderbuffer(GL_RENDERBUFFER, colorbuffer_); - FML_DCHECK(glGetError() == GL_NO_ERROR); - - if (![context_.get() renderbufferStorage:GL_RENDERBUFFER fromDrawable:layer_.get()]) { - return false; - } - - // Fetch the dimensions of the color buffer whose backing was just updated. - glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &storage_size_width_); - FML_DCHECK(glGetError() == GL_NO_ERROR); - - glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &storage_size_height_); - FML_DCHECK(glGetError() == GL_NO_ERROR); - - FML_DCHECK(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE); +IOSGLContext::~IOSGLContext() = default; - return true; +std::unique_ptr IOSGLContext::CreateRenderTarget( + fml::scoped_nsobject layer) { + return std::make_unique(std::move(layer), context_.get(), + resource_context_.get()); } bool IOSGLContext::MakeCurrent() { - return UpdateStorageSizeIfNecessary() && [EAGLContext setCurrentContext:context_.get()]; + return [EAGLContext setCurrentContext:context_.get()]; } bool IOSGLContext::ResourceMakeCurrent() { diff --git a/shell/platform/darwin/ios/ios_gl_render_target.h b/shell/platform/darwin/ios/ios_gl_render_target.h new file mode 100644 index 0000000000000..ce2a128bd3c48 --- /dev/null +++ b/shell/platform/darwin/ios/ios_gl_render_target.h @@ -0,0 +1,57 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_GL_RENDER_TARGET_H_ +#define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_GL_RENDER_TARGET_H_ + +#import +#import +#import +#import + +#include "flutter/fml/macros.h" +#include "flutter/fml/platform/darwin/scoped_nsobject.h" +#include "flutter/shell/common/platform_view.h" + +namespace shell { + +class IOSGLRenderTarget { + public: + IOSGLRenderTarget(fml::scoped_nsobject layer, + EAGLContext* context, + EAGLContext* resource_context); + + ~IOSGLRenderTarget(); + + bool IsValid() const; + + bool PresentRenderBuffer() const; + + GLuint framebuffer() const { return framebuffer_; } + + bool UpdateStorageSizeIfNecessary(); + + bool MakeCurrent(); + + bool ResourceMakeCurrent(); + + sk_sp ColorSpace() const { return color_space_; } + + private: + fml::scoped_nsobject layer_; + fml::scoped_nsobject context_; + fml::scoped_nsobject resource_context_; + GLuint framebuffer_; + GLuint colorbuffer_; + GLint storage_size_width_; + GLint storage_size_height_; + sk_sp color_space_; + bool valid_; + + FML_DISALLOW_COPY_AND_ASSIGN(IOSGLRenderTarget); +}; + +} // namespace shell + +#endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_GL_RENDER_TARGET_H_ diff --git a/shell/platform/darwin/ios/ios_gl_render_target.mm b/shell/platform/darwin/ios/ios_gl_render_target.mm new file mode 100644 index 0000000000000..308c7a5a95866 --- /dev/null +++ b/shell/platform/darwin/ios/ios_gl_render_target.mm @@ -0,0 +1,140 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/shell/platform/darwin/ios/ios_gl_render_target.h" + +#include + +#include "flutter/fml/trace_event.h" +#include "third_party/skia/include/gpu/GrContextOptions.h" +#include "third_party/skia/include/gpu/gl/GrGLInterface.h" + +namespace shell { + +IOSGLRenderTarget::IOSGLRenderTarget(fml::scoped_nsobject layer, + EAGLContext* context, + EAGLContext* resource_context) + : layer_(std::move(layer)), + context_([context retain]), + resource_context_([resource_context retain]), + framebuffer_(GL_NONE), + colorbuffer_(GL_NONE), + storage_size_width_(0), + storage_size_height_(0), + valid_(false) { + FML_DCHECK(layer_ != nullptr); + FML_DCHECK(context_ != nullptr); + FML_DCHECK(resource_context_ != nullptr); + + bool context_current = [EAGLContext setCurrentContext:context_]; + + FML_DCHECK(context_current); + FML_DCHECK(glGetError() == GL_NO_ERROR); + + // Generate the framebuffer + + glGenFramebuffers(1, &framebuffer_); + FML_DCHECK(glGetError() == GL_NO_ERROR); + FML_DCHECK(framebuffer_ != GL_NONE); + + glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_); + FML_DCHECK(glGetError() == GL_NO_ERROR); + + // Setup color attachment + + glGenRenderbuffers(1, &colorbuffer_); + FML_DCHECK(colorbuffer_ != GL_NONE); + + glBindRenderbuffer(GL_RENDERBUFFER, colorbuffer_); + FML_DCHECK(glGetError() == GL_NO_ERROR); + + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorbuffer_); + FML_DCHECK(glGetError() == GL_NO_ERROR); + + NSString* drawableColorFormat = kEAGLColorFormatRGBA8; + layer_.get().drawableProperties = @{ + kEAGLDrawablePropertyColorFormat : drawableColorFormat, + kEAGLDrawablePropertyRetainedBacking : @(NO), + }; + + valid_ = true; +} + +IOSGLRenderTarget::~IOSGLRenderTarget() { + FML_DCHECK(glGetError() == GL_NO_ERROR); + + // Deletes on GL_NONEs are ignored + glDeleteFramebuffers(1, &framebuffer_); + glDeleteRenderbuffers(1, &colorbuffer_); + + FML_DCHECK(glGetError() == GL_NO_ERROR); +} + +bool IOSGLRenderTarget::IsValid() const { + return valid_; +} + +bool IOSGLRenderTarget::PresentRenderBuffer() const { + const GLenum discards[] = { + GL_DEPTH_ATTACHMENT, + GL_STENCIL_ATTACHMENT, + }; + + glDiscardFramebufferEXT(GL_FRAMEBUFFER, sizeof(discards) / sizeof(GLenum), discards); + + glBindRenderbuffer(GL_RENDERBUFFER, colorbuffer_); + return [[EAGLContext currentContext] presentRenderbuffer:GL_RENDERBUFFER]; +} + +bool IOSGLRenderTarget::UpdateStorageSizeIfNecessary() { + const CGSize layer_size = [layer_.get() bounds].size; + const CGFloat contents_scale = layer_.get().contentsScale; + const GLint size_width = layer_size.width * contents_scale; + const GLint size_height = layer_size.height * contents_scale; + + if (size_width == storage_size_width_ && size_height == storage_size_height_) { + // Nothing to since the stoage size is already consistent with the layer. + return true; + } + TRACE_EVENT_INSTANT0("flutter", "IOSGLRenderTarget::UpdateStorageSizeIfNecessary"); + FML_DLOG(INFO) << "Updating render buffer storage size."; + + FML_DCHECK(glGetError() == GL_NO_ERROR); + + if (![EAGLContext setCurrentContext:context_]) { + return false; + } + + FML_DCHECK(glGetError() == GL_NO_ERROR); + + glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_); + + glBindRenderbuffer(GL_RENDERBUFFER, colorbuffer_); + FML_DCHECK(glGetError() == GL_NO_ERROR); + + if (![context_.get() renderbufferStorage:GL_RENDERBUFFER fromDrawable:layer_.get()]) { + return false; + } + + // Fetch the dimensions of the color buffer whose backing was just updated. + glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &storage_size_width_); + FML_DCHECK(glGetError() == GL_NO_ERROR); + + glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &storage_size_height_); + FML_DCHECK(glGetError() == GL_NO_ERROR); + + FML_DCHECK(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE); + + return true; +} + +bool IOSGLRenderTarget::MakeCurrent() { + return UpdateStorageSizeIfNecessary() && [EAGLContext setCurrentContext:context_.get()]; +} + +bool IOSGLRenderTarget::ResourceMakeCurrent() { + return [EAGLContext setCurrentContext:resource_context_.get()]; +} + +} // namespace shell diff --git a/shell/platform/darwin/ios/ios_surface.h b/shell/platform/darwin/ios/ios_surface.h index 8011905db4d68..1fc6a4218dc75 100644 --- a/shell/platform/darwin/ios/ios_surface.h +++ b/shell/platform/darwin/ios/ios_surface.h @@ -1,10 +1,12 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_H_ #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_H_ +#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h" + #include #include "flutter/fml/macros.h" @@ -13,9 +15,13 @@ namespace shell { +// Returns true if the app explicitly specified to use the iOS view embedding +// mechanism which is still in a release preview. +bool IsIosEmbeddedViewsPreviewEnabled(); + class IOSSurface { public: - IOSSurface(); + IOSSurface(FlutterPlatformViewsController* platform_views_controller); virtual ~IOSSurface(); @@ -27,6 +33,12 @@ class IOSSurface { virtual std::unique_ptr CreateGPUSurface() = 0; + protected: + FlutterPlatformViewsController* GetPlatformViewsController(); + + private: + FlutterPlatformViewsController* platform_views_controller_; + public: FML_DISALLOW_COPY_AND_ASSIGN(IOSSurface); }; diff --git a/shell/platform/darwin/ios/ios_surface.mm b/shell/platform/darwin/ios/ios_surface.mm index b0b9cc3245183..f9d2d4cfbd500 100644 --- a/shell/platform/darwin/ios/ios_surface.mm +++ b/shell/platform/darwin/ios/ios_surface.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,13 +6,24 @@ #include -#include -#include +#include "flutter/shell/platform/darwin/ios/ios_surface_gl.h" +#include "flutter/shell/platform/darwin/ios/ios_surface_software.h" namespace shell { -IOSSurface::IOSSurface() = default; +// The name of the Info.plist flag to enable the embedded iOS views preview. +const char* const kEmbeddedViewsPreview = "io.flutter.embedded_views_preview"; + +bool IsIosEmbeddedViewsPreviewEnabled() { + return [[[NSBundle mainBundle] objectForInfoDictionaryKey:@(kEmbeddedViewsPreview)] boolValue]; +} + +IOSSurface::IOSSurface(FlutterPlatformViewsController* platform_views_controller) + : platform_views_controller_(platform_views_controller) {} IOSSurface::~IOSSurface() = default; +FlutterPlatformViewsController* IOSSurface::GetPlatformViewsController() { + return platform_views_controller_; +} } // namespace shell diff --git a/shell/platform/darwin/ios/ios_surface_gl.h b/shell/platform/darwin/ios/ios_surface_gl.h index 1a3fc3ed3b406..93fcc0f510624 100644 --- a/shell/platform/darwin/ios/ios_surface_gl.h +++ b/shell/platform/darwin/ios/ios_surface_gl.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,15 +9,21 @@ #include "flutter/fml/platform/darwin/scoped_nsobject.h" #include "flutter/shell/gpu/gpu_surface_gl.h" #include "flutter/shell/platform/darwin/ios/ios_gl_context.h" +#include "flutter/shell/platform/darwin/ios/ios_gl_render_target.h" #include "flutter/shell/platform/darwin/ios/ios_surface.h" @class CAEAGLLayer; namespace shell { -class IOSSurfaceGL : public IOSSurface, public GPUSurfaceGLDelegate { +class IOSSurfaceGL : public IOSSurface, + public GPUSurfaceGLDelegate, + public flow::ExternalViewEmbedder { public: - IOSSurfaceGL(fml::scoped_nsobject layer); + IOSSurfaceGL(fml::scoped_nsobject layer, + FlutterPlatformViewsController* platform_views_controller); + + IOSSurfaceGL(fml::scoped_nsobject layer, std::shared_ptr context); ~IOSSurfaceGL() override; @@ -29,6 +35,8 @@ class IOSSurfaceGL : public IOSSurface, public GPUSurfaceGLDelegate { std::unique_ptr CreateGPUSurface() override; + std::unique_ptr CreateSecondaryGPUSurface(GrContext* gr_context); + bool GLContextMakeCurrent() override; bool GLContextClearCurrent() override; @@ -39,8 +47,27 @@ class IOSSurfaceGL : public IOSSurface, public GPUSurfaceGLDelegate { bool UseOffscreenSurface() const override; + // |shell::GPUSurfaceGLDelegate| + flow::ExternalViewEmbedder* GetExternalViewEmbedder() override; + + // |flow::ExternalViewEmbedder| + void BeginFrame(SkISize frame_size) override; + + // |flow::ExternalViewEmbedder| + void PrerollCompositeEmbeddedView(int view_id) override; + + // |flow::ExternalViewEmbedder| + std::vector GetCurrentCanvases() override; + + // |flow::ExternalViewEmbedder| + SkCanvas* CompositeEmbeddedView(int view_id, const flow::EmbeddedViewParams& params) override; + + // |flow::ExternalViewEmbedder| + bool SubmitFrame(GrContext* context) override; + private: - IOSGLContext context_; + std::shared_ptr context_; + std::unique_ptr render_target_; FML_DISALLOW_COPY_AND_ASSIGN(IOSSurfaceGL); }; diff --git a/shell/platform/darwin/ios/ios_surface_gl.mm b/shell/platform/darwin/ios/ios_surface_gl.mm index 253531c4800aa..cd0bb093d87d4 100644 --- a/shell/platform/darwin/ios/ios_surface_gl.mm +++ b/shell/platform/darwin/ios/ios_surface_gl.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,21 +9,32 @@ namespace shell { -IOSSurfaceGL::IOSSurfaceGL(fml::scoped_nsobject layer) : context_(std::move(layer)) {} +IOSSurfaceGL::IOSSurfaceGL(fml::scoped_nsobject layer, + FlutterPlatformViewsController* platform_views_controller) + : IOSSurface(platform_views_controller) { + context_ = std::make_shared(); + render_target_ = context_->CreateRenderTarget(std::move(layer)); +} + +IOSSurfaceGL::IOSSurfaceGL(fml::scoped_nsobject layer, + std::shared_ptr context) + : IOSSurface(nullptr), context_(context) { + render_target_ = context_->CreateRenderTarget(std::move(layer)); +} IOSSurfaceGL::~IOSSurfaceGL() = default; bool IOSSurfaceGL::IsValid() const { - return context_.IsValid(); + return render_target_->IsValid(); } bool IOSSurfaceGL::ResourceContextMakeCurrent() { - return IsValid() ? context_.ResourceMakeCurrent() : false; + return render_target_->IsValid() ? context_->ResourceMakeCurrent() : false; } void IOSSurfaceGL::UpdateStorageSizeIfNecessary() { if (IsValid()) { - context_.UpdateStorageSizeIfNecessary(); + render_target_->UpdateStorageSizeIfNecessary(); } } @@ -31,8 +42,12 @@ return std::make_unique(this); } +std::unique_ptr IOSSurfaceGL::CreateSecondaryGPUSurface(GrContext* gr_context) { + return std::make_unique(sk_ref_sp(gr_context), this); +} + intptr_t IOSSurfaceGL::GLContextFBO() const { - return IsValid() ? context_.framebuffer() : GL_NONE; + return IsValid() ? render_target_->framebuffer() : GL_NONE; } bool IOSSurfaceGL::UseOffscreenSurface() const { @@ -43,7 +58,10 @@ } bool IOSSurfaceGL::GLContextMakeCurrent() { - return IsValid() ? context_.MakeCurrent() : false; + if (!IsValid()) { + return false; + } + return render_target_->UpdateStorageSizeIfNecessary() && context_->MakeCurrent(); } bool IOSSurfaceGL::GLContextClearCurrent() { @@ -53,7 +71,51 @@ bool IOSSurfaceGL::GLContextPresent() { TRACE_EVENT0("flutter", "IOSSurfaceGL::GLContextPresent"); - return IsValid() ? context_.PresentRenderBuffer() : false; + return IsValid() && render_target_->PresentRenderBuffer(); +} + +flow::ExternalViewEmbedder* IOSSurfaceGL::GetExternalViewEmbedder() { + if (IsIosEmbeddedViewsPreviewEnabled()) { + return this; + } else { + return nullptr; + } +} + +void IOSSurfaceGL::BeginFrame(SkISize frame_size) { + FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController(); + FML_CHECK(platform_views_controller != nullptr); + platform_views_controller->SetFrameSize(frame_size); + [CATransaction begin]; +} + +void IOSSurfaceGL::PrerollCompositeEmbeddedView(int view_id) { + FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController(); + FML_CHECK(platform_views_controller != nullptr); + platform_views_controller->PrerollCompositeEmbeddedView(view_id); +} + +std::vector IOSSurfaceGL::GetCurrentCanvases() { + FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController(); + FML_CHECK(platform_views_controller != nullptr); + return platform_views_controller->GetCurrentCanvases(); +} + +SkCanvas* IOSSurfaceGL::CompositeEmbeddedView(int view_id, const flow::EmbeddedViewParams& params) { + FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController(); + FML_CHECK(platform_views_controller != nullptr); + return platform_views_controller->CompositeEmbeddedView(view_id, params); +} + +bool IOSSurfaceGL::SubmitFrame(GrContext* context) { + FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController(); + if (platform_views_controller == nullptr) { + return true; + } + + bool submitted = platform_views_controller->SubmitFrame(true, std::move(context), context_); + [CATransaction commit]; + return submitted; } } // namespace shell diff --git a/shell/platform/darwin/ios/ios_surface_software.h b/shell/platform/darwin/ios/ios_surface_software.h index 154f057489f48..79695b3a2767d 100644 --- a/shell/platform/darwin/ios/ios_surface_software.h +++ b/shell/platform/darwin/ios/ios_surface_software.h @@ -1,10 +1,11 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_SOFTWARE_H_ #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_SOFTWARE_H_ +#include "flutter/flow/embedded_views.h" #include "flutter/fml/macros.h" #include "flutter/fml/platform/darwin/scoped_nsobject.h" #include "flutter/shell/gpu/gpu_surface_software.h" @@ -15,9 +16,11 @@ namespace shell { class IOSSurfaceSoftware final : public IOSSurface, - public GPUSurfaceSoftwareDelegate { + public GPUSurfaceSoftwareDelegate, + public flow::ExternalViewEmbedder { public: - IOSSurfaceSoftware(fml::scoped_nsobject layer); + IOSSurfaceSoftware(fml::scoped_nsobject layer, + FlutterPlatformViewsController* platform_views_controller); ~IOSSurfaceSoftware() override; @@ -39,6 +42,24 @@ class IOSSurfaceSoftware final : public IOSSurface, // |shell::GPUSurfaceSoftwareDelegate| bool PresentBackingStore(sk_sp backing_store) override; + // |shell::GPUSurfaceSoftwareDelegate| + flow::ExternalViewEmbedder* GetExternalViewEmbedder() override; + + // |flow::ExternalViewEmbedder| + void BeginFrame(SkISize frame_size) override; + + // |flow::ExternalViewEmbedder| + void PrerollCompositeEmbeddedView(int view_id) override; + + // |flow::ExternalViewEmbedder| + std::vector GetCurrentCanvases() override; + + // |flow::ExternalViewEmbedder| + SkCanvas* CompositeEmbeddedView(int view_id, const flow::EmbeddedViewParams& params) override; + + // |flow::ExternalViewEmbedder| + bool SubmitFrame(GrContext* context) override; + private: fml::scoped_nsobject layer_; sk_sp sk_surface_; diff --git a/shell/platform/darwin/ios/ios_surface_software.mm b/shell/platform/darwin/ios/ios_surface_software.mm index dba1fd7ce1fe9..5d120ef47c061 100644 --- a/shell/platform/darwin/ios/ios_surface_software.mm +++ b/shell/platform/darwin/ios/ios_surface_software.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,8 +15,9 @@ namespace shell { -IOSSurfaceSoftware::IOSSurfaceSoftware(fml::scoped_nsobject layer) - : layer_(std::move(layer)) { +IOSSurfaceSoftware::IOSSurfaceSoftware(fml::scoped_nsobject layer, + FlutterPlatformViewsController* platform_views_controller) + : IOSSurface(platform_views_controller), layer_(std::move(layer)) { UpdateStorageSizeIfNecessary(); } @@ -125,4 +126,45 @@ return true; } +flow::ExternalViewEmbedder* IOSSurfaceSoftware::GetExternalViewEmbedder() { + if (IsIosEmbeddedViewsPreviewEnabled()) { + return this; + } else { + return nullptr; + } +} + +void IOSSurfaceSoftware::BeginFrame(SkISize frame_size) { + FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController(); + FML_CHECK(platform_views_controller != nullptr); + platform_views_controller->SetFrameSize(frame_size); +} + +void IOSSurfaceSoftware::PrerollCompositeEmbeddedView(int view_id) { + FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController(); + FML_CHECK(platform_views_controller != nullptr); + platform_views_controller->PrerollCompositeEmbeddedView(view_id); +} + +std::vector IOSSurfaceSoftware::GetCurrentCanvases() { + FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController(); + FML_CHECK(platform_views_controller != nullptr); + return platform_views_controller->GetCurrentCanvases(); +} + +SkCanvas* IOSSurfaceSoftware::CompositeEmbeddedView(int view_id, + const flow::EmbeddedViewParams& params) { + FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController(); + FML_CHECK(platform_views_controller != nullptr); + return platform_views_controller->CompositeEmbeddedView(view_id, params); +} + +bool IOSSurfaceSoftware::SubmitFrame(GrContext* context) { + FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController(); + if (platform_views_controller == nullptr) { + return true; + } + return platform_views_controller->SubmitFrame(false, nullptr, nullptr); +} + } // namespace shell diff --git a/shell/platform/darwin/ios/platform_view_ios.h b/shell/platform/darwin/ios/platform_view_ios.h index 014f045f70c77..a0d85a7ffd0f9 100644 --- a/shell/platform/darwin/ios/platform_view_ios.h +++ b/shell/platform/darwin/ios/platform_view_ios.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,38 +16,41 @@ #include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h" #include "flutter/shell/platform/darwin/ios/framework/Source/FlutterView.h" #include "flutter/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h" -#include "flutter/shell/platform/darwin/ios/headless_platform_view_ios.h" +#include "flutter/shell/platform/darwin/ios/framework/Source/platform_message_router.h" #include "flutter/shell/platform/darwin/ios/ios_surface.h" +@class FlutterViewController; + namespace shell { -class PlatformViewIOS final : public HeadlessPlatformViewIOS { +class PlatformViewIOS final : public PlatformView { public: - explicit PlatformViewIOS(PlatformView::Delegate& delegate, - blink::TaskRunners task_runners, - FlutterViewController* owner_controller_, - FlutterView* owner_view_); + explicit PlatformViewIOS(PlatformView::Delegate& delegate, blink::TaskRunners task_runners); ~PlatformViewIOS() override; - FlutterViewController* GetOwnerViewController() const; + PlatformMessageRouter& GetPlatformMessageRouter(); + + fml::WeakPtr GetOwnerViewController() const; + void SetOwnerViewController(fml::WeakPtr owner_controller); void RegisterExternalTexture(int64_t id, NSObject* texture); fml::scoped_nsprotocol GetTextInputPlugin() const; - void SetTextInputPlugin( - fml::scoped_nsprotocol plugin); + void SetTextInputPlugin(fml::scoped_nsprotocol plugin); private: - FlutterViewController* owner_controller_; // weak reference. - FlutterView* owner_view_; // weak reference. + fml::WeakPtr owner_controller_; std::unique_ptr ios_surface_; PlatformMessageRouter platform_message_router_; std::unique_ptr accessibility_bridge_; fml::scoped_nsprotocol text_input_plugin_; fml::closure firstFrameCallback_; + // |shell::PlatformView| + void HandlePlatformMessage(fml::RefPtr message) override; + // |shell::PlatformView| std::unique_ptr CreateRenderingSurface() override; @@ -61,13 +64,15 @@ class PlatformViewIOS final : public HeadlessPlatformViewIOS { void SetAccessibilityFeatures(int32_t flags) override; // |shell::PlatformView| - void UpdateSemantics( - blink::SemanticsNodeUpdates update, - blink::CustomAccessibilityActionUpdates actions) override; + void UpdateSemantics(blink::SemanticsNodeUpdates update, + blink::CustomAccessibilityActionUpdates actions) override; // |shell::PlatformView| std::unique_ptr CreateVSyncWaiter() override; + // |shell::PlatformView| + void OnPreEngineRestart() const override; + FML_DISALLOW_COPY_AND_ASSIGN(PlatformViewIOS); }; diff --git a/shell/platform/darwin/ios/platform_view_ios.mm b/shell/platform/darwin/ios/platform_view_ios.mm index 7bf0895589346..f3371a9834a53 100644 --- a/shell/platform/darwin/ios/platform_view_ios.mm +++ b/shell/platform/darwin/ios/platform_view_ios.mm @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,30 +12,52 @@ #include "flutter/fml/synchronization/waitable_event.h" #include "flutter/fml/trace_event.h" #include "flutter/shell/common/io_manager.h" +#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h" #include "flutter/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h" #include "flutter/shell/platform/darwin/ios/ios_external_texture_gl.h" namespace shell { -PlatformViewIOS::PlatformViewIOS(PlatformView::Delegate& delegate, - blink::TaskRunners task_runners, - FlutterViewController* owner_controller, - FlutterView* owner_view) - : HeadlessPlatformViewIOS(delegate, std::move(task_runners)), - owner_controller_(owner_controller), - owner_view_(owner_view), - ios_surface_(owner_view_.createSurface) { - FML_DCHECK(ios_surface_ != nullptr); - FML_DCHECK(owner_controller_ != nullptr); - FML_DCHECK(owner_view_ != nullptr); -} +PlatformViewIOS::PlatformViewIOS(PlatformView::Delegate& delegate, blink::TaskRunners task_runners) + : PlatformView(delegate, std::move(task_runners)) {} PlatformViewIOS::~PlatformViewIOS() = default; -FlutterViewController* PlatformViewIOS::GetOwnerViewController() const { +PlatformMessageRouter& PlatformViewIOS::GetPlatformMessageRouter() { + return platform_message_router_; +} + +// |shell::PlatformView| +void PlatformViewIOS::HandlePlatformMessage(fml::RefPtr message) { + platform_message_router_.HandlePlatformMessage(std::move(message)); +} + +fml::WeakPtr PlatformViewIOS::GetOwnerViewController() const { return owner_controller_; } +void PlatformViewIOS::SetOwnerViewController(fml::WeakPtr owner_controller) { + if (ios_surface_ || !owner_controller) { + NotifyDestroyed(); + ios_surface_.reset(); + accessibility_bridge_.reset(); + } + owner_controller_ = owner_controller; + if (owner_controller_) { + ios_surface_ = static_cast(owner_controller.get().view).createSurface; + FML_DCHECK(ios_surface_ != nullptr); + + if (accessibility_bridge_) { + accessibility_bridge_.reset( + new AccessibilityBridge(static_cast(owner_controller_.get().view), this)); + } + // Do not call `NotifyCreated()` here - let FlutterViewController take care + // of that when its Viewport is sized. If `NotifyCreated()` is called here, + // it can occasionally get invoked before the viewport is sized resulting in + // a framebuffer that will not be able to completely attach. + } +} + void PlatformViewIOS::RegisterExternalTexture(int64_t texture_id, NSObject* texture) { RegisterTexture(std::make_shared(texture_id, texture)); @@ -43,13 +65,19 @@ // |shell::PlatformView| std::unique_ptr PlatformViewIOS::CreateRenderingSurface() { + if (!ios_surface_) { + FML_DLOG(INFO) << "Could not CreateRenderingSurface, this PlatformViewIOS " + "has no ViewController."; + return nullptr; + } return ios_surface_->CreateGPUSurface(); } // |shell::PlatformView| sk_sp PlatformViewIOS::CreateResourceContext() const { - if (!ios_surface_->ResourceContextMakeCurrent()) { - FML_DLOG(INFO) << "Could not make resource context current on IO thread. Async texture uploads " + if (!ios_surface_ || !ios_surface_->ResourceContextMakeCurrent()) { + FML_DLOG(INFO) << "Could not make resource context current on IO thread. " + "Async texture uploads " "will be disabled."; return nullptr; } @@ -59,8 +87,14 @@ // |shell::PlatformView| void PlatformViewIOS::SetSemanticsEnabled(bool enabled) { + if (!owner_controller_) { + FML_DLOG(WARNING) << "Could not set semantics to enabled, this " + "PlatformViewIOS has no ViewController."; + return; + } if (enabled && !accessibility_bridge_) { - accessibility_bridge_ = std::make_unique(owner_view_, this); + accessibility_bridge_ = std::make_unique( + static_cast(owner_controller_.get().view), this); } else if (!enabled && accessibility_bridge_) { accessibility_bridge_.reset(); } @@ -85,6 +119,16 @@ return std::make_unique(task_runners_); } +void PlatformViewIOS::OnPreEngineRestart() const { + if (accessibility_bridge_) { + accessibility_bridge_->clearState(); + } + if (!owner_controller_) { + return; + } + [owner_controller_.get() platformViewsController] -> Reset(); +} + fml::scoped_nsprotocol PlatformViewIOS::GetTextInputPlugin() const { return text_input_plugin_; } diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn index 40426bdb9cabb..1e4142bab59af 100644 --- a/shell/platform/embedder/BUILD.gn +++ b/shell/platform/embedder/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2017 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -16,15 +16,15 @@ source_set("embedder") { sources = [ "embedder.cc", "embedder.h", + "embedder_engine.cc", + "embedder_engine.h", + "embedder_include.c", "embedder_surface.cc", "embedder_surface.h", "embedder_surface_gl.cc", "embedder_surface_gl.h", "embedder_surface_software.cc", "embedder_surface_software.h", - "embedder_engine.cc", - "embedder_engine.h", - "embedder_include.c", "platform_view_embedder.cc", "platform_view_embedder.h", ] @@ -39,7 +39,6 @@ source_set("embedder") { "//third_party/dart/runtime:libdart_jit", "//third_party/dart/runtime/bin:dart_io_api", "//third_party/skia", - "//third_party/skia:gpu", "//third_party/tonic", ] @@ -92,7 +91,7 @@ copy("copy_headers") { ] } -if (is_mac) { +if (is_mac && !embedder_for_target) { _flutter_embedder_framework_dir = "$root_out_dir/FlutterEmbedder.framework" copy("copy_dylib") { @@ -225,7 +224,7 @@ group("flutter_engine") { ] # For the Mac, the dylib is packaged in a framework with the appropriate headers. - if (is_mac) { + if (is_mac && !embedder_for_target) { deps += [ ":flutter_embedder_framework" ] } } diff --git a/shell/platform/embedder/assets/EmbedderInfo.plist b/shell/platform/embedder/assets/EmbedderInfo.plist index 38352b319ff5b..37c1e436ccb5e 100644 --- a/shell/platform/embedder/assets/EmbedderInfo.plist +++ b/shell/platform/embedder/assets/EmbedderInfo.plist @@ -23,6 +23,6 @@ CFBundleVersion 1 NSHumanReadableCopyright - Copyright 2017 The Flutter Authors. All rights reserved. + Copyright 2013 The Flutter Authors. All rights reserved. diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index cecb6cd4e9597..d7acb7d4db068 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -1,10 +1,11 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #define FML_USED_ON_EMBEDDER #include "flutter/fml/build_config.h" +#include "flutter/fml/native_library.h" #if OS_WIN #define FLUTTER_EXPORT __declspec(dllexport) @@ -88,6 +89,19 @@ static bool IsRendererValid(const FlutterRendererConfig* config) { return false; } +#if OS_LINUX || OS_WIN +static void* DefaultGLProcResolver(const char* name) { + static fml::RefPtr proc_library = +#if OS_LINUX + fml::NativeLibrary::CreateForCurrentProcess(); +#elif OS_WIN // OS_LINUX + fml::NativeLibrary::Create("opengl32.dll"); +#endif // OS_WIN + return static_cast( + const_cast(proc_library->ResolveSymbol(name))); +} +#endif // OS_LINUX || OS_WIN + static shell::Shell::CreateCallback InferOpenGLPlatformViewCreationCallback( const FlutterRendererConfig* config, @@ -144,6 +158,10 @@ InferOpenGLPlatformViewCreationCallback( user_data](const char* gl_proc_name) { return ptr(user_data, gl_proc_name); }; + } else { +#if OS_LINUX || OS_WIN + gl_proc_resolver = DefaultGLProcResolver; +#endif } bool fbo_reset_after_present = diff --git a/shell/platform/embedder/embedder.gni b/shell/platform/embedder/embedder.gni index 79d06f7c9151e..87a66cfd348b3 100644 --- a/shell/platform/embedder/embedder.gni +++ b/shell/platform/embedder/embedder.gni @@ -1,4 +1,4 @@ -# Copyright 2018 The Flutter Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 6a4928f0d0172..dd1ba06ddcc20 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/embedder/embedder_engine.cc b/shell/platform/embedder/embedder_engine.cc index 1f4dc3402b72c..7299e38e37e93 100644 --- a/shell/platform/embedder/embedder_engine.cc +++ b/shell/platform/embedder/embedder_engine.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,10 +6,6 @@ #include "flutter/fml/make_copyable.h" -#ifdef ERROR -#undef ERROR -#endif - namespace shell { EmbedderEngine::EmbedderEngine( diff --git a/shell/platform/embedder/embedder_engine.h b/shell/platform/embedder/embedder_engine.h index cd21e701d5c01..8ccac002754e0 100644 --- a/shell/platform/embedder/embedder_engine.h +++ b/shell/platform/embedder/embedder_engine.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/embedder/embedder_include.c b/shell/platform/embedder/embedder_include.c index 4c45bcb1addff..10d21dc1b44e7 100644 --- a/shell/platform/embedder/embedder_include.c +++ b/shell/platform/embedder/embedder_include.c @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/embedder/embedder_surface.cc b/shell/platform/embedder/embedder_surface.cc index d14b114e7410c..b61802cbce9ac 100644 --- a/shell/platform/embedder/embedder_surface.cc +++ b/shell/platform/embedder/embedder_surface.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/embedder/embedder_surface.h b/shell/platform/embedder/embedder_surface.h index 5db1394875b29..74af9462b1af4 100644 --- a/shell/platform/embedder/embedder_surface.h +++ b/shell/platform/embedder/embedder_surface.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/embedder/embedder_surface_gl.cc b/shell/platform/embedder/embedder_surface_gl.cc index 1ee37c0615564..7e43a1066cfcd 100644 --- a/shell/platform/embedder/embedder_surface_gl.cc +++ b/shell/platform/embedder/embedder_surface_gl.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,10 +6,6 @@ #include "flutter/shell/common/io_manager.h" -#ifdef ERROR -#undef ERROR -#endif - namespace shell { EmbedderSurfaceGL::EmbedderSurfaceGL(GLDispatchTable gl_dispatch_table, diff --git a/shell/platform/embedder/embedder_surface_gl.h b/shell/platform/embedder/embedder_surface_gl.h index 8fd40885ee3b6..949997b687ac4 100644 --- a/shell/platform/embedder/embedder_surface_gl.h +++ b/shell/platform/embedder/embedder_surface_gl.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/embedder/embedder_surface_software.cc b/shell/platform/embedder/embedder_surface_software.cc index 103257745b359..b07c62b03dd65 100644 --- a/shell/platform/embedder/embedder_surface_software.cc +++ b/shell/platform/embedder/embedder_surface_software.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,10 +7,6 @@ #include "flutter/fml/trace_event.h" #include "third_party/skia/include/gpu/GrContext.h" -#ifdef ERROR -#undef ERROR -#endif - namespace shell { EmbedderSurfaceSoftware::EmbedderSurfaceSoftware( diff --git a/shell/platform/embedder/embedder_surface_software.h b/shell/platform/embedder/embedder_surface_software.h index 852a77b62a2e4..6bc5d98f89247 100644 --- a/shell/platform/embedder/embedder_surface_software.h +++ b/shell/platform/embedder/embedder_surface_software.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/embedder/platform_view_embedder.cc b/shell/platform/embedder/platform_view_embedder.cc index 07f6c8dc1ff95..5a5551b751729 100644 --- a/shell/platform/embedder/platform_view_embedder.cc +++ b/shell/platform/embedder/platform_view_embedder.cc @@ -1,13 +1,9 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "flutter/shell/platform/embedder/platform_view_embedder.h" -#ifdef ERROR -#undef ERROR -#endif - namespace shell { PlatformViewEmbedder::PlatformViewEmbedder( diff --git a/shell/platform/embedder/platform_view_embedder.h b/shell/platform/embedder/platform_view_embedder.h index af28dd83625c6..bea840387e7e1 100644 --- a/shell/platform/embedder/platform_view_embedder.h +++ b/shell/platform/embedder/platform_view_embedder.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/platform/embedder/tests/embedder_unittests.cc b/shell/platform/embedder/tests/embedder_unittests.cc index ebf059f591e29..6cd3f4d330a65 100644 --- a/shell/platform/embedder/tests/embedder_unittests.cc +++ b/shell/platform/embedder/tests/embedder_unittests.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,19 +16,18 @@ TEST(EmbedderTest, MustNotRunWithInvalidArgs) { } TEST(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) { - FlutterOpenGLRendererConfig renderer = {}; - renderer.struct_size = sizeof(FlutterOpenGLRendererConfig); - renderer.make_current = [](void*) { return false; }; - renderer.clear_current = [](void*) { return false; }; - renderer.present = [](void*) { return false; }; - renderer.fbo_callback = [](void*) -> uint32_t { return 0; }; + FlutterSoftwareRendererConfig renderer; + renderer.struct_size = sizeof(FlutterSoftwareRendererConfig); + renderer.surface_present_callback = [](void*, const void*, size_t, size_t) { + return false; + }; std::string main = std::string(testing::GetFixturesPath()) + "/simple_main.dart"; FlutterRendererConfig config = {}; - config.type = FlutterRendererType::kOpenGL; - config.open_gl = renderer; + config.type = FlutterRendererType::kSoftware; + config.software = renderer; FlutterProjectArgs args = {}; args.struct_size = sizeof(FlutterProjectArgs); diff --git a/shell/platform/linux/BUILD.gn b/shell/platform/linux/BUILD.gn index ed185e4541532..03724a9e7354c 100644 --- a/shell/platform/linux/BUILD.gn +++ b/shell/platform/linux/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2018 The Flutter Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/shell/testing/BUILD.gn b/shell/testing/BUILD.gn index cc3d835c42e04..29b5c5c13e89a 100644 --- a/shell/testing/BUILD.gn +++ b/shell/testing/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/shell/testing/observatory/empty_main.dart b/shell/testing/observatory/empty_main.dart index 0d653a819f728..94e557c8cadc7 100644 --- a/shell/testing/observatory/empty_main.dart +++ b/shell/testing/observatory/empty_main.dart @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/testing/observatory/launcher.dart b/shell/testing/observatory/launcher.dart index 9a88555199538..82fdd108f3c74 100644 --- a/shell/testing/observatory/launcher.dart +++ b/shell/testing/observatory/launcher.dart @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/testing/observatory/service_client.dart b/shell/testing/observatory/service_client.dart index badcaf669102b..f24b628ddae78 100644 --- a/shell/testing/observatory/service_client.dart +++ b/shell/testing/observatory/service_client.dart @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/testing/observatory/test.dart b/shell/testing/observatory/test.dart index d753d1522c9b8..9d97dba0c9dd6 100644 --- a/shell/testing/observatory/test.dart +++ b/shell/testing/observatory/test.dart @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/testing/tester_main.cc b/shell/testing/tester_main.cc index 207e35301ff5d..7aa9dee3c0794 100644 --- a/shell/testing/tester_main.cc +++ b/shell/testing/tester_main.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,10 +21,6 @@ #include "flutter/shell/common/thread_host.h" #include "third_party/dart/runtime/include/bin/dart_io_api.h" -#ifdef ERROR -#undef ERROR -#endif - namespace shell { // Checks whether the engine's main Dart isolate has no pending work. If so, @@ -124,17 +120,30 @@ int RunTester(const blink::Settings& settings, bool run_forever) { return EXIT_FAILURE; } - if (settings.main_dart_file_path.empty()) { - FML_LOG(ERROR) << "Main dart file not specified."; + if (settings.application_kernel_asset.empty()) { + FML_LOG(ERROR) << "Dart kernel file not specified."; return EXIT_FAILURE; } + // Initialize default testing locales. There is no platform to + // pass locales on the tester, so to retain expected locale behavior, + // we emulate it in here by passing in 'en_US' and 'zh_CN' as test locales. + const char* locale_json = + "{\"method\":\"setLocale\",\"args\":[\"en\",\"US\",\"\",\"\",\"zh\"," + "\"CN\",\"\",\"\"]}"; + std::vector locale_bytes(locale_json, + locale_json + std::strlen(locale_json)); + fml::RefPtr response; + shell->GetPlatformView()->DispatchPlatformMessage( + fml::MakeRefCounted("flutter/localization", + locale_bytes, response)); + std::initializer_list protection = { fml::FileMapping::Protection::kRead}; auto main_dart_file_mapping = std::make_unique( fml::OpenFile( - fml::paths::AbsolutePath(settings.main_dart_file_path).c_str(), false, - fml::FilePermission::kRead), + fml::paths::AbsolutePath(settings.application_kernel_asset).c_str(), + false, fml::FilePermission::kRead), protection); auto isolate_configuration = @@ -145,7 +154,7 @@ int RunTester(const blink::Settings& settings, bool run_forever) { return EXIT_FAILURE; } - auto asset_manager = fml::MakeRefCounted(); + auto asset_manager = std::make_shared(); asset_manager->PushBack(std::make_unique( fml::Duplicate(settings.assets_dir))); asset_manager->PushBack( @@ -234,11 +243,11 @@ int main(int argc, char* argv[]) { if (command_line.positional_args().size() > 0) { // The tester may not use the switch for the main dart file path. Specifying // it as a positional argument instead. - settings.main_dart_file_path = command_line.positional_args()[0]; + settings.application_kernel_asset = command_line.positional_args()[0]; } - if (settings.main_dart_file_path.size() == 0) { - FML_LOG(ERROR) << "Main dart file path not specified."; + if (settings.application_kernel_asset.size() == 0) { + FML_LOG(ERROR) << "Dart kernel file not specified."; return EXIT_FAILURE; } diff --git a/shell/version/BUILD.gn b/shell/version/BUILD.gn index 348ea3e26d2a7..ca9ee7d1bf84e 100644 --- a/shell/version/BUILD.gn +++ b/shell/version/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2018 The Flutter Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/shell/version/version.cc b/shell/version/version.cc index 86525de620191..4fac6a1043c92 100644 --- a/shell/version/version.cc +++ b/shell/version/version.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/shell/version/version.gni b/shell/version/version.gni index 66ca9fdd8e10d..f06a89b8d555f 100644 --- a/shell/version/version.gni +++ b/shell/version/version.gni @@ -1,4 +1,4 @@ -# Copyright 2018 The Flutter Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/shell/version/version.h b/shell/version/version.h index 1c9ca4d1d7c34..ce2647e0bddb6 100644 --- a/shell/version/version.h +++ b/shell/version/version.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/sky/BUILD.gn b/sky/BUILD.gn index 66045451407b5..b950560f5a080 100644 --- a/sky/BUILD.gn +++ b/sky/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/sky/dist/BUILD.gn b/sky/dist/BUILD.gn index a7068e32ab65a..c1b564a03ecce 100644 --- a/sky/dist/BUILD.gn +++ b/sky/dist/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/sky/packages/BUILD.gn b/sky/packages/BUILD.gn index f9dd45cd921a1..07766e6a4695c 100644 --- a/sky/packages/BUILD.gn +++ b/sky/packages/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/sky/packages/flutter_services/BUILD.gn b/sky/packages/flutter_services/BUILD.gn index f326037901b3d..6ec4f4b2e4504 100644 --- a/sky/packages/flutter_services/BUILD.gn +++ b/sky/packages/flutter_services/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/sky/packages/flutter_services/lib/empty.dart b/sky/packages/flutter_services/lib/empty.dart index a3f12bfd1109e..396832c3347e1 100644 --- a/sky/packages/flutter_services/lib/empty.dart +++ b/sky/packages/flutter_services/lib/empty.dart @@ -1,4 +1,4 @@ -/// Copyright 2016 The Chromium Authors. All rights reserved. +/// Copyright 2013 The Flutter Authors. All rights reserved. /// Use of this source code is governed by a BSD-style license that can be /// found in the LICENSE file. diff --git a/sky/packages/sky_engine/BUILD.gn b/sky/packages/sky_engine/BUILD.gn index 3ea8c4f31b84e..9556957954b31 100644 --- a/sky/packages/sky_engine/BUILD.gn +++ b/sky/packages/sky_engine/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index e90b7a123752a..7334fbc6b9b0e 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -3440,314 +3440,6 @@ met: contributors may be used to endorse or promote products derived from this software without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -engine - -Copyright (c) 2013 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -engine - -Copyright 2013 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -engine - -Copyright 2017 The Flutter Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -engine - -Copyright 2018 The Flutter Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -engine -icu - -Copyright 2014 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -engine -icu -skia - -Copyright 2015 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -engine -icu -skia - -Copyright 2016 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -engine -skia - -Copyright 2018 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -engine -tonic - -Copyright 2016 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -engine -tonic - -Copyright 2017 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -3763,7 +3455,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. engine txt -Copyright 2017 The Chromium Authors. All rights reserved. +Copyright 2013 The Flutter Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -5996,7 +5688,128 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2011,2014 Google, Inc. +Copyright © 2011,2014 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2012 Mozilla Foundation. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2012,2013 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2012,2013 Mozilla Foundation. +Copyright © 2012,2013 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2012,2017 Google, Inc. This is part of HarfBuzz, a text shaping library. @@ -6020,7 +5833,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2012 Google, Inc. +Copyright © 2013 Google, Inc. This is part of HarfBuzz, a text shaping library. @@ -6044,7 +5857,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2012 Mozilla Foundation. +Copyright © 2013 Red Hat, Inc. This is part of HarfBuzz, a text shaping library. @@ -6068,7 +5881,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2012,2013 Google, Inc. +Copyright © 2014 Google, Inc. This is part of HarfBuzz, a text shaping library. @@ -6092,8 +5905,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2012,2013 Mozilla Foundation. -Copyright © 2012,2013 Google, Inc. +Copyright © 2015 Ebrahim Byagowi This is part of HarfBuzz, a text shaping library. @@ -6117,7 +5929,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2012,2017 Google, Inc. +Copyright © 2015 Google, Inc. This is part of HarfBuzz, a text shaping library. @@ -6141,7 +5953,8 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2013 Google, Inc. +Copyright © 2015 Mozilla Foundation. +Copyright © 2015 Google, Inc. This is part of HarfBuzz, a text shaping library. @@ -6165,7 +5978,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2013 Red Hat, Inc. +Copyright © 2015-2018 Ebrahim Byagowi This is part of HarfBuzz, a text shaping library. @@ -6189,7 +6002,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2014 Google, Inc. +Copyright © 2016 Google, Inc. This is part of HarfBuzz, a text shaping library. @@ -6213,7 +6026,8 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2015 Ebrahim Byagowi +Copyright © 2016 Google, Inc. +Copyright © 2018 Ebrahim Byagowi This is part of HarfBuzz, a text shaping library. @@ -6237,7 +6051,9 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2015 Google, Inc. +Copyright © 2016 Google, Inc. +Copyright © 2018 Khaled Hosny +Copyright © 2018 Ebrahim Byagowi This is part of HarfBuzz, a text shaping library. @@ -6261,8 +6077,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2015 Mozilla Foundation. -Copyright © 2015 Google, Inc. +Copyright © 2016 Igalia S.L. This is part of HarfBuzz, a text shaping library. @@ -6286,7 +6101,8 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2015-2018 Ebrahim Byagowi +Copyright © 2016 Elie Roux +Copyright © 2018 Google, Inc. This is part of HarfBuzz, a text shaping library. @@ -6310,7 +6126,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2016 Google, Inc. +Copyright © 2017 Google, Inc. This is part of HarfBuzz, a text shaping library. @@ -6334,8 +6150,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2016 Google, Inc. -Copyright © 2018 Ebrahim Byagowi +Copyright © 2017,2018 Google, Inc. This is part of HarfBuzz, a text shaping library. @@ -6359,7 +6174,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2016 Igalia S.L. +Copyright © 2018 Ebrahim Byagowi This is part of HarfBuzz, a text shaping library. @@ -6383,7 +6198,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2016 Elie Roux +Copyright © 2018 Ebrahim Byagowi Copyright © 2018 Google, Inc. This is part of HarfBuzz, a text shaping library. @@ -6408,7 +6223,8 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2017 Google, Inc. +Copyright © 2018 Ebrahim Byagowi +Copyright © 2018 Khaled Hosny This is part of HarfBuzz, a text shaping library. @@ -6432,7 +6248,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2018 Ebrahim Byagowi +Copyright © 2018 Ebrahim Byagowi. This is part of HarfBuzz, a text shaping library. @@ -6456,7 +6272,6 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2018 Ebrahim Byagowi Copyright © 2018 Google, Inc. This is part of HarfBuzz, a text shaping library. @@ -6481,7 +6296,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -------------------------------------------------------------------------------- harfbuzz -Copyright © 2018 Google, Inc. +Copyright © 2018 Adobe Systems Incorporated. This is part of HarfBuzz, a text shaping library. @@ -7054,6 +6869,36 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- icu +Copyright 2014 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +icu + Copyright © 1991-2018 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in http://www.unicode.org/copyright.html. @@ -7209,6 +7054,68 @@ shall not be used in advertising or otherwise to promote the sale, use or other dealings in these Data Files or Software without prior written authorization of the copyright holder. -------------------------------------------------------------------------------- +icu +skia + +Copyright 2015 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +icu +skia + +Copyright 2016 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- libjpeg-turbo Copyright (C) 1999-2006, MIYASAKA Masaru. @@ -9706,6 +9613,7 @@ skcms skia vulkan vulkanmemoryallocator +wuffs Copyright 2018 Google Inc. @@ -9866,36 +9774,6 @@ all copies or substantial portions of the Materials. -------------------------------------------------------------------------------- skia -Copyright (c) 2015 The Chromium Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -skia - Copyright 2005 The Android Open Source Project Redistribution and use in source and binary forms, with or without @@ -10859,6 +10737,36 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- skia +Copyright 2018 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + NEON optimized code (C) COPYRIGHT 2009 Motorola Redistribution and use in source and binary forms, with or without @@ -10981,6 +10889,66 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- tonic +Copyright 2016 The Fuchsia Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +tonic + +Copyright 2017 The Fuchsia Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +tonic + Copyright 2018 The Fuchsia Authors. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sky/packages/sky_services/BUILD.gn b/sky/packages/sky_services/BUILD.gn index 44132cc252183..582e57c319dc7 100644 --- a/sky/packages/sky_services/BUILD.gn +++ b/sky/packages/sky_services/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/sky/tools/change_install_name.py b/sky/tools/change_install_name.py index b6d479bc5c760..3d715c422ff43 100755 --- a/sky/tools/change_install_name.py +++ b/sky/tools/change_install_name.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/sky/tools/create_ios_framework.py b/sky/tools/create_ios_framework.py index 0500e671c21f6..f9dc2f7f56283 100755 --- a/sky/tools/create_ios_framework.py +++ b/sky/tools/create_ios_framework.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -60,7 +60,7 @@ def main(): linker_out = os.path.join(fat_framework, 'Flutter') - subprocess.call([ + subprocess.check_call([ 'lipo', arm64_dylib, armv7_dylib, @@ -72,14 +72,14 @@ def main(): if args.dsym: dsym_out = os.path.splitext(fat_framework)[0] + '.dSYM' - subprocess.call(['dsymutil', '-o', dsym_out, linker_out]) + subprocess.check_call(['dsymutil', '-o', dsym_out, linker_out]) if args.strip: # copy unstripped unstripped_out = os.path.join(args.dst, 'Flutter.unstripped') shutil.copyfile(linker_out, unstripped_out) - subprocess.call(["strip", "-x", "-S", linker_out]) + subprocess.check_call(["strip", "-x", "-S", linker_out]) if __name__ == '__main__': diff --git a/sky/tools/create_macos_gen_snapshot.py b/sky/tools/create_macos_gen_snapshot.py index b7597200a3b38..a9ea7f88378ec 100755 --- a/sky/tools/create_macos_gen_snapshot.py +++ b/sky/tools/create_macos_gen_snapshot.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2018 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -30,7 +30,7 @@ def main(): print 'Cannot find i386 (armv7) gen_snapshot at', armv7_gen_snapshot return 1 - subprocess.call([ + subprocess.check_call([ 'lipo', arm64_gen_snapshot, armv7_gen_snapshot, diff --git a/sky/tools/dist_dart_pkg.py b/sky/tools/dist_dart_pkg.py index 9a1318796eefd..af8bd1dbb201d 100644 --- a/sky/tools/dist_dart_pkg.py +++ b/sky/tools/dist_dart_pkg.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/sky/tools/flutter_gdb b/sky/tools/flutter_gdb index 73a10a5468744..1ba48e6f98633 100755 --- a/sky/tools/flutter_gdb +++ b/sky/tools/flutter_gdb @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/sky/tools/install_framework_headers.py b/sky/tools/install_framework_headers.py index f76ffcb16ab8f..a746ff90b0e7e 100644 --- a/sky/tools/install_framework_headers.py +++ b/sky/tools/install_framework_headers.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2017 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/sky/tools/roll/patch.py b/sky/tools/roll/patch.py index fbc2389e26c1a..f08b610e31601 100755 --- a/sky/tools/roll/patch.py +++ b/sky/tools/roll/patch.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2014 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/sky/tools/roll/roll.py b/sky/tools/roll/roll.py index 994685a42bb0f..c4d322cb9cebb 100755 --- a/sky/tools/roll/roll.py +++ b/sky/tools/roll/roll.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/sky/tools/roll/utils.py b/sky/tools/roll/utils.py index d2de2c487d148..c14732e34d12d 100755 --- a/sky/tools/roll/utils.py +++ b/sky/tools/roll/utils.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2014 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/synchronization/BUILD.gn b/synchronization/BUILD.gn index 258e49a182445..95b8655964b53 100644 --- a/synchronization/BUILD.gn +++ b/synchronization/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/synchronization/pipeline.cc b/synchronization/pipeline.cc index df8505dbee7a9..2baede8dfbd1f 100644 --- a/synchronization/pipeline.cc +++ b/synchronization/pipeline.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/synchronization/pipeline.h b/synchronization/pipeline.h index 726adf64de842..30740c36befe2 100644 --- a/synchronization/pipeline.h +++ b/synchronization/pipeline.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/synchronization/semaphore.cc b/synchronization/semaphore.cc index f3a6039b15f11..4d8e5003d5921 100644 --- a/synchronization/semaphore.cc +++ b/synchronization/semaphore.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/synchronization/semaphore.h b/synchronization/semaphore.h index e2df8b3d81ad8..594b0a559bc04 100644 --- a/synchronization/semaphore.h +++ b/synchronization/semaphore.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/synchronization/semaphore_unittest.cc b/synchronization/semaphore_unittest.cc index 42b898d53acb5..61810b641bee8 100644 --- a/synchronization/semaphore_unittest.cc +++ b/synchronization/semaphore_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/testing/BUILD.gn b/testing/BUILD.gn index 7d5b8be9ae018..424d978f81570 100644 --- a/testing/BUILD.gn +++ b/testing/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/testing/build/gen_fixtures_location_symbol.py b/testing/build/gen_fixtures_location_symbol.py index c2c49d087d7b4..3b66475d4afb8 100644 --- a/testing/build/gen_fixtures_location_symbol.py +++ b/testing/build/gen_fixtures_location_symbol.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2017 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/testing/dart/canvas_test.dart b/testing/dart/canvas_test.dart index 8ab5581317730..9d4704038e9f0 100644 --- a/testing/dart/canvas_test.dart +++ b/testing/dart/canvas_test.dart @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/testing/dart/codec_test.dart b/testing/dart/codec_test.dart index 0e2f71cd489c3..78b6930f5ea6c 100644 --- a/testing/dart/codec_test.dart +++ b/testing/dart/codec_test.dart @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -55,6 +55,29 @@ void main() { ])); }); + test('decodedCacheRatioCap', () async { + // No real way to test the native layer, but a smoke test here to at least + // verify that animation is still consistent with caching disabled. + Uint8List data = await _getSkiaResource('test640x479.gif').readAsBytes(); + ui.Codec codec = await ui.instantiateImageCodec(data, decodedCacheRatioCap: 1.0); + List> decodedFrameInfos = []; + for (int i = 0; i < 5; i++) { + ui.FrameInfo frameInfo = await codec.getNextFrame(); + decodedFrameInfos.add([ + frameInfo.duration.inMilliseconds, + frameInfo.image.width, + frameInfo.image.height, + ]); + } + expect(decodedFrameInfos, equals([ + [200, 640, 479], + [200, 640, 479], + [200, 640, 479], + [200, 640, 479], + [200, 640, 479], + ])); + }); + test('non animated image', () async { Uint8List data = await _getSkiaResource('baby_tux.png').readAsBytes(); ui.Codec codec = await ui.instantiateImageCodec(data); diff --git a/testing/dart/color_test.dart b/testing/dart/color_test.dart index 6bdccc7b72f6d..785c819aa7380 100644 --- a/testing/dart/color_test.dart +++ b/testing/dart/color_test.dart @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/testing/dart/encoding_test.dart b/testing/dart/encoding_test.dart index c8210d9b4e094..28bba46303e92 100644 --- a/testing/dart/encoding_test.dart +++ b/testing/dart/encoding_test.dart @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/testing/dart/geometry_test.dart b/testing/dart/geometry_test.dart index fc3ce17434233..4da3e6e825471 100644 --- a/testing/dart/geometry_test.dart +++ b/testing/dart/geometry_test.dart @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/testing/dart/gradient_test.dart b/testing/dart/gradient_test.dart index 881b70fec558d..b0160d019fd05 100644 --- a/testing/dart/gradient_test.dart +++ b/testing/dart/gradient_test.dart @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/testing/dart/isolate_name_server_test.dart b/testing/dart/isolate_name_server_test.dart index 37f6349d579a7..d48eefc084815 100644 --- a/testing/dart/isolate_name_server_test.dart +++ b/testing/dart/isolate_name_server_test.dart @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/testing/dart/locale_test.dart b/testing/dart/locale_test.dart index 60a7bf99fe2af..9fcab7334ac5d 100644 --- a/testing/dart/locale_test.dart +++ b/testing/dart/locale_test.dart @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,4 +19,30 @@ void main() { expect(const Locale('iw', 'DD').toString(), 'he_DE'); expect(const Locale('iw', 'DD'), const Locale('he', 'DE')); }); + + test('Locale.fromSubtags', () { + expect(const Locale.fromSubtags().languageCode, 'und'); + expect(const Locale.fromSubtags().scriptCode, null); + expect(const Locale.fromSubtags().countryCode, null); + + expect(const Locale.fromSubtags(languageCode: 'en').toString(), 'en'); + expect(const Locale.fromSubtags(languageCode: 'en').languageCode, 'en'); + expect(const Locale.fromSubtags(scriptCode: 'Latn').toString(), 'und_Latn'); + expect(const Locale.fromSubtags(scriptCode: 'Latn').scriptCode, 'Latn'); + expect(const Locale.fromSubtags(countryCode: 'US').toString(), 'und_US'); + expect(const Locale.fromSubtags(countryCode: 'US').countryCode, 'US'); + + expect(Locale.fromSubtags(languageCode: 'es', countryCode: '419').toString(), 'es_419'); + expect(Locale.fromSubtags(languageCode: 'es', countryCode: '419').languageCode, 'es'); + expect(Locale.fromSubtags(languageCode: 'es', countryCode: '419').countryCode, '419'); + + expect(Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans', countryCode: 'CN').toString(), 'zh_Hans_CN'); + }); + + test('Locale equality', () { + expect(Locale.fromSubtags(languageCode: 'en'), + isNot(Locale.fromSubtags(languageCode: 'en', scriptCode: 'Latn'))); + expect(Locale.fromSubtags(languageCode: 'en').hashCode, + isNot(Locale.fromSubtags(languageCode: 'en', scriptCode: 'Latn').hashCode)); + }); } diff --git a/testing/dart/paragraph_builder_test.dart b/testing/dart/paragraph_builder_test.dart index faee641315f69..0743825f8e29b 100644 --- a/testing/dart/paragraph_builder_test.dart +++ b/testing/dart/paragraph_builder_test.dart @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,13 +7,13 @@ import 'dart:ui'; import 'package:test/test.dart'; void main() { - test("Should be able to build and layout a paragraph", () { - ParagraphBuilder builder = new ParagraphBuilder(new ParagraphStyle()); + test('Should be able to build and layout a paragraph', () { + final ParagraphBuilder builder = ParagraphBuilder(ParagraphStyle()); builder.addText('Hello'); - Paragraph paragraph = builder.build(); + final Paragraph paragraph = builder.build(); expect(paragraph, isNotNull); - paragraph.layout(new ParagraphConstraints(width: 800.0)); + paragraph.layout(ParagraphConstraints(width: 800.0)); expect(paragraph.width, isNonZero); expect(paragraph.height, isNonZero); }); diff --git a/testing/dart/path_test.dart b/testing/dart/path_test.dart index 732f22304892b..1c569dd5ea286 100644 --- a/testing/dart/path_test.dart +++ b/testing/dart/path_test.dart @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/testing/dart/plugin_utilities_test.dart b/testing/dart/plugin_utilities_test.dart index 89f43824bc2dc..9d8849f40f4a7 100644 --- a/testing/dart/plugin_utilities_test.dart +++ b/testing/dart/plugin_utilities_test.dart @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/testing/dart/rect_test.dart b/testing/dart/rect_test.dart index c075826559714..ed352a1474491 100644 --- a/testing/dart/rect_test.dart +++ b/testing/dart/rect_test.dart @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/testing/dart/window_hooks_integration_test.dart b/testing/dart/window_hooks_integration_test.dart index ee4d6d6e16a84..446f5ac8ab6a5 100644 --- a/testing/dart/window_hooks_integration_test.dart +++ b/testing/dart/window_hooks_integration_test.dart @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -67,6 +67,12 @@ void main() { window.onTextScaleFactorChanged = originalOnTextScaleFactorChanged; }); + test('updateUserSettings can handle an empty object', () { + // this should now throw. + _updateUserSettingsData('{}'); + expect(true, equals(true)); + }); + test('onMetricsChanged preserves callback zone', () { Zone innerZone; Zone runZone; @@ -100,7 +106,7 @@ void main() { }; }); - _updateLocale('en', 'US'); + _updateLocales(['en', 'US', '', '']); expect(runZone, isNotNull); expect(runZone, same(innerZone)); expect(locale, equals(const Locale('en', 'US'))); diff --git a/testing/dart/window_test.dart b/testing/dart/window_test.dart index 5605355c0c390..110e9af4ec86f 100644 --- a/testing/dart/window_test.dart +++ b/testing/dart/window_test.dart @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/testing/fail_test.dart b/testing/fail_test.dart index 6c642710fe914..5d88caaaa5d47 100644 --- a/testing/fail_test.dart +++ b/testing/fail_test.dart @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/testing/run_all_unittests.cc b/testing/run_all_unittests.cc index d300edf026f17..1fa0019be22b4 100644 --- a/testing/run_all_unittests.cc +++ b/testing/run_all_unittests.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/testing/run_tests.sh b/testing/run_tests.sh index 69f5b9689d5c8..38fcaf7ba6ee0 100755 --- a/testing/run_tests.sh +++ b/testing/run_tests.sh @@ -1,28 +1,33 @@ #!/bin/bash -set -ex - -out/host_debug_unopt/fml_unittests +set -o pipefail -e; + +# TODO(dnfield): Re-enable this when the upstream Dart changes that make it not be flaky land. +# out/host_debug_unopt/embedder_unittests +out/host_debug_unopt/flow_unittests +out/host_debug_unopt/fml_unittests --gtest_filter="-*TimeSensitiveTest*" +out/host_debug_unopt/runtime_unittests +out/host_debug_unopt/shell_unittests out/host_debug_unopt/synchronization_unittests +out/host_debug_unopt/txt_unittests --font-directory=flutter/third_party/txt/third_party/fonts pushd flutter/testing/dart pub get popd -run_test () -{ +run_test () { out/host_debug_unopt/dart out/host_debug_unopt/gen/frontend_server.dart.snapshot --sdk-root out/host_debug_unopt/flutter_patched_sdk --incremental --strong --target=flutter --packages flutter/testing/dart/.packages --output-dill out/host_debug_unopt/engine_test.dill $1 - - out/host_debug_unopt/flutter_tester --disable-observatory out/host_debug_unopt/engine_test.dill + out/host_debug_unopt/flutter_tester --disable-observatory --use-test-fonts out/host_debug_unopt/engine_test.dill } # Verify that a failing test returns a failure code. ! run_test flutter/testing/fail_test.dart for TEST_SCRIPT in flutter/testing/dart/*.dart; do - run_test $TEST_SCRIPT + run_test $TEST_SCRIPT done pushd flutter ci/test.sh popd +exit 0 diff --git a/testing/testing.cc b/testing/testing.cc index 835ce4fe05684..93e135e7ab43d 100644 --- a/testing/testing.cc +++ b/testing/testing.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Fuchsia Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/testing/testing.gni b/testing/testing.gni index a58876c38df6c..ad5badfe922fe 100644 --- a/testing/testing.gni +++ b/testing/testing.gni @@ -1,4 +1,4 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/testing/testing.h b/testing/testing.h index 2377ce5114917..dac2d229b9169 100644 --- a/testing/testing.h +++ b/testing/testing.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/testing/thread_test.cc b/testing/thread_test.cc index 1f4c1462bf387..513dbfd1a7eef 100644 --- a/testing/thread_test.cc +++ b/testing/thread_test.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/testing/thread_test.h b/testing/thread_test.h index 131aa05273f54..8b4487c1b791f 100644 --- a/testing/thread_test.h +++ b/testing/thread_test.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/third_party/txt/BUILD.gn b/third_party/txt/BUILD.gn index b31467af544d3..a6a4bd82d170d 100644 --- a/third_party/txt/BUILD.gn +++ b/third_party/txt/BUILD.gn @@ -66,6 +66,7 @@ source_set("txt") { "src/minikin/WordBreaker.h", "src/txt/asset_font_manager.cc", "src/txt/asset_font_manager.h", + "src/txt/font_asset_provider.cc", "src/txt/font_asset_provider.h", "src/txt/font_collection.cc", "src/txt/font_collection.h", @@ -89,6 +90,8 @@ source_set("txt") { "src/txt/text_baseline.h", "src/txt/text_decoration.cc", "src/txt/text_decoration.h", + "src/txt/text_shadow.cc", + "src/txt/text_shadow.h", "src/txt/text_style.cc", "src/txt/text_style.h", "src/txt/typeface_font_asset_provider.cc", @@ -110,7 +113,7 @@ source_set("txt") { ] deps = [ - "//third_party/skia:effects", + "//third_party/skia", ] if (is_mac || is_ios) { diff --git a/third_party/txt/benchmarks/paint_record_benchmarks.cc b/third_party/txt/benchmarks/paint_record_benchmarks.cc index 29bbaa94b10bf..1b6cf98d48cdf 100644 --- a/third_party/txt/benchmarks/paint_record_benchmarks.cc +++ b/third_party/txt/benchmarks/paint_record_benchmarks.cc @@ -39,7 +39,7 @@ static void BM_PaintRecordInit(benchmark::State& state) { auto text_blob = builder.make(); while (state.KeepRunning()) { - PaintRecord PaintRecord(style, text_blob, SkPaint::FontMetrics(), 0, 0); + PaintRecord PaintRecord(style, text_blob, SkFontMetrics(), 0, 0); } } BENCHMARK(BM_PaintRecordInit); diff --git a/third_party/txt/src/minikin/FontCollection.cpp b/third_party/txt/src/minikin/FontCollection.cpp index a9dcc66b522e3..ff07778cb88c5 100644 --- a/third_party/txt/src/minikin/FontCollection.cpp +++ b/third_party/txt/src/minikin/FontCollection.cpp @@ -23,6 +23,7 @@ #include #include "unicode/unistr.h" #include "unicode/unorm2.h" +#include "unicode/utf16.h" #include #include diff --git a/third_party/txt/src/minikin/GraphemeBreak.h b/third_party/txt/src/minikin/GraphemeBreak.h index 233ec15c76766..62b9d59aa9344 100644 --- a/third_party/txt/src/minikin/GraphemeBreak.h +++ b/third_party/txt/src/minikin/GraphemeBreak.h @@ -17,6 +17,9 @@ #ifndef MINIKIN_GRAPHEME_BREAK_H #define MINIKIN_GRAPHEME_BREAK_H +#include +#include + namespace minikin { class GraphemeBreak { diff --git a/third_party/txt/src/minikin/Layout.cpp b/third_party/txt/src/minikin/Layout.cpp index 4339fcb02a920..436c59b9f9df3 100644 --- a/third_party/txt/src/minikin/Layout.cpp +++ b/third_party/txt/src/minikin/Layout.cpp @@ -170,20 +170,10 @@ class LayoutCache : private android::OnEntryRemoved { static const size_t kMaxEntries = 5000; }; -static unsigned int disabledDecomposeCompatibility(hb_unicode_funcs_t*, - hb_codepoint_t, - hb_codepoint_t*, - void*) { - return 0; -} - class LayoutEngine { public: LayoutEngine() { unicodeFunctions = hb_unicode_funcs_create(hb_icu_get_unicode_funcs()); - /* Disable the function used for compatibility decomposition */ - hb_unicode_funcs_set_decompose_compatibility_func( - unicodeFunctions, disabledDecomposeCompatibility, NULL, NULL); hbBuffer = hb_buffer_create(); hb_buffer_set_unicode_funcs(hbBuffer, unicodeFunctions); } diff --git a/third_party/txt/src/txt/asset_font_manager.h b/third_party/txt/src/txt/asset_font_manager.h index 9beb7b25ed866..715d81835edea 100644 --- a/third_party/txt/src/txt/asset_font_manager.h +++ b/third_party/txt/src/txt/asset_font_manager.h @@ -22,6 +22,7 @@ #include "third_party/skia/include/core/SkFontMgr.h" #include "third_party/skia/include/core/SkStream.h" #include "txt/font_asset_provider.h" +#include "txt/typeface_font_asset_provider.h" namespace txt { @@ -35,9 +36,9 @@ class AssetFontManager : public SkFontMgr { // |SkFontMgr| SkFontStyleSet* onMatchFamily(const char familyName[]) const override; - private: std::unique_ptr font_provider_; + private: // |SkFontMgr| int onCountFamilies() const override; @@ -84,6 +85,16 @@ class AssetFontManager : public SkFontMgr { FML_DISALLOW_COPY_AND_ASSIGN(AssetFontManager); }; +class DynamicFontManager : public AssetFontManager { + public: + DynamicFontManager() + : AssetFontManager(std::make_unique()) {} + + TypefaceFontAssetProvider& font_provider() { + return static_cast(*font_provider_); + } +}; + } // namespace txt #endif // TXT_ASSET_FONT_MANAGER_H_ diff --git a/third_party/txt/src/txt/font_asset_provider.cc b/third_party/txt/src/txt/font_asset_provider.cc new file mode 100644 index 0000000000000..a840b2e5f4908 --- /dev/null +++ b/third_party/txt/src/txt/font_asset_provider.cc @@ -0,0 +1,36 @@ +/* + * Copyright 2018 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#include "txt/font_asset_provider.h" + +namespace txt { + +// Return a canonicalized version of a family name that is suitable for +// matching. +std::string FontAssetProvider::CanonicalFamilyName(std::string family_name) { + std::string result(family_name.length(), 0); + + // Convert ASCII characters to lower case. + std::transform(family_name.begin(), family_name.end(), result.begin(), + [](char c) { return (c & 0x80) ? c : ::tolower(c); }); + + return result; +} + +} // namespace txt diff --git a/third_party/txt/src/txt/font_asset_provider.h b/third_party/txt/src/txt/font_asset_provider.h index 766064674db23..cbecbeaf004cc 100644 --- a/third_party/txt/src/txt/font_asset_provider.h +++ b/third_party/txt/src/txt/font_asset_provider.h @@ -28,6 +28,9 @@ class FontAssetProvider { virtual size_t GetFamilyCount() const = 0; virtual std::string GetFamilyName(int index) const = 0; virtual SkFontStyleSet* MatchFamily(const std::string& family_name) = 0; + + protected: + static std::string CanonicalFamilyName(std::string family_name); }; } // namespace txt diff --git a/third_party/txt/src/txt/font_collection.cc b/third_party/txt/src/txt/font_collection.cc index a54de304aa564..5503e54e03ff2 100644 --- a/third_party/txt/src/txt/font_collection.cc +++ b/third_party/txt/src/txt/font_collection.cc @@ -84,6 +84,10 @@ void FontCollection::SetAssetFontManager(sk_sp font_manager) { asset_font_manager_ = font_manager; } +void FontCollection::SetDynamicFontManager(sk_sp font_manager) { + dynamic_font_manager_ = font_manager; +} + void FontCollection::SetTestFontManager(sk_sp font_manager) { test_font_manager_ = font_manager; } @@ -93,6 +97,8 @@ std::vector> FontCollection::GetFontManagerOrder() const { std::vector> order; if (test_font_manager_) order.push_back(test_font_manager_); + if (dynamic_font_manager_) + order.push_back(dynamic_font_manager_); if (asset_font_manager_) order.push_back(asset_font_manager_); if (default_font_manager_) @@ -126,8 +132,12 @@ FontCollection::GetMinikinFontCollectionForFamily( minikin_family, }; if (enable_font_fallback_) { - for (std::string fallback_family : fallback_fonts_for_locale_[locale]) - minikin_families.push_back(fallback_fonts_[fallback_family]); + for (std::string fallback_family : fallback_fonts_for_locale_[locale]) { + auto it = fallback_fonts_.find(fallback_family); + if (it != fallback_fonts_.end()) { + minikin_families.push_back(it->second); + } + } } // Create the minikin font collection. diff --git a/third_party/txt/src/txt/font_collection.h b/third_party/txt/src/txt/font_collection.h index ae723eb20dcbc..d512a6dd3ae26 100644 --- a/third_party/txt/src/txt/font_collection.h +++ b/third_party/txt/src/txt/font_collection.h @@ -42,6 +42,7 @@ class FontCollection : public std::enable_shared_from_this { void SetDefaultFontManager(sk_sp font_manager); void SetAssetFontManager(sk_sp font_manager); + void SetDynamicFontManager(sk_sp font_manager); void SetTestFontManager(sk_sp font_manager); std::shared_ptr GetMinikinFontCollectionForFamily( @@ -73,6 +74,7 @@ class FontCollection : public std::enable_shared_from_this { sk_sp default_font_manager_; sk_sp asset_font_manager_; + sk_sp dynamic_font_manager_; sk_sp test_font_manager_; std::unordered_map, diff --git a/third_party/txt/src/txt/paint_record.cc b/third_party/txt/src/txt/paint_record.cc index f37429499ce71..200c48665aa81 100644 --- a/third_party/txt/src/txt/paint_record.cc +++ b/third_party/txt/src/txt/paint_record.cc @@ -24,7 +24,7 @@ PaintRecord::~PaintRecord() = default; PaintRecord::PaintRecord(TextStyle style, SkPoint offset, sk_sp text, - SkPaint::FontMetrics metrics, + SkFontMetrics metrics, size_t line, double run_width) : style_(style), @@ -36,7 +36,7 @@ PaintRecord::PaintRecord(TextStyle style, PaintRecord::PaintRecord(TextStyle style, sk_sp text, - SkPaint::FontMetrics metrics, + SkFontMetrics metrics, size_t line, double run_width) : style_(style), diff --git a/third_party/txt/src/txt/paint_record.h b/third_party/txt/src/txt/paint_record.h index 2b9248ef7c169..d78cd621ae542 100644 --- a/third_party/txt/src/txt/paint_record.h +++ b/third_party/txt/src/txt/paint_record.h @@ -37,13 +37,13 @@ class PaintRecord { PaintRecord(TextStyle style, SkPoint offset, sk_sp text, - SkPaint::FontMetrics metrics, + SkFontMetrics metrics, size_t line, double run_width); PaintRecord(TextStyle style, sk_sp text, - SkPaint::FontMetrics metrics, + SkFontMetrics metrics, size_t line, double run_width); @@ -57,7 +57,7 @@ class PaintRecord { SkTextBlob* text() const { return text_.get(); } - const SkPaint::FontMetrics& metrics() const { return metrics_; } + const SkFontMetrics& metrics() const { return metrics_; } const TextStyle& style() const { return style_; } @@ -72,7 +72,7 @@ class PaintRecord { // SkTextBlob stores the glyphs and coordinates to draw them. sk_sp text_; // FontMetrics stores the measurements of the font used. - SkPaint::FontMetrics metrics_; + SkFontMetrics metrics_; size_t line_; double run_width_ = 0.0f; diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index fc32fcc4b86eb..dd1c7e6718f1c 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -34,8 +34,11 @@ #include "minikin/LayoutUtils.h" #include "minikin/LineBreaker.h" #include "minikin/MinikinFont.h" -#include "third_party/icu/source/common/unicode/ubidi.h" +#include "unicode/ubidi.h" +#include "unicode/utf16.h" + #include "third_party/skia/include/core/SkCanvas.h" +#include "third_party/skia/include/core/SkMaskFilter.h" #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkTextBlob.h" #include "third_party/skia/include/core/SkTypeface.h" @@ -202,7 +205,7 @@ Paragraph::CodeUnitRun::CodeUnitRun(std::vector&& p, Range cu, Range x, size_t line, - const SkPaint::FontMetrics& metrics, + const SkFontMetrics& metrics, TextDirection dir) : positions(std::move(p)), code_units(cu), @@ -436,13 +439,18 @@ void Paragraph::Layout(double width, bool force) { paint.setAntiAlias(true); paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); paint.setSubpixelText(true); - paint.setHinting(SkPaint::kSlight_Hinting); + paint.setHinting(kSlight_SkFontHinting); records_.clear(); line_heights_.clear(); line_baselines_.clear(); glyph_lines_.clear(); code_unit_runs_.clear(); + line_max_spacings_.clear(); + line_max_descent_.clear(); + line_max_ascent_.clear(); + max_right_ = FLT_MIN; + min_left_ = FLT_MAX; minikin::Layout layout; SkTextBlobBuilder builder; @@ -674,12 +682,11 @@ void Paragraph::Layout(double width, bool force) { word_start_position = std::numeric_limits::quiet_NaN(); } } - } + } // for each in glyph_blob if (glyph_positions.empty()) continue; - - SkPaint::FontMetrics metrics; + SkFontMetrics metrics; paint.getFontMetrics(&metrics); paint_records.emplace_back(run.style(), SkPoint::Make(run_x_offset, 0), builder.make(), metrics, line_number, @@ -701,10 +708,13 @@ void Paragraph::Layout(double width, bool force) { Range(glyph_positions.front().x_pos.start, glyph_positions.back().x_pos.end), line_number, metrics, run.direction()); - } + + min_left_ = std::min(min_left_, glyph_positions.front().x_pos.start); + max_right_ = std::max(max_right_, glyph_positions.back().x_pos.end); + } // for each in glyph_blobs run_x_offset += layout.getAdvance(); - } + } // for each in line_runs // Adjust the glyph positions based on the alignment of the line. double line_x_offset = GetLineXOffset(run_x_offset); @@ -727,8 +737,12 @@ void Paragraph::Layout(double width, bool force) { double max_line_spacing = 0; double max_descent = 0; - auto update_line_metrics = [&](const SkPaint::FontMetrics& metrics, + SkScalar max_unscaled_ascent = 0; + auto update_line_metrics = [&](const SkFontMetrics& metrics, const TextStyle& style) { + // TODO(garyq): Multipling in the style.height on the first line is + // probably wrong. Figure out how paragraph and line heights are supposed + // to work and fix it. double line_spacing = (line_number == 0) ? -metrics.fAscent * style.height @@ -737,15 +751,16 @@ void Paragraph::Layout(double width, bool force) { max_line_spacing = line_spacing; if (line_number == 0) { alphabetic_baseline_ = line_spacing; - // TODO(garyq): Properly implement ideographic_baseline_. ideographic_baseline_ = - (metrics.fUnderlinePosition - metrics.fAscent) * style.height; + (metrics.fDescent - metrics.fAscent) * style.height; } } max_line_spacing = std::max(line_spacing, max_line_spacing); double descent = metrics.fDescent * style.height; max_descent = std::max(descent, max_descent); + + max_unscaled_ascent = std::max(-metrics.fAscent, max_unscaled_ascent); }; for (const PaintRecord& paint_record : paint_records) { update_line_metrics(paint_record.metrics(), paint_record.style()); @@ -753,7 +768,7 @@ void Paragraph::Layout(double width, bool force) { // If no fonts were actually rendered, then compute a baseline based on the // font of the paragraph style. if (paint_records.empty()) { - SkPaint::FontMetrics metrics; + SkFontMetrics metrics; TextStyle style(paragraph_style_.GetTextStyle()); paint.setTypeface(GetDefaultSkiaTypeface(style)); paint.setTextSize(style.font_size); @@ -761,18 +776,26 @@ void Paragraph::Layout(double width, bool force) { update_line_metrics(metrics, style); } + // TODO(garyq): Remove rounding of line heights because it is irrelevant in + // a world of high DPI devices. line_heights_.push_back((line_heights_.empty() ? 0 : line_heights_.back()) + round(max_line_spacing + max_descent)); line_baselines_.push_back(line_heights_.back() - max_descent); y_offset += round(max_line_spacing + prev_max_descent); prev_max_descent = max_descent; + // The max line spacing and ascent have been multiplied by -1 to make math + // in GetRectsForRange more logical/readable. + line_max_spacings_.push_back(max_line_spacing); + line_max_descent_.push_back(max_descent); + line_max_ascent_.push_back(max_unscaled_ascent); + for (PaintRecord& paint_record : paint_records) { paint_record.SetOffset( SkPoint::Make(paint_record.offset().x() + line_x_offset, y_offset)); records_.emplace_back(std::move(paint_record)); } - } + } // for each line_number if (paragraph_style_.max_lines == 1 || (paragraph_style_.unlimited_lines() && paragraph_style_.ellipsized())) { @@ -888,6 +911,7 @@ void Paragraph::Paint(SkCanvas* canvas, double x, double y) { } SkPoint offset = base_offset + record.offset(); PaintBackground(canvas, record, base_offset); + PaintShadow(canvas, record, offset); canvas->drawTextBlob(record.text(), offset.x(), offset.y(), paint); PaintDecorations(canvas, record, base_offset); } @@ -899,7 +923,7 @@ void Paragraph::PaintDecorations(SkCanvas* canvas, if (record.style().decoration == TextDecoration::kNone) return; - const SkPaint::FontMetrics& metrics = record.metrics(); + const SkFontMetrics& metrics = record.metrics(); SkPaint paint; paint.setStyle(SkPaint::kStroke_Style); if (record.style().decoration_color == SK_ColorTRANSPARENT) { @@ -924,8 +948,8 @@ void Paragraph::PaintDecorations(SkCanvas* canvas, } SkScalar underline_thickness; - if ((metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags:: - kUnderlineThicknessIsValid_Flag) && + if ((metrics.fFlags & + SkFontMetrics::FontMetricsFlags::kUnderlineThicknessIsValid_Flag) && metrics.fUnderlineThickness > 0) { underline_thickness = metrics.fUnderlineThickness; } else { @@ -1000,10 +1024,11 @@ void Paragraph::PaintDecorations(SkCanvas* canvas, double y_offset_original = y_offset; // Underline if (record.style().decoration & TextDecoration::kUnderline) { - y_offset += (metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags:: - kUnderlinePositionIsValid_Flag) - ? metrics.fUnderlinePosition - : underline_thickness; + y_offset += + (metrics.fFlags & + SkFontMetrics::FontMetricsFlags::kUnderlinePositionIsValid_Flag) + ? metrics.fUnderlinePosition + : underline_thickness; if (record.style().decoration_style != TextDecorationStyle::kWavy) { canvas->drawLine(x, y + y_offset, x + width, y + y_offset, paint); } else { @@ -1029,19 +1054,20 @@ void Paragraph::PaintDecorations(SkCanvas* canvas, } // Strikethrough if (record.style().decoration & TextDecoration::kLineThrough) { - if (metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags:: - kStrikeoutThicknessIsValid_Flag) + if (metrics.fFlags & + SkFontMetrics::FontMetricsFlags::kStrikeoutThicknessIsValid_Flag) paint.setStrokeWidth(metrics.fStrikeoutThickness * record.style().decoration_thickness_multiplier); // Make sure the double line is "centered" vertically. y_offset += (decoration_count - 1.0) * underline_thickness * kDoubleDecorationSpacing / -2.0; - y_offset += (metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags:: - kStrikeoutThicknessIsValid_Flag) - ? metrics.fStrikeoutPosition - // Backup value if the strikeoutposition metric is not - // available: - : metrics.fXHeight / -2.0; + y_offset += + (metrics.fFlags & + SkFontMetrics::FontMetricsFlags::kStrikeoutThicknessIsValid_Flag) + ? metrics.fStrikeoutPosition + // Backup value if the strikeoutposition metric is not + // available: + : metrics.fXHeight / -2.0; if (record.style().decoration_style != TextDecorationStyle::kWavy) { canvas->drawLine(x, y + y_offset, x + width, y + y_offset, paint); } else { @@ -1060,18 +1086,61 @@ void Paragraph::PaintBackground(SkCanvas* canvas, if (!record.style().has_background) return; - const SkPaint::FontMetrics& metrics = record.metrics(); + const SkFontMetrics& metrics = record.metrics(); SkRect rect(SkRect::MakeLTRB(0, metrics.fAscent, record.GetRunWidth(), metrics.fDescent)); rect.offset(base_offset + record.offset()); canvas->drawRect(rect, record.style().background); } -std::vector Paragraph::GetRectsForRange(size_t start, - size_t end) const { - std::map> line_boxes; +void Paragraph::PaintShadow(SkCanvas* canvas, + const PaintRecord& record, + SkPoint offset) { + if (record.style().text_shadows.size() == 0) + return; + for (TextShadow text_shadow : record.style().text_shadows) { + if (!text_shadow.hasShadow()) { + continue; + } + + SkPaint paint; + paint.setColor(text_shadow.color); + if (text_shadow.blur_radius != 0.0) { + paint.setMaskFilter(SkMaskFilter::MakeBlur( + kNormal_SkBlurStyle, text_shadow.blur_radius, false)); + } + canvas->drawTextBlob(record.text(), offset.x() + text_shadow.offset.x(), + offset.y() + text_shadow.offset.y(), paint); + } +} +std::vector Paragraph::GetRectsForRange( + size_t start, + size_t end, + RectHeightStyle rect_height_style, + RectWidthStyle rect_width_style) const { + // Struct that holds calculated metrics for each line. + struct LineBoxMetrics { + std::vector boxes; + // Per-line metrics for max and min coordinates for left and right boxes. + // These metrics cannot be calculated in layout generically because of + // selections that do not cover the whole line. + SkScalar max_right = FLT_MIN; + SkScalar min_left = FLT_MAX; + }; + + std::map line_metrics; + // Text direction of the first line so we can extend the correct side for + // RectWidthStyle::kMax. + TextDirection first_line_dir = TextDirection::ltr; + + // Lines that are actually in the requested range. + size_t max_line = 0; + size_t min_line = INT_MAX; + + // Generate initial boxes and calculate metrics. for (const CodeUnitRun& run : code_unit_runs_) { + // Check to see if we are finished. if (run.code_units.start >= end) break; if (run.code_units.end <= start) @@ -1081,6 +1150,10 @@ std::vector Paragraph::GetRectsForRange(size_t start, SkScalar top = baseline + run.font_metrics.fAscent; SkScalar bottom = baseline + run.font_metrics.fDescent; + max_line = std::max(run.line_number, max_line); + min_line = std::min(run.line_number, min_line); + + // Calculate left and right. SkScalar left, right; if (run.code_units.start >= start && run.code_units.end <= end) { left = run.x_pos.start; @@ -1097,11 +1170,23 @@ std::vector Paragraph::GetRectsForRange(size_t start, if (left == SK_ScalarMax || right == SK_ScalarMin) continue; } - line_boxes[run.line_number].emplace_back( + // Keep track of the min and max horizontal coordinates over all lines. Not + // needed for kTight. + if (rect_width_style == RectWidthStyle::kMax) { + line_metrics[run.line_number].max_right = + std::max(line_metrics[run.line_number].max_right, right); + line_metrics[run.line_number].min_left = + std::min(line_metrics[run.line_number].min_left, left); + if (min_line == run.line_number) { + first_line_dir = run.direction; + } + } + line_metrics[run.line_number].boxes.emplace_back( SkRect::MakeLTRB(left, top, right, bottom), run.direction); } - // Add empty rectangles representing any newline characters within the range. + // Add empty rectangles representing any newline characters within the + // range. for (size_t line_number = 0; line_number < line_ranges_.size(); ++line_number) { const LineRange& line = line_ranges_[line_number]; @@ -1109,21 +1194,108 @@ std::vector Paragraph::GetRectsForRange(size_t start, break; if (line.end_including_newline <= start) continue; - if (line_boxes.find(line_number) == line_boxes.end()) { + if (line_metrics.find(line_number) == line_metrics.end()) { if (line.end != line.end_including_newline && line.end >= start && line.end_including_newline <= end) { SkScalar x = line_widths_[line_number]; SkScalar top = (line_number > 0) ? line_heights_[line_number - 1] : 0; SkScalar bottom = line_heights_[line_number]; - line_boxes[line_number].emplace_back( + line_metrics[line_number].boxes.emplace_back( SkRect::MakeLTRB(x, top, x, bottom), TextDirection::ltr); } } } + // "Post-process" metrics and aggregate final rects to return. std::vector boxes; - for (const auto& kv : line_boxes) { - boxes.insert(boxes.end(), kv.second.begin(), kv.second.end()); + for (const auto& kv : line_metrics) { + // Handle rect_width_styles. We skip the last line because not everything is + // selected. + if (rect_width_style == RectWidthStyle::kMax && kv.first != max_line) { + if (line_metrics[kv.first].min_left > min_left_ && + (kv.first != min_line || first_line_dir == TextDirection::rtl)) { + line_metrics[kv.first].boxes.emplace_back( + SkRect::MakeLTRB( + min_left_, + line_baselines_[kv.first] - line_max_ascent_[kv.first], + line_metrics[kv.first].min_left, + line_baselines_[kv.first] + line_max_descent_[kv.first]), + TextDirection::rtl); + } + if (line_metrics[kv.first].max_right < max_right_ && + (kv.first != min_line || first_line_dir == TextDirection::ltr)) { + line_metrics[kv.first].boxes.emplace_back( + SkRect::MakeLTRB( + line_metrics[kv.first].max_right, + line_baselines_[kv.first] - line_max_ascent_[kv.first], + max_right_, + line_baselines_[kv.first] + line_max_descent_[kv.first]), + TextDirection::ltr); + } + } + + // Handle rect_height_styles. The height metrics used are all positive to + // make the signage clear here. + if (rect_height_style == RectHeightStyle::kTight) { + // Ignore line max height and width and generate tight bounds. + boxes.insert(boxes.end(), kv.second.boxes.begin(), kv.second.boxes.end()); + } else if (rect_height_style == RectHeightStyle::kMax) { + for (const Paragraph::TextBox& box : kv.second.boxes) { + boxes.emplace_back( + SkRect::MakeLTRB( + box.rect.fLeft, + line_baselines_[kv.first] - line_max_ascent_[kv.first], + box.rect.fRight, + line_baselines_[kv.first] + line_max_descent_[kv.first]), + box.direction); + } + } else if (rect_height_style == + RectHeightStyle::kIncludeLineSpacingMiddle) { + SkScalar adjusted_bottom = + line_baselines_[kv.first] + line_max_descent_[kv.first]; + if (kv.first < line_ranges_.size() - 1) { + adjusted_bottom += (line_max_spacings_[kv.first + 1] - + line_max_ascent_[kv.first + 1]) / + 2; + } + SkScalar adjusted_top = + line_baselines_[kv.first] - line_max_ascent_[kv.first]; + if (kv.first != 0) { + adjusted_top -= + (line_max_spacings_[kv.first] - line_max_ascent_[kv.first]) / 2; + } + for (const Paragraph::TextBox& box : kv.second.boxes) { + boxes.emplace_back(SkRect::MakeLTRB(box.rect.fLeft, adjusted_top, + box.rect.fRight, adjusted_bottom), + box.direction); + } + } else if (rect_height_style == RectHeightStyle::kIncludeLineSpacingTop) { + for (const Paragraph::TextBox& box : kv.second.boxes) { + SkScalar adjusted_top = + kv.first == 0 + ? line_baselines_[kv.first] - line_max_ascent_[kv.first] + : line_baselines_[kv.first] - line_max_spacings_[kv.first]; + boxes.emplace_back( + SkRect::MakeLTRB( + box.rect.fLeft, adjusted_top, box.rect.fRight, + line_baselines_[kv.first] + line_max_descent_[kv.first]), + box.direction); + } + } else { // kIncludeLineSpacingBottom + for (const Paragraph::TextBox& box : kv.second.boxes) { + SkScalar adjusted_bottom = + line_baselines_[kv.first] + line_max_descent_[kv.first]; + if (kv.first < line_ranges_.size() - 1) { + adjusted_bottom += + -line_max_ascent_[kv.first] + line_max_spacings_[kv.first]; + } + boxes.emplace_back(SkRect::MakeLTRB(box.rect.fLeft, + line_baselines_[kv.first] - + line_max_ascent_[kv.first], + box.rect.fRight, adjusted_bottom), + box.direction); + } + } } return boxes; } diff --git a/third_party/txt/src/txt/paragraph.h b/third_party/txt/src/txt/paragraph.h index 2cadfbb862229..850bd1b5b499b 100644 --- a/third_party/txt/src/txt/paragraph.h +++ b/third_party/txt/src/txt/paragraph.h @@ -55,6 +55,42 @@ class Paragraph { enum Affinity { UPSTREAM, DOWNSTREAM }; + // TODO(garyq): Implement kIncludeLineSpacing and kExtendEndOfLine + + // Options for various types of bounding boxes provided by + // GetRectsForRange(...). + enum class RectHeightStyle { + // Provide tight bounding boxes that fit heights per run. + kTight, + + // The height of the boxes will be the maximum height of all runs in the + // line. All rects in the same line will be the same height. + kMax, + + // Extends the top and/or bottom edge of the bounds to fully cover any line + // spacing. The top edge of each line should be the same as the bottom edge + // of the line above. There should be no gaps in vertical coverage given any + // ParagraphStyle line_height. + // + // The top and bottom of each rect will cover half of the + // space above and half of the space below the line. + kIncludeLineSpacingMiddle, + // The line spacing will be added to the top of the rect. + kIncludeLineSpacingTop, + // The line spacing will be added to the bottom of the rect. + kIncludeLineSpacingBottom + }; + + enum class RectWidthStyle { + // Provide tight bounding boxes that fit widths to the runs of each line + // independently. + kTight, + + // Extends the width of the last rect of each line to match the position of + // the widest rect over all the lines. + kMax + }; + struct PositionWithAffinity { const size_t position; const Affinity affinity; @@ -137,7 +173,10 @@ class Paragraph { // Returns a vector of bounding boxes that enclose all text between start and // end glyph indexes, including start and excluding end. - std::vector GetRectsForRange(size_t start, size_t end) const; + std::vector GetRectsForRange(size_t start, + size_t end, + RectHeightStyle rect_height_style, + RectWidthStyle rect_width_style) const; // Returns the index of the glyph that corresponds to the provided coordinate, // with the top left corner as the origin, and +y direction as down. @@ -185,6 +224,8 @@ class Paragraph { FRIEND_TEST(ParagraphTest, RepeatLayoutParagraph); FRIEND_TEST(ParagraphTest, Ellipsize); FRIEND_TEST(ParagraphTest, UnderlineShiftParagraph); + FRIEND_TEST(ParagraphTest, SimpleShadow); + FRIEND_TEST(ParagraphTest, ComplexShadow); // Starting data to layout. std::vector text_; @@ -217,6 +258,15 @@ class Paragraph { std::vector line_baselines_; bool did_exceed_max_lines_; + // Metrics for use in GetRectsForRange(...); + // Per-line max metrics over all runs in a given line. + std::vector line_max_spacings_; + std::vector line_max_descent_; + std::vector line_max_ascent_; + // Overall left and right extremes over all lines. + double max_right_; + double min_left_; + class BidiRun { public: BidiRun(size_t s, size_t e, TextDirection d, const TextStyle& st) @@ -260,14 +310,14 @@ class Paragraph { Range code_units; Range x_pos; size_t line_number; - SkPaint::FontMetrics font_metrics; + SkFontMetrics font_metrics; TextDirection direction; CodeUnitRun(std::vector&& p, Range cu, Range x, size_t line, - const SkPaint::FontMetrics& metrics, + const SkFontMetrics& metrics, TextDirection dir); void Shift(double delta); @@ -328,6 +378,9 @@ class Paragraph { const PaintRecord& record, SkPoint base_offset); + // Draws the shadows onto the canvas. + void PaintShadow(SkCanvas* canvas, const PaintRecord& record, SkPoint offset); + // Obtain a Minikin font collection matching this text style. std::shared_ptr GetMinikinFontCollectionForStyle( const TextStyle& style); diff --git a/third_party/txt/src/txt/platform.cc b/third_party/txt/src/txt/platform.cc index b6a2154ddf136..411e96f0f4b9c 100644 --- a/third_party/txt/src/txt/platform.cc +++ b/third_party/txt/src/txt/platform.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/third_party/txt/src/txt/platform.h b/third_party/txt/src/txt/platform.h index ed293c1967821..d45be43b0392a 100644 --- a/third_party/txt/src/txt/platform.h +++ b/third_party/txt/src/txt/platform.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/third_party/txt/src/txt/platform_android.cc b/third_party/txt/src/txt/platform_android.cc index e42a25dbf8e38..600d3d5ccfd9e 100644 --- a/third_party/txt/src/txt/platform_android.cc +++ b/third_party/txt/src/txt/platform_android.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/third_party/txt/src/txt/platform_mac.mm b/third_party/txt/src/txt/platform_mac.mm index 9a97e06f099cc..423edddd97c07 100644 --- a/third_party/txt/src/txt/platform_mac.mm +++ b/third_party/txt/src/txt/platform_mac.mm @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/third_party/txt/src/txt/styled_runs.h b/third_party/txt/src/txt/styled_runs.h index 24669e098c2f9..c3707c0c6a35b 100644 --- a/third_party/txt/src/txt/styled_runs.h +++ b/third_party/txt/src/txt/styled_runs.h @@ -79,6 +79,8 @@ class StyledRuns { FRIEND_TEST(ParagraphTest, HyphenBreakParagraph); FRIEND_TEST(ParagraphTest, RepeatLayoutParagraph); FRIEND_TEST(ParagraphTest, Ellipsize); + FRIEND_TEST(ParagraphTest, SimpleShadow); + FRIEND_TEST(ParagraphTest, ComplexShadow); struct IndexedRun { size_t style_index = 0; diff --git a/third_party/txt/src/txt/text_shadow.cc b/third_party/txt/src/txt/text_shadow.cc new file mode 100644 index 0000000000000..f6fb9ffb04e04 --- /dev/null +++ b/third_party/txt/src/txt/text_shadow.cc @@ -0,0 +1,50 @@ +/* + * Copyright 2018 Google, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "text_shadow.h" +#include "third_party/skia/include/core/SkColor.h" + +namespace txt { + +TextShadow::TextShadow() {} +TextShadow::TextShadow(SkColor color, SkPoint offset, double blur_radius) + : color(color), offset(offset), blur_radius(blur_radius) {} + +bool TextShadow::operator==(const TextShadow& other) const { + if (color != other.color) + return false; + if (offset != other.offset) + return false; + if (blur_radius != other.blur_radius) + return false; + + return true; +} + +bool TextShadow::operator!=(const TextShadow& other) const { + return !(*this == other); +} + +bool TextShadow::hasShadow() const { + if (!offset.isZero()) + return true; + if (blur_radius != 0.0) + return true; + + return false; +} + +} // namespace txt diff --git a/third_party/txt/src/txt/text_shadow.h b/third_party/txt/src/txt/text_shadow.h new file mode 100644 index 0000000000000..7904818668318 --- /dev/null +++ b/third_party/txt/src/txt/text_shadow.h @@ -0,0 +1,44 @@ +/* + * Copyright 2018 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LIB_TXT_SRC_TEXT_SHADOW_H_ +#define LIB_TXT_SRC_TEXT_SHADOW_H_ + +#include "third_party/skia/include/core/SkColor.h" +#include "third_party/skia/include/core/SkPoint.h" + +namespace txt { + +class TextShadow { + public: + SkColor color = SK_ColorBLACK; + SkPoint offset; + double blur_radius = 0.0; + + TextShadow(); + + TextShadow(SkColor color, SkPoint offset, double blur_radius); + + bool operator==(const TextShadow& other) const; + + bool operator!=(const TextShadow& other) const; + + bool hasShadow() const; +}; + +} // namespace txt + +#endif // LIB_TXT_SRC_TEXT_SHADOW_H_ diff --git a/third_party/txt/src/txt/text_style.cc b/third_party/txt/src/txt/text_style.cc index abf9cde1b9048..b2da694ef6a4c 100644 --- a/third_party/txt/src/txt/text_style.cc +++ b/third_party/txt/src/txt/text_style.cc @@ -51,6 +51,13 @@ bool TextStyle::equals(const TextStyle& other) const { return false; if (foreground != other.foreground) return false; + if (text_shadows.size() != other.text_shadows.size()) + return false; + for (size_t shadow_index = 0; shadow_index < text_shadows.size(); + ++shadow_index) { + if (text_shadows[shadow_index] != other.text_shadows[shadow_index]) + return false; + } return true; } diff --git a/third_party/txt/src/txt/text_style.h b/third_party/txt/src/txt/text_style.h index 6d91b5862ff19..7b0d351e8fa3f 100644 --- a/third_party/txt/src/txt/text_style.h +++ b/third_party/txt/src/txt/text_style.h @@ -18,11 +18,13 @@ #define LIB_TXT_SRC_TEXT_STYLE_H_ #include +#include #include "font_style.h" #include "font_weight.h" #include "text_baseline.h" #include "text_decoration.h" +#include "text_shadow.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkPaint.h" @@ -51,6 +53,7 @@ class TextStyle { SkPaint background; bool has_foreground = false; SkPaint foreground; + std::vector text_shadows; TextStyle(); diff --git a/third_party/txt/src/txt/typeface_font_asset_provider.cc b/third_party/txt/src/txt/typeface_font_asset_provider.cc index 6a01d20f51d47..4b0ebda5b8109 100644 --- a/third_party/txt/src/txt/typeface_font_asset_provider.cc +++ b/third_party/txt/src/txt/typeface_font_asset_provider.cc @@ -39,7 +39,7 @@ std::string TypefaceFontAssetProvider::GetFamilyName(int index) const { // |FontAssetProvider| SkFontStyleSet* TypefaceFontAssetProvider::MatchFamily( const std::string& family_name) { - auto found = registered_families_.find(family_name); + auto found = registered_families_.find(CanonicalFamilyName(family_name)); if (found == registered_families_.end()) { return nullptr; } @@ -65,12 +65,13 @@ void TypefaceFontAssetProvider::RegisterTypeface( return; } - auto family_it = registered_families_.find(family_name_alias); + std::string canonical_name = CanonicalFamilyName(family_name_alias); + auto family_it = registered_families_.find(canonical_name); if (family_it == registered_families_.end()) { family_names_.push_back(family_name_alias); family_it = registered_families_ .emplace(std::piecewise_construct, - std::forward_as_tuple(family_name_alias), + std::forward_as_tuple(canonical_name), std::forward_as_tuple()) .first; } diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc index 136b7e7886f90..b7589f7e211fd 100644 --- a/third_party/txt/tests/paragraph_unittests.cc +++ b/third_party/txt/tests/paragraph_unittests.cc @@ -892,7 +892,7 @@ TEST_F(ParagraphTest, GetGlyphPositionAtCoordinateParagraph) { text_style.letter_spacing = 1; text_style.word_spacing = 5; text_style.color = SK_ColorBLACK; - text_style.height = 1.5; + text_style.height = 1; builder.PushStyle(text_style); builder.AddText(u16_text); @@ -930,11 +930,11 @@ TEST_F(ParagraphTest, GetGlyphPositionAtCoordinateParagraph) { 18ull); ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(20, -80).position, 1ull); ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(1, 90).position, 18ull); - ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(1, 180).position, 36ull); + ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(1, 170).position, 36ull); ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(10000, 180).position, - 54ull); - ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(70, 180).position, 38ull); - ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(1, 270).position, 54ull); + 72ull); + ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(70, 180).position, 56ull); + ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(1, 270).position, 72ull); ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(35, 90).position, 19ull); ASSERT_EQ(paragraph->GetGlyphPositionAtCoordinate(10000, 10000).position, 77ull); @@ -981,15 +981,20 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(GetRectsForRangeParagraph)) { // Tests for GetRectsForRange() // NOTE: The base truth values may still need adjustment as the specifics // are adjusted. + Paragraph::RectHeightStyle rect_height_style = + Paragraph::RectHeightStyle::kMax; + Paragraph::RectWidthStyle rect_width_style = + Paragraph::RectWidthStyle::kTight; paint.setColor(SK_ColorRED); std::vector boxes = - paragraph->GetRectsForRange(0, 0); + paragraph->GetRectsForRange(0, 0, rect_height_style, rect_width_style); for (size_t i = 0; i < boxes.size(); ++i) { GetCanvas()->drawRect(boxes[i].rect, paint); } EXPECT_EQ(boxes.size(), 0ull); - boxes = paragraph->GetRectsForRange(0, 1); + boxes = + paragraph->GetRectsForRange(0, 1, rect_height_style, rect_width_style); for (size_t i = 0; i < boxes.size(); ++i) { GetCanvas()->drawRect(boxes[i].rect, paint); } @@ -1000,7 +1005,8 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(GetRectsForRangeParagraph)) { EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 59); paint.setColor(SK_ColorBLUE); - boxes = paragraph->GetRectsForRange(2, 8); + boxes = + paragraph->GetRectsForRange(2, 8, rect_height_style, rect_width_style); for (size_t i = 0; i < boxes.size(); ++i) { GetCanvas()->drawRect(boxes[i].rect, paint); } @@ -1011,7 +1017,8 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(GetRectsForRangeParagraph)) { EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 59); paint.setColor(SK_ColorGREEN); - boxes = paragraph->GetRectsForRange(8, 21); + boxes = + paragraph->GetRectsForRange(8, 21, rect_height_style, rect_width_style); for (size_t i = 0; i < boxes.size(); ++i) { GetCanvas()->drawRect(boxes[i].rect, paint); } @@ -1022,7 +1029,8 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(GetRectsForRangeParagraph)) { EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 59); paint.setColor(SK_ColorRED); - boxes = paragraph->GetRectsForRange(30, 100); + boxes = + paragraph->GetRectsForRange(30, 100, rect_height_style, rect_width_style); for (size_t i = 0; i < boxes.size(); ++i) { GetCanvas()->drawRect(boxes[i].rect, paint); } @@ -1040,7 +1048,8 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(GetRectsForRangeParagraph)) { EXPECT_FLOAT_EQ(boxes[3].rect.bottom(), 295); paint.setColor(SK_ColorBLUE); - boxes = paragraph->GetRectsForRange(19, 22); + boxes = + paragraph->GetRectsForRange(19, 22, rect_height_style, rect_width_style); for (size_t i = 0; i < boxes.size(); ++i) { GetCanvas()->drawRect(boxes[i].rect, paint); } @@ -1051,7 +1060,551 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(GetRectsForRangeParagraph)) { EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 59); paint.setColor(SK_ColorRED); - boxes = paragraph->GetRectsForRange(21, 21); + boxes = + paragraph->GetRectsForRange(21, 21, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 0ull); + + ASSERT_TRUE(Snapshot()); +} + +TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(GetRectsForRangeTight)) { + const char* text = + "( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)(" + " ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)(" + " ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)"; + auto icu_text = icu::UnicodeString::fromUTF8(text); + std::u16string u16_text(icu_text.getBuffer(), + icu_text.getBuffer() + icu_text.length()); + + txt::ParagraphStyle paragraph_style; + paragraph_style.max_lines = 10; + paragraph_style.text_align = TextAlign::left; + txt::ParagraphBuilder builder(paragraph_style, GetTestFontCollection()); + + txt::TextStyle text_style; + text_style.font_family = "Noto Sans CJK JP"; + text_style.font_size = 50; + text_style.letter_spacing = 0; + text_style.font_weight = FontWeight::w500; + text_style.word_spacing = 0; + text_style.color = SK_ColorBLACK; + text_style.height = 1; + builder.PushStyle(text_style); + + builder.AddText(u16_text); + + builder.Pop(); + + auto paragraph = builder.Build(); + paragraph->Layout(550); + + paragraph->Paint(GetCanvas(), 0, 0); + + SkPaint paint; + paint.setStyle(SkPaint::kStroke_Style); + paint.setAntiAlias(true); + paint.setStrokeWidth(1); + + // Tests for GetRectsForRange() + // NOTE: The base truth values may still need adjustment as the specifics + // are adjusted. + Paragraph::RectHeightStyle rect_height_style = + Paragraph::RectHeightStyle::kTight; + Paragraph::RectWidthStyle rect_width_style = + Paragraph::RectWidthStyle::kTight; + paint.setColor(SK_ColorRED); + std::vector boxes = + paragraph->GetRectsForRange(0, 0, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 0ull); + + boxes = + paragraph->GetRectsForRange(0, 1, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 1ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 0); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 16.898438); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 74); + + paint.setColor(SK_ColorBLUE); + boxes = + paragraph->GetRectsForRange(2, 8, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 1ull); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 0); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 264.09375); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 74); + + paint.setColor(SK_ColorGREEN); + boxes = + paragraph->GetRectsForRange(8, 21, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 2ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 264.09375); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 0); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 595.08594); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 74); + + ASSERT_TRUE(Snapshot()); +} + +TEST_F(ParagraphTest, + DISABLE_ON_WINDOWS(GetRectsForRangeIncludeLineSpacingMiddle)) { + // const char* text = + // "12345, \"67890\" 12345 67890 12345 67890 12345 67890 12345 67890 + // 12345 " "67890 12345"; + const char* text = + "( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)(" + " ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)(" + " ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)"; + auto icu_text = icu::UnicodeString::fromUTF8(text); + std::u16string u16_text(icu_text.getBuffer(), + icu_text.getBuffer() + icu_text.length()); + + txt::ParagraphStyle paragraph_style; + paragraph_style.max_lines = 10; + paragraph_style.text_align = TextAlign::left; + txt::ParagraphBuilder builder(paragraph_style, GetTestFontCollection()); + + txt::TextStyle text_style; + text_style.font_family = "Roboto"; + text_style.font_size = 50; + text_style.letter_spacing = 0; + text_style.font_weight = FontWeight::w500; + text_style.word_spacing = 0; + text_style.color = SK_ColorBLACK; + text_style.height = 1.3; + builder.PushStyle(text_style); + + builder.AddText(u16_text); + + builder.Pop(); + + auto paragraph = builder.Build(); + paragraph->Layout(550); + + paragraph->Paint(GetCanvas(), 0, 0); + + SkPaint paint; + paint.setStyle(SkPaint::kStroke_Style); + paint.setAntiAlias(true); + paint.setStrokeWidth(1); + + // Tests for GetRectsForRange() + // NOTE: The base truth values may still need adjustment as the specifics + // are adjusted. + Paragraph::RectHeightStyle rect_height_style = + Paragraph::RectHeightStyle::kIncludeLineSpacingMiddle; + Paragraph::RectWidthStyle rect_width_style = Paragraph::RectWidthStyle::kMax; + paint.setColor(SK_ColorRED); + std::vector boxes = + paragraph->GetRectsForRange(0, 0, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 0ull); + + boxes = + paragraph->GetRectsForRange(0, 1, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 1ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 13.744141); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 17.429688); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 82.958008); + + paint.setColor(SK_ColorBLUE); + boxes = + paragraph->GetRectsForRange(2, 8, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 1ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 67.429688); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 13.744141); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 190.00781); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 82.958008); + + paint.setColor(SK_ColorGREEN); + boxes = + paragraph->GetRectsForRange(8, 21, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 1ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 190.00781); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 13.744141); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 508.0625); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 82.958008); + + paint.setColor(SK_ColorRED); + boxes = + paragraph->GetRectsForRange(30, 150, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 8ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 190.00781); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 82.786133); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 525.6875); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 158.95801); + + EXPECT_FLOAT_EQ(boxes[1].rect.left(), 525.6875); + EXPECT_FLOAT_EQ(boxes[1].rect.top(), 82.786133); + EXPECT_FLOAT_EQ(boxes[1].rect.right(), 570.02344); + EXPECT_FLOAT_EQ(boxes[1].rect.bottom(), 158.95801); + + EXPECT_FLOAT_EQ(boxes[2].rect.left(), 0); + EXPECT_FLOAT_EQ(boxes[2].rect.top(), 158.78613); + EXPECT_FLOAT_EQ(boxes[2].rect.right(), 531.57422); + EXPECT_FLOAT_EQ(boxes[2].rect.bottom(), 234.95801); + + EXPECT_FLOAT_EQ(boxes[3].rect.left(), 531.57422); + EXPECT_FLOAT_EQ(boxes[3].rect.top(), 158.78613); + EXPECT_FLOAT_EQ(boxes[3].rect.right(), 570.02344); + EXPECT_FLOAT_EQ(boxes[3].rect.bottom(), 234.95801); + + EXPECT_FLOAT_EQ(boxes[4].rect.left(), 0); + EXPECT_FLOAT_EQ(boxes[4].rect.top(), 234.78613); + EXPECT_FLOAT_EQ(boxes[4].rect.right(), 570.02344); + EXPECT_FLOAT_EQ(boxes[4].rect.bottom(), 310.95801); + + EXPECT_FLOAT_EQ(boxes[5].rect.left(), 0); + EXPECT_FLOAT_EQ(boxes[5].rect.top(), 310.78613); + EXPECT_FLOAT_EQ(boxes[5].rect.right(), 570.02344); + EXPECT_FLOAT_EQ(boxes[5].rect.bottom(), 386.95801); + + paint.setColor(SK_ColorBLUE); + boxes = + paragraph->GetRectsForRange(19, 22, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 1ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 463.72656); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 13.744141); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 530.23047); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 82.958008); + + paint.setColor(SK_ColorRED); + boxes = + paragraph->GetRectsForRange(21, 21, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 0ull); + + ASSERT_TRUE(Snapshot()); +} + +TEST_F(ParagraphTest, + DISABLE_ON_WINDOWS(GetRectsForRangeIncludeLineSpacingTop)) { + // const char* text = + // "12345, \"67890\" 12345 67890 12345 67890 12345 67890 12345 67890 + // 12345 " "67890 12345"; + const char* text = + "( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)(" + " ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)(" + " ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)"; + auto icu_text = icu::UnicodeString::fromUTF8(text); + std::u16string u16_text(icu_text.getBuffer(), + icu_text.getBuffer() + icu_text.length()); + + txt::ParagraphStyle paragraph_style; + paragraph_style.max_lines = 10; + paragraph_style.text_align = TextAlign::left; + txt::ParagraphBuilder builder(paragraph_style, GetTestFontCollection()); + + txt::TextStyle text_style; + text_style.font_family = "Roboto"; + text_style.font_size = 50; + text_style.letter_spacing = 0; + text_style.font_weight = FontWeight::w500; + text_style.word_spacing = 0; + text_style.color = SK_ColorBLACK; + text_style.height = 1.3; + builder.PushStyle(text_style); + + builder.AddText(u16_text); + + builder.Pop(); + + auto paragraph = builder.Build(); + paragraph->Layout(550); + + paragraph->Paint(GetCanvas(), 0, 0); + + SkPaint paint; + paint.setStyle(SkPaint::kStroke_Style); + paint.setAntiAlias(true); + paint.setStrokeWidth(1); + + // Tests for GetRectsForRange() + // NOTE: The base truth values may still need adjustment as the specifics + // are adjusted. + Paragraph::RectHeightStyle rect_height_style = + Paragraph::RectHeightStyle::kIncludeLineSpacingTop; + Paragraph::RectWidthStyle rect_width_style = Paragraph::RectWidthStyle::kMax; + paint.setColor(SK_ColorRED); + std::vector boxes = + paragraph->GetRectsForRange(0, 0, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 0ull); + + boxes = + paragraph->GetRectsForRange(0, 1, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 1ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 13.744141); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 17.429688); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 76); + + paint.setColor(SK_ColorBLUE); + boxes = + paragraph->GetRectsForRange(2, 8, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 1ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 67.429688); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 13.744141); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 190.00781); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 76); + + paint.setColor(SK_ColorGREEN); + boxes = + paragraph->GetRectsForRange(8, 21, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 1ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 190.00781); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 13.744141); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 508.0625); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 76); + + paint.setColor(SK_ColorRED); + boxes = + paragraph->GetRectsForRange(30, 150, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 8ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 190.00781); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 75.828125); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 525.6875); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 152); + + EXPECT_FLOAT_EQ(boxes[1].rect.left(), 525.6875); + EXPECT_FLOAT_EQ(boxes[1].rect.top(), 75.828125); + EXPECT_FLOAT_EQ(boxes[1].rect.right(), 570.02344); + EXPECT_FLOAT_EQ(boxes[1].rect.bottom(), 152); + + EXPECT_FLOAT_EQ(boxes[2].rect.left(), 0); + EXPECT_FLOAT_EQ(boxes[2].rect.top(), 151.82812); + EXPECT_FLOAT_EQ(boxes[2].rect.right(), 531.57422); + EXPECT_FLOAT_EQ(boxes[2].rect.bottom(), 228); + + EXPECT_FLOAT_EQ(boxes[3].rect.left(), 531.57422); + EXPECT_FLOAT_EQ(boxes[3].rect.top(), 151.82812); + EXPECT_FLOAT_EQ(boxes[3].rect.right(), 570.02344); + EXPECT_FLOAT_EQ(boxes[3].rect.bottom(), 228); + + EXPECT_FLOAT_EQ(boxes[4].rect.left(), 0); + EXPECT_FLOAT_EQ(boxes[4].rect.top(), 227.82812); + EXPECT_FLOAT_EQ(boxes[4].rect.right(), 570.02344); + EXPECT_FLOAT_EQ(boxes[4].rect.bottom(), 304); + + EXPECT_FLOAT_EQ(boxes[5].rect.left(), 0); + EXPECT_FLOAT_EQ(boxes[5].rect.top(), 303.82812); + EXPECT_FLOAT_EQ(boxes[5].rect.right(), 570.02344); + EXPECT_FLOAT_EQ(boxes[5].rect.bottom(), 380); + + paint.setColor(SK_ColorBLUE); + boxes = + paragraph->GetRectsForRange(19, 22, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 1ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 463.72656); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 13.744141); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 530.23047); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 76); + + paint.setColor(SK_ColorRED); + boxes = + paragraph->GetRectsForRange(21, 21, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 0ull); + + ASSERT_TRUE(Snapshot()); +} + +TEST_F(ParagraphTest, + DISABLE_ON_WINDOWS(GetRectsForRangeIncludeLineSpacingBottom)) { + // const char* text = + // "12345, \"67890\" 12345 67890 12345 67890 12345 67890 12345 67890 + // 12345 " "67890 12345"; + const char* text = + "( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)(" + " ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)(" + " ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)( ´・‿・`)"; + auto icu_text = icu::UnicodeString::fromUTF8(text); + std::u16string u16_text(icu_text.getBuffer(), + icu_text.getBuffer() + icu_text.length()); + + txt::ParagraphStyle paragraph_style; + paragraph_style.max_lines = 10; + paragraph_style.text_align = TextAlign::left; + txt::ParagraphBuilder builder(paragraph_style, GetTestFontCollection()); + + txt::TextStyle text_style; + text_style.font_family = "Roboto"; + text_style.font_size = 50; + text_style.letter_spacing = 0; + text_style.font_weight = FontWeight::w500; + text_style.word_spacing = 0; + text_style.color = SK_ColorBLACK; + text_style.height = 1.3; + builder.PushStyle(text_style); + + builder.AddText(u16_text); + + builder.Pop(); + + auto paragraph = builder.Build(); + paragraph->Layout(550); + + paragraph->Paint(GetCanvas(), 0, 0); + + SkPaint paint; + paint.setStyle(SkPaint::kStroke_Style); + paint.setAntiAlias(true); + paint.setStrokeWidth(1); + + // Tests for GetRectsForRange() + // NOTE: The base truth values may still need adjustment as the specifics + // are adjusted. + Paragraph::RectHeightStyle rect_height_style = + Paragraph::RectHeightStyle::kIncludeLineSpacingBottom; + Paragraph::RectWidthStyle rect_width_style = Paragraph::RectWidthStyle::kMax; + paint.setColor(SK_ColorRED); + std::vector boxes = + paragraph->GetRectsForRange(0, 0, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 0ull); + + boxes = + paragraph->GetRectsForRange(0, 1, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 1ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 13.744141); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 17.429688); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 89.916016); + + paint.setColor(SK_ColorBLUE); + boxes = + paragraph->GetRectsForRange(2, 8, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 1ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 67.429688); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 13.744141); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 190.00781); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 89.916016); + + paint.setColor(SK_ColorGREEN); + boxes = + paragraph->GetRectsForRange(8, 21, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 1ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 190.00781); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 13.744141); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 508.0625); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 89.916016); + + paint.setColor(SK_ColorRED); + boxes = + paragraph->GetRectsForRange(30, 150, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 8ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 190.00781); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 89.744141); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 525.6875); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 165.91602); + + EXPECT_FLOAT_EQ(boxes[1].rect.left(), 525.6875); + EXPECT_FLOAT_EQ(boxes[1].rect.top(), 89.744141); + EXPECT_FLOAT_EQ(boxes[1].rect.right(), 570.02344); + EXPECT_FLOAT_EQ(boxes[1].rect.bottom(), 165.91602); + + EXPECT_FLOAT_EQ(boxes[2].rect.left(), 0); + EXPECT_FLOAT_EQ(boxes[2].rect.top(), 165.74414); + EXPECT_FLOAT_EQ(boxes[2].rect.right(), 531.57422); + EXPECT_FLOAT_EQ(boxes[2].rect.bottom(), 241.91602); + + EXPECT_FLOAT_EQ(boxes[3].rect.left(), 531.57422); + EXPECT_FLOAT_EQ(boxes[3].rect.top(), 165.74414); + EXPECT_FLOAT_EQ(boxes[3].rect.right(), 570.02344); + EXPECT_FLOAT_EQ(boxes[3].rect.bottom(), 241.91602); + + EXPECT_FLOAT_EQ(boxes[4].rect.left(), 0); + EXPECT_FLOAT_EQ(boxes[4].rect.top(), 241.74414); + EXPECT_FLOAT_EQ(boxes[4].rect.right(), 570.02344); + EXPECT_FLOAT_EQ(boxes[4].rect.bottom(), 317.91602); + + EXPECT_FLOAT_EQ(boxes[5].rect.left(), 0); + EXPECT_FLOAT_EQ(boxes[5].rect.top(), 317.74414); + EXPECT_FLOAT_EQ(boxes[5].rect.right(), 570.02344); + EXPECT_FLOAT_EQ(boxes[5].rect.bottom(), 393.91602); + + paint.setColor(SK_ColorBLUE); + boxes = + paragraph->GetRectsForRange(19, 22, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + EXPECT_EQ(boxes.size(), 1ull); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 463.72656); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 13.744141); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 530.23047); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 89.916016); + + paint.setColor(SK_ColorRED); + boxes = + paragraph->GetRectsForRange(21, 21, rect_height_style, rect_width_style); for (size_t i = 0; i < boxes.size(); ++i) { GetCanvas()->drawRect(boxes[i].rect, paint); } @@ -1063,7 +1616,8 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(GetRectsForRangeParagraph)) { SkRect GetCoordinatesForGlyphPosition(const txt::Paragraph& paragraph, size_t pos) { std::vector boxes = - paragraph.GetRectsForRange(pos, pos + 1); + paragraph.GetRectsForRange(pos, pos + 1, Paragraph::RectHeightStyle::kMax, + Paragraph::RectWidthStyle::kTight); return !boxes.empty() ? boxes.front().rect : SkRect::MakeEmpty(); } @@ -1635,8 +2189,12 @@ TEST_F(ParagraphTest, UnderlineShiftParagraph) { paragraph->records_[1].GetRunWidth(), paragraph2->records_[0].GetRunWidth()); - auto rects1 = paragraph->GetRectsForRange(0, 12); - auto rects2 = paragraph2->GetRectsForRange(0, 12); + auto rects1 = + paragraph->GetRectsForRange(0, 12, Paragraph::RectHeightStyle::kMax, + Paragraph::RectWidthStyle::kTight); + auto rects2 = + paragraph2->GetRectsForRange(0, 12, Paragraph::RectHeightStyle::kMax, + Paragraph::RectWidthStyle::kTight); for (size_t i = 0; i < 12; ++i) { auto r1 = GetCoordinatesForGlyphPosition(*paragraph, i); @@ -1647,4 +2205,165 @@ TEST_F(ParagraphTest, UnderlineShiftParagraph) { } } +TEST_F(ParagraphTest, SimpleShadow) { + const char* text = "Hello World Text Dialog"; + auto icu_text = icu::UnicodeString::fromUTF8(text); + std::u16string u16_text(icu_text.getBuffer(), + icu_text.getBuffer() + icu_text.length()); + + txt::ParagraphStyle paragraph_style; + txt::ParagraphBuilder builder(paragraph_style, GetTestFontCollection()); + + txt::TextStyle text_style; + text_style.font_family = "Roboto"; + text_style.color = SK_ColorBLACK; + text_style.text_shadows.emplace_back(SK_ColorBLACK, SkPoint::Make(2.0, 2.0), + 1.0); + builder.PushStyle(text_style); + builder.AddText(u16_text); + + builder.Pop(); + + auto paragraph = builder.Build(); + paragraph->Layout(GetTestCanvasWidth()); + paragraph->Paint(GetCanvas(), 10.0, 15.0); + + ASSERT_EQ(paragraph->text_.size(), std::string{text}.length()); + for (size_t i = 0; i < u16_text.length(); i++) { + ASSERT_EQ(paragraph->text_[i], u16_text[i]); + } + ASSERT_EQ(paragraph->runs_.runs_.size(), 1ull); + ASSERT_EQ(paragraph->runs_.styles_.size(), 2ull); + ASSERT_TRUE(paragraph->runs_.styles_[1].equals(text_style)); + ASSERT_EQ(paragraph->records_[0].style().color, text_style.color); + + ASSERT_EQ(paragraph->records_[0].style().text_shadows.size(), 1ull); + ASSERT_EQ(paragraph->records_[0].style().text_shadows[0], + text_style.text_shadows[0]); + + ASSERT_TRUE(Snapshot()); +} + +TEST_F(ParagraphTest, ComplexShadow) { + const char* text = "Text Chunk "; + auto icu_text = icu::UnicodeString::fromUTF8(text); + std::u16string u16_text(icu_text.getBuffer(), + icu_text.getBuffer() + icu_text.length()); + + txt::ParagraphStyle paragraph_style; + txt::ParagraphBuilder builder(paragraph_style, GetTestFontCollection()); + + txt::TextStyle text_style; + text_style.font_family = "Roboto"; + text_style.color = SK_ColorBLACK; + text_style.text_shadows.emplace_back(SK_ColorBLACK, SkPoint::Make(2.0, 2.0), + 1.0); + builder.PushStyle(text_style); + builder.AddText(u16_text); + + text_style.text_shadows.emplace_back(SK_ColorRED, SkPoint::Make(2.0, 2.0), + 5.0); + text_style.text_shadows.emplace_back(SK_ColorGREEN, SkPoint::Make(10.0, -5.0), + 3.0); + builder.PushStyle(text_style); + builder.AddText(u16_text); + + builder.Pop(); + builder.AddText(u16_text); + + text_style.text_shadows.emplace_back(SK_ColorGREEN, SkPoint::Make(0.0, -1.0), + 0.0); + builder.PushStyle(text_style); + builder.AddText(u16_text); + + builder.Pop(); + builder.AddText(u16_text); + + builder.Pop(); + + auto paragraph = builder.Build(); + paragraph->Layout(GetTestCanvasWidth()); + paragraph->Paint(GetCanvas(), 10.0, 15.0); + + ASSERT_EQ(paragraph->text_.size(), std::string{text}.length() * 5); + for (size_t i = 0; i < u16_text.length(); i++) { + ASSERT_EQ(paragraph->text_[i], u16_text[i]); + } + + ASSERT_EQ(paragraph->records_[0].style().text_shadows.size(), 1ull); + ASSERT_EQ(paragraph->records_[1].style().text_shadows.size(), 3ull); + ASSERT_EQ(paragraph->records_[2].style().text_shadows.size(), 1ull); + ASSERT_EQ(paragraph->records_[3].style().text_shadows.size(), 4ull); + ASSERT_EQ(paragraph->records_[4].style().text_shadows.size(), 1ull); + for (size_t i = 0; i < 1; ++i) + ASSERT_EQ(paragraph->records_[0].style().text_shadows[i], + text_style.text_shadows[i]); + for (size_t i = 0; i < 3; ++i) + ASSERT_EQ(paragraph->records_[1].style().text_shadows[i], + text_style.text_shadows[i]); + for (size_t i = 0; i < 1; ++i) + ASSERT_EQ(paragraph->records_[2].style().text_shadows[i], + text_style.text_shadows[i]); + for (size_t i = 0; i < 4; ++i) + ASSERT_EQ(paragraph->records_[3].style().text_shadows[i], + text_style.text_shadows[i]); + for (size_t i = 0; i < 1; ++i) + ASSERT_EQ(paragraph->records_[4].style().text_shadows[i], + text_style.text_shadows[i]); + + ASSERT_TRUE(Snapshot()); +} + +TEST_F(ParagraphTest, BaselineParagraph) { + const char* text = + "左線読設Byg後碁給能上目秘使約。満毎冠行来昼本可必図将発確年。今属場育" + "図情闘陰野高備込制詩西校客。審対江置講今固残必託地集済決維駆年策。立得"; + auto icu_text = icu::UnicodeString::fromUTF8(text); + std::u16string u16_text(icu_text.getBuffer(), + icu_text.getBuffer() + icu_text.length()); + + txt::ParagraphStyle paragraph_style; + paragraph_style.max_lines = 14; + paragraph_style.text_align = TextAlign::justify; + paragraph_style.line_height = 1.5; + txt::ParagraphBuilder builder(paragraph_style, GetTestFontCollection()); + + txt::TextStyle text_style; + text_style.color = SK_ColorBLACK; + text_style.font_size = 55; + text_style.letter_spacing = 2; + text_style.font_family = "Source Han Serif CN"; + text_style.decoration_style = txt::TextDecorationStyle::kSolid; + text_style.decoration_color = SK_ColorBLACK; + builder.PushStyle(text_style); + + builder.AddText(u16_text); + + builder.Pop(); + + auto paragraph = builder.Build(); + paragraph->Layout(GetTestCanvasWidth() - 100); + + paragraph->Paint(GetCanvas(), 0, 0); + + SkPaint paint; + paint.setStyle(SkPaint::kStroke_Style); + paint.setAntiAlias(true); + paint.setStrokeWidth(1); + paint.setColor(SK_ColorRED); + GetCanvas()->drawLine(0, paragraph->GetIdeographicBaseline(), + paragraph->GetMaxWidth(), + paragraph->GetIdeographicBaseline(), paint); + + paint.setColor(SK_ColorGREEN); + + GetCanvas()->drawLine(0, paragraph->GetAlphabeticBaseline(), + paragraph->GetMaxWidth(), + paragraph->GetAlphabeticBaseline(), paint); + ASSERT_DOUBLE_EQ(paragraph->GetIdeographicBaseline(), 79.035003662109375); + ASSERT_DOUBLE_EQ(paragraph->GetAlphabeticBaseline(), 63.305000305175781); + + ASSERT_TRUE(Snapshot()); +} + } // namespace txt diff --git a/third_party/txt/third_party/fonts/NotoSansCJK-Regular.ttc b/third_party/txt/third_party/fonts/NotoSansCJK-Regular.ttc new file mode 100755 index 0000000000000..2dd4a60625dbf Binary files /dev/null and b/third_party/txt/third_party/fonts/NotoSansCJK-Regular.ttc differ diff --git a/tools/android_support/VERSION_SUPPORT_V13 b/tools/android_support/VERSION_SUPPORT_FRAGMENT similarity index 100% rename from tools/android_support/VERSION_SUPPORT_V13 rename to tools/android_support/VERSION_SUPPORT_FRAGMENT diff --git a/tools/android_support/download_android_support.py b/tools/android_support/download_android_support.py index 63a73a0bc820d..0a76bc1b4ce61 100644 --- a/tools/android_support/download_android_support.py +++ b/tools/android_support/download_android_support.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2018 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -23,7 +23,7 @@ def GetInstalledVersion(version_stamp): def main(): # Read latest version. - version_stamp = 'VERSION_SUPPORT_V13' + version_stamp = 'VERSION_SUPPORT_FRAGMENT' version = '' with open(os.path.join(THIS_DIR, version_stamp)) as f: version = f.read().strip() @@ -36,7 +36,7 @@ def main(): aar_zip = zipfile.ZipFile(cStringIO.StringIO(aar)) if not os.path.exists(INSTALL_DIR): os.mkdir(INSTALL_DIR) - with open(os.path.join(INSTALL_DIR, 'android_support_v13.jar'), 'w') as f: + with open(os.path.join(INSTALL_DIR, 'android_support_fragment.jar'), 'w') as f: f.write(aar_zip.read('classes.jar')) # Write version as the last step. diff --git a/tools/gen_javadoc.py b/tools/gen_javadoc.py index fbc28a8682e0c..02a0732810b11 100755 --- a/tools/gen_javadoc.py +++ b/tools/gen_javadoc.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2017 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/gen_locale.dart b/tools/gen_locale.dart index 47d256c750858..2ee63adb20155 100644 --- a/tools/gen_locale.dart +++ b/tools/gen_locale.dart @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/tools/gen_objcdoc.sh b/tools/gen_objcdoc.sh index 0f921957e8fd3..3b8e038593f75 100755 --- a/tools/gen_objcdoc.sh +++ b/tools/gen_objcdoc.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Copyright 2017 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/generate_package_files.py b/tools/generate_package_files.py index b32044d272f2f..39dc60d20905d 100644 --- a/tools/generate_package_files.py +++ b/tools/generate_package_files.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2018 The Flutter Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tools/gn b/tools/gn index 62b7214172166..4b4c5960b59af 100755 --- a/tools/gn +++ b/tools/gn @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -110,6 +110,8 @@ def to_gn_args(args): gn_args['use_ios_simulator'] = args.simulator if not args.simulator: aot = True + elif args.target_os is not None: + gn_args['target_os'] = args.target_os else: aot = False @@ -179,6 +181,13 @@ def to_gn_args(args): if args.target_sysroot: gn_args['target_sysroot'] = args.target_sysroot + gn_args['custom_sysroot'] = args.target_sysroot + + if args.target_toolchain: + gn_args['custom_toolchain'] = args.target_toolchain + + if args.target_triple: + gn_args['custom_target_triple'] = args.target_triple if args.toolchain_prefix: gn_args['toolchain_prefix'] = args.toolchain_prefix @@ -206,6 +215,9 @@ def to_gn_args(args): # even with -fPIC everywhere. # gn_args['enable_profiling'] = args.runtime_mode != 'release' and args.android_cpu != 'x86' + if args.arm_float_abi: + gn_args['arm_float_abi'] = args.arm_float_abi + return gn_args def parse_args(args): @@ -225,7 +237,8 @@ def parse_args(args): parser.add_argument('--ios', dest='target_os', action='store_const', const='ios') parser.add_argument('--ios-cpu', type=str, choices=['arm', 'arm64'], default='arm64') parser.add_argument('--simulator', action='store_true', default=False) - parser.add_argument('--linux-cpu', type=str, choices=['x64', 'x86', 'arm64']) + parser.add_argument('--linux-cpu', type=str, choices=['x64', 'x86', 'arm64', 'arm']) + parser.add_argument('--arm-float-abi', type=str, choices=['hard', 'soft', 'softfp']) parser.add_argument('--goma', default=True, action='store_true') parser.add_argument('--no-goma', dest='goma', action='store_false') @@ -237,6 +250,8 @@ def parse_args(args): parser.add_argument('--no-clang', dest='clang', action='store_false') parser.add_argument('--target-sysroot', type=str) + parser.add_argument('--target-toolchain', type=str) + parser.add_argument('--target-triple', type=str) parser.add_argument('--toolchain-prefix', type=str) parser.add_argument('--enable-vulkan', action='store_true', default=False) diff --git a/tools/gn_test.py b/tools/gn_test.py index 7bbc37c014424..f0d671984ddba 100644 --- a/tools/gn_test.py +++ b/tools/gn_test.py @@ -1,4 +1,4 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import unittest diff --git a/tools/licenses/README.md b/tools/licenses/README.md index 805c32f8b4bd0..786e3b8fc728c 100644 --- a/tools/licenses/README.md +++ b/tools/licenses/README.md @@ -3,7 +3,7 @@ ## Apply patch generated by CI If you're not working on a Linux box then you can't auto-generate license files. A workaround is provided via CI. -Your build will fail one or more CI checks if your license files are not correct. Open the failing CI check. In the CI output you will find a patch diff that represents the changes that need to be made to your license files. Copy this patch to a temporary patch file wherever you'd like. Then apply the patch to your repo: +Your build will fail one or more CI checks if your license files are not correct. Open the failing CI check. In the CI output you will find a patch diff that represents the changes that need to be made to your license files. Click `Download full logs` (Github removes lines with only whitespaces, which invalidates the diff). Copy this patch to a temporary patch file wherever you'd like. Then apply the patch to your repo: ``` cd flutter/ci/licenses_golden diff --git a/tools/licenses/analysis_options.yaml b/tools/licenses/analysis_options.yaml index 44a679430a9a3..ffb8ee486a8db 100644 --- a/tools/licenses/analysis_options.yaml +++ b/tools/licenses/analysis_options.yaml @@ -1,8 +1,6 @@ # Specify analysis options. analyzer: - language: - enableSuperMixins: true strong-mode: implicit-dynamic: false errors: diff --git a/tools/licenses/lib/cache.dart b/tools/licenses/lib/cache.dart index 55d3928ab467c..5d55559917fb0 100644 --- a/tools/licenses/lib/cache.dart +++ b/tools/licenses/lib/cache.dart @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/tools/licenses/lib/filesystem.dart b/tools/licenses/lib/filesystem.dart index 4bbcc781f5e4b..49d4978e88b3b 100644 --- a/tools/licenses/lib/filesystem.dart +++ b/tools/licenses/lib/filesystem.dart @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -308,8 +308,7 @@ abstract class TextFile extends File { String readString(); } -// mixin -abstract class UTF8TextFile extends TextFile { +mixin UTF8TextFile implements TextFile { @override String readString() { try { @@ -321,8 +320,7 @@ abstract class UTF8TextFile extends TextFile { } } -// mixin -abstract class Latin1TextFile extends TextFile { +mixin Latin1TextFile implements TextFile { @override String readString() { return cache(new Latin1Of(this), () { @@ -350,8 +348,7 @@ abstract class Directory extends IoNode { // interface abstract class Link extends IoNode { } -// mixin -abstract class ZipFile extends File implements Directory { +mixin ZipFile on File implements Directory { ArchiveDirectory _root; @override @@ -366,8 +363,7 @@ abstract class ZipFile extends File implements Directory { } } -// mixin -abstract class TarFile extends File implements Directory { +mixin TarFile on File implements Directory { ArchiveDirectory _root; @override @@ -382,8 +378,7 @@ abstract class TarFile extends File implements Directory { } } -// mixin -abstract class GZipFile extends File implements Directory { +mixin GZipFile on File implements Directory { InMemoryFile _data; @override @@ -400,8 +395,7 @@ abstract class GZipFile extends File implements Directory { } } -// mixin -abstract class BZip2File extends File implements Directory { +mixin BZip2File on File implements Directory { InMemoryFile _data; @override diff --git a/tools/licenses/lib/licenses.dart b/tools/licenses/lib/licenses.dart index dc457411d6db4..091480ad77662 100644 --- a/tools/licenses/lib/licenses.dart +++ b/tools/licenses/lib/licenses.dart @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/tools/licenses/lib/limits.dart b/tools/licenses/lib/limits.dart index cd3a3cf37d33f..1a796461e237b 100644 --- a/tools/licenses/lib/limits.dart +++ b/tools/licenses/lib/limits.dart @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/tools/licenses/lib/main.dart b/tools/licenses/lib/main.dart index bb256015c0fc8..39aff8a821c0e 100644 --- a/tools/licenses/lib/main.dart +++ b/tools/licenses/lib/main.dart @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,22 +21,22 @@ import 'licenses.dart'; // REPOSITORY OBJECTS -abstract class RepositoryEntry implements Comparable { - RepositoryEntry(this.parent, this.io); - final RepositoryDirectory parent; +abstract class _RepositoryEntry implements Comparable<_RepositoryEntry> { + _RepositoryEntry(this.parent, this.io); + final _RepositoryDirectory parent; final fs.IoNode io; String get name => io.name; String get libraryName; @override - int compareTo(RepositoryEntry other) => toString().compareTo(other.toString()); + int compareTo(_RepositoryEntry other) => toString().compareTo(other.toString()); @override String toString() => io.fullName; } -abstract class RepositoryFile extends RepositoryEntry { - RepositoryFile(RepositoryDirectory parent, fs.File io) : super(parent, io); +abstract class _RepositoryFile extends _RepositoryEntry { + _RepositoryFile(_RepositoryDirectory parent, fs.File io) : super(parent, io); Iterable get licenses; @@ -47,8 +47,8 @@ abstract class RepositoryFile extends RepositoryEntry { fs.File get io => super.io; } -abstract class RepositoryLicensedFile extends RepositoryFile { - RepositoryLicensedFile(RepositoryDirectory parent, fs.File io) : super(parent, io); +abstract class _RepositoryLicensedFile extends _RepositoryFile { + _RepositoryLicensedFile(_RepositoryDirectory parent, fs.File io) : super(parent, io); // file names that we are confident won't be included in the final build product static final RegExp _readmeNamePattern = new RegExp(r'\b_*(?:readme|contributing|patents)_*\b', caseSensitive: false); @@ -69,8 +69,8 @@ abstract class RepositoryLicensedFile extends RepositoryFile { bool get isShellScript => false; } -class RepositorySourceFile extends RepositoryLicensedFile { - RepositorySourceFile(RepositoryDirectory parent, fs.TextFile io) : super(parent, io); +class _RepositorySourceFile extends _RepositoryLicensedFile { + _RepositorySourceFile(_RepositoryDirectory parent, fs.TextFile io) : super(parent, io); @override fs.TextFile get io => super.io; @@ -108,8 +108,8 @@ class RepositorySourceFile extends RepositoryLicensedFile { } } -class RepositoryBinaryFile extends RepositoryLicensedFile { - RepositoryBinaryFile(RepositoryDirectory parent, fs.File io) : super(parent, io); +class _RepositoryBinaryFile extends _RepositoryLicensedFile { + _RepositoryBinaryFile(_RepositoryDirectory parent, fs.File io) : super(parent, io); @override fs.File get io => super.io; @@ -131,8 +131,8 @@ class RepositoryBinaryFile extends RepositoryLicensedFile { // LICENSES -abstract class RepositoryLicenseFile extends RepositoryFile { - RepositoryLicenseFile(RepositoryDirectory parent, fs.File io) : super(parent, io); +abstract class _RepositoryLicenseFile extends _RepositoryFile { + _RepositoryLicenseFile(_RepositoryDirectory parent, fs.File io) : super(parent, io); List licensesFor(String name); License licenseOfType(LicenseType type); @@ -141,8 +141,8 @@ abstract class RepositoryLicenseFile extends RepositoryFile { License get defaultLicense; } -abstract class RepositorySingleLicenseFile extends RepositoryLicenseFile { - RepositorySingleLicenseFile(RepositoryDirectory parent, fs.TextFile io, this.license) +abstract class _RepositorySingleLicenseFile extends _RepositoryLicenseFile { + _RepositorySingleLicenseFile(_RepositoryDirectory parent, fs.TextFile io, this.license) : super(parent, io); final License license; @@ -168,11 +168,11 @@ abstract class RepositorySingleLicenseFile extends RepositoryLicenseFile { Iterable get licenses sync* { yield license; } } -class RepositoryGeneralSingleLicenseFile extends RepositorySingleLicenseFile { - RepositoryGeneralSingleLicenseFile(RepositoryDirectory parent, fs.TextFile io) +class _RepositoryGeneralSingleLicenseFile extends _RepositorySingleLicenseFile { + _RepositoryGeneralSingleLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : super(parent, io, new License.fromBodyAndName(io.readString(), io.name, origin: io.fullName)); - RepositoryGeneralSingleLicenseFile.fromLicense(RepositoryDirectory parent, fs.TextFile io, License license) + _RepositoryGeneralSingleLicenseFile.fromLicense(_RepositoryDirectory parent, fs.TextFile io, License license) : super(parent, io, license); @override @@ -183,8 +183,8 @@ class RepositoryGeneralSingleLicenseFile extends RepositorySingleLicenseFile { } } -class RepositoryApache4DNoticeFile extends RepositorySingleLicenseFile { - RepositoryApache4DNoticeFile(RepositoryDirectory parent, fs.TextFile io) +class _RepositoryApache4DNoticeFile extends _RepositorySingleLicenseFile { + _RepositoryApache4DNoticeFile(_RepositoryDirectory parent, fs.TextFile io) : super(parent, io, _parseLicense(io)); @override @@ -211,8 +211,8 @@ class RepositoryApache4DNoticeFile extends RepositorySingleLicenseFile { } } -class RepositoryLicenseRedirectFile extends RepositorySingleLicenseFile { - RepositoryLicenseRedirectFile(RepositoryDirectory parent, fs.TextFile io, License license) +class _RepositoryLicenseRedirectFile extends _RepositorySingleLicenseFile { + _RepositoryLicenseRedirectFile(_RepositoryDirectory parent, fs.TextFile io, License license) : super(parent, io, license); @override @@ -222,17 +222,17 @@ class RepositoryLicenseRedirectFile extends RepositorySingleLicenseFile { return null; } - static RepositoryLicenseRedirectFile maybeCreateFrom(RepositoryDirectory parent, fs.TextFile io) { + static _RepositoryLicenseRedirectFile maybeCreateFrom(_RepositoryDirectory parent, fs.TextFile io) { String contents = io.readString(); License license = interpretAsRedirectLicense(contents, parent, origin: io.fullName); if (license != null) - return new RepositoryLicenseRedirectFile(parent, io, license); + return new _RepositoryLicenseRedirectFile(parent, io, license); return null; } } -class RepositoryLicenseFileWithLeader extends RepositorySingleLicenseFile { - RepositoryLicenseFileWithLeader(RepositoryDirectory parent, fs.TextFile io, RegExp leader) +class _RepositoryLicenseFileWithLeader extends _RepositorySingleLicenseFile { + _RepositoryLicenseFileWithLeader(_RepositoryDirectory parent, fs.TextFile io, RegExp leader) : super(parent, io, _parseLicense(io, leader)); @override @@ -247,8 +247,8 @@ class RepositoryLicenseFileWithLeader extends RepositorySingleLicenseFile { } } -class RepositoryReadmeIjgFile extends RepositorySingleLicenseFile { - RepositoryReadmeIjgFile(RepositoryDirectory parent, fs.TextFile io) +class _RepositoryReadmeIjgFile extends _RepositorySingleLicenseFile { + _RepositoryReadmeIjgFile(_RepositoryDirectory parent, fs.TextFile io) : super(parent, io, _parseLicense(io)); static final RegExp _pattern = new RegExp( @@ -288,8 +288,8 @@ class RepositoryReadmeIjgFile extends RepositorySingleLicenseFile { } } -class RepositoryDartLicenseFile extends RepositorySingleLicenseFile { - RepositoryDartLicenseFile(RepositoryDirectory parent, fs.TextFile io) +class _RepositoryDartLicenseFile extends _RepositorySingleLicenseFile { + _RepositoryDartLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : super(parent, io, _parseLicense(io)); static final RegExp _pattern = new RegExp( @@ -319,8 +319,8 @@ class RepositoryDartLicenseFile extends RepositorySingleLicenseFile { } } -class RepositoryLibPngLicenseFile extends RepositorySingleLicenseFile { - RepositoryLibPngLicenseFile(RepositoryDirectory parent, fs.TextFile io) +class _RepositoryLibPngLicenseFile extends _RepositorySingleLicenseFile { + _RepositoryLibPngLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : super(parent, io, new License.blank(io.readString(), LicenseType.libpng, origin: io.fullName)) { _verifyLicense(io); } @@ -341,8 +341,8 @@ class RepositoryLibPngLicenseFile extends RepositorySingleLicenseFile { } } -class RepositoryBlankLicenseFile extends RepositorySingleLicenseFile { - RepositoryBlankLicenseFile(RepositoryDirectory parent, fs.TextFile io, String sanityCheck) +class _RepositoryBlankLicenseFile extends _RepositorySingleLicenseFile { + _RepositoryBlankLicenseFile(_RepositoryDirectory parent, fs.TextFile io, String sanityCheck) : super(parent, io, new License.blank(io.readString(), LicenseType.unknown)) { _verifyLicense(io, sanityCheck); } @@ -357,8 +357,8 @@ class RepositoryBlankLicenseFile extends RepositorySingleLicenseFile { License licenseOfType(LicenseType type) => null; } -class RepositoryCatapultApiClientLicenseFile extends RepositorySingleLicenseFile { - RepositoryCatapultApiClientLicenseFile(RepositoryDirectory parent, fs.TextFile io) +class _RepositoryCatapultApiClientLicenseFile extends _RepositorySingleLicenseFile { + _RepositoryCatapultApiClientLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : super(parent, io, _parseLicense(io)); static final RegExp _pattern = new RegExp( @@ -390,8 +390,8 @@ class RepositoryCatapultApiClientLicenseFile extends RepositorySingleLicenseFile } } -class RepositoryCatapultCoverageLicenseFile extends RepositorySingleLicenseFile { - RepositoryCatapultCoverageLicenseFile(RepositoryDirectory parent, fs.TextFile io) +class _RepositoryCatapultCoverageLicenseFile extends _RepositorySingleLicenseFile { + _RepositoryCatapultCoverageLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : super(parent, io, _parseLicense(io)); static final RegExp _pattern = new RegExp( @@ -423,8 +423,8 @@ class RepositoryCatapultCoverageLicenseFile extends RepositorySingleLicenseFile } } -class RepositoryLibJpegTurboLicense extends RepositoryLicenseFile { - RepositoryLibJpegTurboLicense(RepositoryDirectory parent, fs.TextFile io) +class _RepositoryLibJpegTurboLicense extends _RepositoryLicenseFile { + _RepositoryLibJpegTurboLicense(_RepositoryDirectory parent, fs.TextFile io) : super(parent, io) { _parseLicense(io); } @@ -460,10 +460,10 @@ class RepositoryLibJpegTurboLicense extends RepositoryLicenseFile { @override List get licenses { if (_licenses == null) { - final RepositoryReadmeIjgFile readme = parent.getChildByName('README.ijg'); - final RepositorySourceFile main = parent.getChildByName('turbojpeg.c'); - final RepositoryDirectory simd = parent.getChildByName('simd'); - final RepositorySourceFile zlib = simd.getChildByName('jsimdext.inc'); + final _RepositoryReadmeIjgFile readme = parent.getChildByName('README.ijg'); + final _RepositorySourceFile main = parent.getChildByName('turbojpeg.c'); + final _RepositoryDirectory simd = parent.getChildByName('simd'); + final _RepositorySourceFile zlib = simd.getChildByName('jsimdext.inc'); _licenses = []; _licenses.add(readme.license); _licenses.add(main.licenses.single); @@ -491,8 +491,8 @@ class RepositoryLibJpegTurboLicense extends RepositoryLicenseFile { License get defaultLicense => null; } -class RepositoryFreetypeLicenseFile extends RepositoryLicenseFile { - RepositoryFreetypeLicenseFile(RepositoryDirectory parent, fs.TextFile io) +class _RepositoryFreetypeLicenseFile extends _RepositoryLicenseFile { + _RepositoryFreetypeLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : _target = _parseLicense(io), super(parent, io); static final RegExp _pattern = new RegExp( @@ -571,8 +571,8 @@ class RepositoryFreetypeLicenseFile extends RepositoryLicenseFile { Iterable get licenses sync* { } } -class RepositoryIcuLicenseFile extends RepositoryLicenseFile { - RepositoryIcuLicenseFile(RepositoryDirectory parent, fs.TextFile io) +class _RepositoryIcuLicenseFile extends _RepositoryLicenseFile { + _RepositoryIcuLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : _licenses = _parseLicense(io), super(parent, io); @@ -727,8 +727,8 @@ Iterable> splitIntList(List data, int boundary) sync* { yield getOne(); } -class RepositoryMultiLicenseNoticesForFilesFile extends RepositoryLicenseFile { - RepositoryMultiLicenseNoticesForFilesFile(RepositoryDirectory parent, fs.File io) +class _RepositoryMultiLicenseNoticesForFilesFile extends _RepositoryLicenseFile { + _RepositoryMultiLicenseNoticesForFilesFile(_RepositoryDirectory parent, fs.File io) : _licenses = _parseLicense(io), super(parent, io); @@ -809,8 +809,9 @@ class RepositoryMultiLicenseNoticesForFilesFile extends RepositoryLicenseFile { Iterable get licenses => _licenses.values; } -class RepositoryCxxStlDualLicenseFile extends RepositoryLicenseFile { - RepositoryCxxStlDualLicenseFile(RepositoryDirectory parent, fs.TextFile io) +// TODO(goderbauer): use this in https://github.com/flutter/engine/pull/6886. +class _RepositoryCxxStlDualLicenseFile extends _RepositoryLicenseFile { // ignore: unused_element + _RepositoryCxxStlDualLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : _licenses = _parseLicenses(io), super(parent, io); static final RegExp _pattern = new RegExp( @@ -870,21 +871,21 @@ class RepositoryCxxStlDualLicenseFile extends RepositoryLicenseFile { // DIRECTORIES -class RepositoryDirectory extends RepositoryEntry implements LicenseSource { - RepositoryDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io) { +class _RepositoryDirectory extends _RepositoryEntry implements LicenseSource { + _RepositoryDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io) { crawl(); } @override fs.Directory get io => super.io; - final List _subdirectories = []; - final List _files = []; - final List _licenses = []; + final List<_RepositoryDirectory> _subdirectories = <_RepositoryDirectory>[]; + final List<_RepositoryLicensedFile> _files = <_RepositoryLicensedFile>[]; + final List<_RepositoryLicenseFile> _licenses = <_RepositoryLicenseFile>[]; - List get subdirectories => _subdirectories; + List<_RepositoryDirectory> get subdirectories => _subdirectories; - final Map _childrenByName = {}; + final Map _childrenByName = {}; // the bit at the beginning excludes files like "license.py". static final RegExp _licenseNamePattern = new RegExp(r'^(?!.*\.py$)(?!.*(?:no|update)-copyright)(?!.*mh-bsd-gcc).*\b_*(?:license(?!\.html)|copying|copyright|notice|l?gpl|bsd|mpl?|ftl\.txt)_*\b', caseSensitive: false); @@ -894,17 +895,17 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource { if (shouldRecurse(entry)) { assert(!_childrenByName.containsKey(entry.name)); if (entry is fs.Directory) { - RepositoryDirectory child = createSubdirectory(entry); + _RepositoryDirectory child = createSubdirectory(entry); _subdirectories.add(child); _childrenByName[child.name] = child; } else if (entry is fs.File) { try { - RepositoryFile child = createFile(entry); + _RepositoryFile child = createFile(entry); assert(child != null); - if (child is RepositoryLicensedFile) { + if (child is _RepositoryLicensedFile) { _files.add(child); } else { - assert(child is RepositoryLicenseFile); + assert(child is _RepositoryLicenseFile); _licenses.add(child); } _childrenByName[child.name] = child; @@ -918,7 +919,7 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource { } } - for (RepositoryDirectory child in virtualSubdirectories) { + for (_RepositoryDirectory child in virtualSubdirectories) { _subdirectories.add(child); _childrenByName[child.name] = child; } @@ -926,7 +927,7 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource { // Override this to add additional child directories that do not represent a // direct child of this directory's filesystem node. - List get virtualSubdirectories => []; + List<_RepositoryDirectory> get virtualSubdirectories => <_RepositoryDirectory>[]; bool shouldRecurse(fs.IoNode entry) { return entry.name != '.cipd' && @@ -941,38 +942,38 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource { entry.name != 'testing'; } - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'third_party') - return new RepositoryGenericThirdPartyDirectory(this, entry); - return new RepositoryDirectory(this, entry); + return new _RepositoryGenericThirdPartyDirectory(this, entry); + return new _RepositoryDirectory(this, entry); } - RepositoryFile createFile(fs.IoNode entry) { + _RepositoryFile createFile(fs.IoNode entry) { if (entry is fs.TextFile) { - if (RepositoryApache4DNoticeFile.consider(entry)) { - return new RepositoryApache4DNoticeFile(this, entry); + if (_RepositoryApache4DNoticeFile.consider(entry)) { + return new _RepositoryApache4DNoticeFile(this, entry); } else { - RepositoryFile result; + _RepositoryFile result; if (entry.name == 'NOTICE') - result = RepositoryLicenseRedirectFile.maybeCreateFrom(this, entry); + result = _RepositoryLicenseRedirectFile.maybeCreateFrom(this, entry); if (result != null) { return result; } else if (entry.name.contains(_licenseNamePattern)) { - return new RepositoryGeneralSingleLicenseFile(this, entry); + return new _RepositoryGeneralSingleLicenseFile(this, entry); } else if (entry.name == 'README.ijg') { - return new RepositoryReadmeIjgFile(this, entry); + return new _RepositoryReadmeIjgFile(this, entry); } else { - return new RepositorySourceFile(this, entry); + return new _RepositorySourceFile(this, entry); } } } else if (entry.name == 'NOTICE.txt') { - return new RepositoryMultiLicenseNoticesForFilesFile(this, entry); + return new _RepositoryMultiLicenseNoticesForFilesFile(this, entry); } else { - return new RepositoryBinaryFile(this, entry); + return new _RepositoryBinaryFile(this, entry); } } - int get count => _files.length + _subdirectories.fold(0, (int count, RepositoryDirectory child) => count + child.count); + int get count => _files.length + _subdirectories.fold(0, (int count, _RepositoryDirectory child) => count + child.count); @override List nearestLicensesFor(String name) { @@ -983,7 +984,7 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource { } if (_licenses.length == 1) return _licenses.single.licensesFor(name); - List licenses = _licenses.expand/*License*/((RepositoryLicenseFile license) sync* { + List licenses = _licenses.expand/*License*/((_RepositoryLicenseFile license) sync* { List licenses = license.licensesFor(name); if (licenses != null) yield* licenses; @@ -1001,7 +1002,7 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource { License nearestLicenseOfType(LicenseType type) { License result = _nearestAncestorLicenseWithType(type); if (result == null) { - for (RepositoryDirectory directory in _subdirectories) { + for (_RepositoryDirectory directory in _subdirectories) { result = directory._localLicenseWithType(type); if (result != null) break; @@ -1035,7 +1036,7 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource { License _fullWalkDownForLicenseWithType(LicenseType type) { License result = _localLicenseWithType(type); if (result == null) { - for (RepositoryDirectory directory in _subdirectories) { + for (_RepositoryDirectory directory in _subdirectories) { result = directory._fullWalkDownForLicenseWithType(type); if (result != null) break; @@ -1046,7 +1047,7 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource { /// Searches the current directory for licenses of the specified type. License _localLicenseWithType(LicenseType type) { - List licenses = _licenses.expand/*License*/((RepositoryLicenseFile license) sync* { + List licenses = _licenses.expand/*License*/((_RepositoryLicenseFile license) sync* { License result = license.licenseOfType(type); if (result != null) yield result; @@ -1064,7 +1065,7 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource { License nearestLicenseWithName(String name, { String authors }) { License result = _nearestAncestorLicenseWithName(name, authors: authors); if (result == null) { - for (RepositoryDirectory directory in _subdirectories) { + for (_RepositoryDirectory directory in _subdirectories) { result = directory._localLicenseWithName(name, authors: authors); if (result != null) break; @@ -1106,7 +1107,7 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource { License _fullWalkDownForLicenseWithName(String name, { String authors, bool ignoreCase: false }) { License result = _localLicenseWithName(name, authors: authors, ignoreCase: ignoreCase); if (result == null) { - for (RepositoryDirectory directory in _subdirectories) { + for (_RepositoryDirectory directory in _subdirectories) { result = directory._fullWalkDownForLicenseWithName(name, authors: authors, ignoreCase: ignoreCase); if (result != null) break; @@ -1141,11 +1142,11 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource { bool get isLicenseRootException => false; License _localLicenseWithName(String name, { String authors, bool ignoreCase: false }) { - Map map; + Map map; if (ignoreCase) { // we get here if we're trying a last-ditch effort at finding a file. // so this should happen only rarely. - map = new HashMap( + map = new HashMap( equals: (String n1, String n2) => n1.toLowerCase() == n2.toLowerCase(), hashCode: (String n) => n.toLowerCase().hashCode ) @@ -1153,11 +1154,11 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource { } else { map = _childrenByName; } - final RepositoryEntry entry = map[name]; + final _RepositoryEntry entry = map[name]; License license; - if (entry is RepositoryLicensedFile) { + if (entry is _RepositoryLicensedFile) { license = entry.licenses.single; - } else if (entry is RepositoryLicenseFile) { + } else if (entry is _RepositoryLicenseFile) { license = entry.defaultLicense; } else if (entry != null) { if (authors == null) @@ -1170,15 +1171,15 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource { return license; } - RepositoryEntry getChildByName(String name) { + _RepositoryEntry getChildByName(String name) { return _childrenByName[name]; } - Set getLicenses(Progress progress) { + Set getLicenses(_Progress progress) { Set result = new Set(); - for (RepositoryDirectory directory in _subdirectories) + for (_RepositoryDirectory directory in _subdirectories) result.addAll(directory.getLicenses(progress)); - for (RepositoryLicensedFile file in _files) { + for (_RepositoryLicensedFile file in _files) { if (file.isIncludedInBuildProducts) { try { progress.label = '$file'; @@ -1195,35 +1196,35 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource { } } } - for (RepositoryLicenseFile file in _licenses) + for (_RepositoryLicenseFile file in _licenses) result.addAll(file.licenses); return result; } int get fileCount { int result = 0; - for (RepositoryLicensedFile file in _files) { + for (_RepositoryLicensedFile file in _files) { if (file.isIncludedInBuildProducts) result += 1; } - for (RepositoryDirectory directory in _subdirectories) + for (_RepositoryDirectory directory in _subdirectories) result += directory.fileCount; return result; } - Iterable get _signatureFiles sync* { - for (RepositoryLicensedFile file in _files) { + Iterable<_RepositoryLicensedFile> get _signatureFiles sync* { + for (_RepositoryLicensedFile file in _files) { if (file.isIncludedInBuildProducts) yield file; } - for (RepositoryDirectory directory in _subdirectories) { + for (_RepositoryDirectory directory in _subdirectories) { if (directory.includeInSignature) yield* directory._signatureFiles; } } - Stream> _signatureStream(List files) async* { - for (RepositoryLicensedFile file in files) { + Stream> _signatureStream(List<_RepositoryLicensedFile> files) async* { + for (_RepositoryLicensedFile file in files) { yield file.io.fullName.codeUnits; yield file.io.readBytes(); } @@ -1232,8 +1233,8 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource { /// Compute a signature representing a hash of all the licensed files within /// this directory tree. Future get signature async { - List allFiles = _signatureFiles.toList(); - allFiles.sort((RepositoryLicensedFile a, RepositoryLicensedFile b) => + List<_RepositoryLicensedFile> allFiles = _signatureFiles.toList(); + allFiles.sort((_RepositoryLicensedFile a, _RepositoryLicensedFile b) => a.io.fullName.compareTo(b.io.fullName)); crypto.Digest digest = await crypto.md5.bind(_signatureStream(allFiles)).single; return digest.bytes.map((int e) => e.toRadixString(16).padLeft(2, '0')).join(); @@ -1243,15 +1244,15 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource { bool get includeInSignature => true; } -class RepositoryGenericThirdPartyDirectory extends RepositoryDirectory { - RepositoryGenericThirdPartyDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryGenericThirdPartyDirectory extends _RepositoryDirectory { + _RepositoryGenericThirdPartyDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool get subdirectoriesAreLicenseRoots => true; } -class RepositoryReachOutFile extends RepositoryLicensedFile { - RepositoryReachOutFile(RepositoryDirectory parent, fs.File io, this.offset) : super(parent, io); +class _RepositoryReachOutFile extends _RepositoryLicensedFile { + _RepositoryReachOutFile(_RepositoryDirectory parent, fs.File io, this.offset) : super(parent, io); @override fs.File get io => super.io; @@ -1260,7 +1261,7 @@ class RepositoryReachOutFile extends RepositoryLicensedFile { @override List get licenses { - RepositoryDirectory directory = parent; + _RepositoryDirectory directory = parent; int index = offset; while (index > 1) { if (directory == null) @@ -1272,22 +1273,22 @@ class RepositoryReachOutFile extends RepositoryLicensedFile { } } -class RepositoryReachOutDirectory extends RepositoryDirectory { - RepositoryReachOutDirectory(RepositoryDirectory parent, fs.Directory io, this.reachOutFilenames, this.offset) : super(parent, io); +class _RepositoryReachOutDirectory extends _RepositoryDirectory { + _RepositoryReachOutDirectory(_RepositoryDirectory parent, fs.Directory io, this.reachOutFilenames, this.offset) : super(parent, io); final Set reachOutFilenames; final int offset; @override - RepositoryFile createFile(fs.IoNode entry) { + _RepositoryFile createFile(fs.IoNode entry) { if (reachOutFilenames.contains(entry.name)) - return new RepositoryReachOutFile(this, entry, offset); + return new _RepositoryReachOutFile(this, entry, offset); return super.createFile(entry); } } -class RepositoryExcludeSubpathDirectory extends RepositoryDirectory { - RepositoryExcludeSubpathDirectory(RepositoryDirectory parent, fs.Directory io, this.paths, [ this.index = 0 ]) : super(parent, io); +class _RepositoryExcludeSubpathDirectory extends _RepositoryDirectory { + _RepositoryExcludeSubpathDirectory(_RepositoryDirectory parent, fs.Directory io, this.paths, [ this.index = 0 ]) : super(parent, io); final List paths; final int index; @@ -1300,9 +1301,9 @@ class RepositoryExcludeSubpathDirectory extends RepositoryDirectory { } @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == paths[index] && (index < paths.length - 1)) - return new RepositoryExcludeSubpathDirectory(this, entry, paths, index + 1); + return new _RepositoryExcludeSubpathDirectory(this, entry, paths, index + 1); return super.createSubdirectory(entry); } } @@ -1310,276 +1311,8 @@ class RepositoryExcludeSubpathDirectory extends RepositoryDirectory { // WHAT TO CRAWL AND WHAT NOT TO CRAWL -class RepositoryAndroidSdkPlatformsWithJarDirectory extends RepositoryDirectory { - RepositoryAndroidSdkPlatformsWithJarDirectory(RepositoryDirectory parent, fs.Directory io) - : _jarLicense = [new License.fromUrl('http://www.apache.org/licenses/LICENSE-2.0', origin: 'implicit android.jar license')], - super(parent, io); - - final List _jarLicense; - - @override - List nearestLicensesFor(String name) => _jarLicense; - - @override - License nearestLicenseOfType(LicenseType type) { - if (_jarLicense.single.type == type) - return _jarLicense.single; - return null; - } - - @override - License nearestLicenseWithName(String name, { String authors }) { - return null; - } - - @override - bool shouldRecurse(fs.IoNode entry) { - // we only use android.jar from the SDK, everything else we ignore - return entry.name == 'android.jar'; - } -} - -class RepositoryAndroidSdkPlatformsDirectory extends RepositoryDirectory { - RepositoryAndroidSdkPlatformsDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == 'android-22') // chinmay says we only use 22 for the SDK - return new RepositoryAndroidSdkPlatformsWithJarDirectory(this, entry); - throw 'unknown Android SDK version: ${entry.name}'; - } -} - -class RepositoryAndroidSdkDirectory extends RepositoryDirectory { - RepositoryAndroidSdkDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - bool shouldRecurse(fs.IoNode entry) { - // We don't link with any of the Android SDK tools, Google-specific - // packages, system images, samples, etc, when building the engine. We do - // use some (especially those in build-tools/), but it is our understanding - // that nothing from those files actually ends up in our final build output, - // and therefore we don't worry about their licenses. - return entry.name != 'add-ons' - && entry.name != 'build-tools' - && entry.name != 'extras' - && entry.name != 'platform-tools' - && entry.name != 'samples' - && entry.name != 'system-images' - && entry.name != 'tools' - && super.shouldRecurse(entry); - } - - @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == 'platforms') - return new RepositoryAndroidSdkPlatformsDirectory(this, entry); - return super.createSubdirectory(entry); - } -} - -class RepositoryAndroidNdkPlatformsDirectory extends RepositoryDirectory { - RepositoryAndroidNdkPlatformsDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - bool shouldRecurse(fs.IoNode entry) { - if (entry.name == 'android-9' || - entry.name == 'android-12' || - entry.name == 'android-13' || - entry.name == 'android-14' || - entry.name == 'android-15' || - entry.name == 'android-17' || - entry.name == 'android-18' || - entry.name == 'android-19' || - entry.name == 'android-21' || - entry.name == 'android-23' || - entry.name == 'android-24') - return false; - if (entry.name == 'android-16' || // chinmay says we use this for armv7 - entry.name == 'android-22') // chinmay says we use this for everything else - return true; - throw 'unknown Android NDK version: ${entry.name}'; - } -} - -class RepositoryAndroidNdkSourcesAndroidSupportDirectory extends RepositoryDirectory { - RepositoryAndroidNdkSourcesAndroidSupportDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - RepositoryFile createFile(fs.IoNode entry) { - if (entry.name == 'NOTICE' && entry is fs.TextFile) { - return new RepositoryGeneralSingleLicenseFile.fromLicense( - this, - entry, - new License.unique( - entry.readString(), - LicenseType.unknown, - origin: entry.fullName, - yesWeKnowWhatItLooksLikeButItIsNot: true, // lawyer said to include this file verbatim - ) - ); - } - return super.createFile(entry); - } - -} - -class RepositoryAndroidNdkSourcesAndroidDirectory extends RepositoryDirectory { - RepositoryAndroidNdkSourcesAndroidDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - bool shouldRecurse(fs.IoNode entry) { - return entry.name != 'libthread_db' // README in that directory says we aren't using this - && entry.name != 'crazy_linker' // build-time only (not that we use it anyway) - && super.shouldRecurse(entry); - } - - @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == 'support') - return new RepositoryAndroidNdkSourcesAndroidSupportDirectory(this, entry); - return super.createSubdirectory(entry); - } -} - -class RepositoryAndroidNdkSourcesCxxStlSubsubdirectory extends RepositoryDirectory { - RepositoryAndroidNdkSourcesCxxStlSubsubdirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - RepositoryFile createFile(fs.IoNode entry) { - if (entry.name == 'LICENSE.TXT') - return new RepositoryCxxStlDualLicenseFile(this, entry); - return super.createFile(entry); - } -} - -class RepositoryAndroidNdkSourcesCxxStlSubdirectory extends RepositoryDirectory { - RepositoryAndroidNdkSourcesCxxStlSubdirectory(RepositoryDirectory parent, fs.Directory io, this.subdirectoryName) : super(parent, io); - - final String subdirectoryName; - - @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == subdirectoryName) - return new RepositoryAndroidNdkSourcesCxxStlSubsubdirectory(this, entry); - return super.createSubdirectory(entry); - } -} - -class RepositoryAndroidNdkSourcesCxxStlDirectory extends RepositoryDirectory { - RepositoryAndroidNdkSourcesCxxStlDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - bool get subdirectoriesAreLicenseRoots => true; - - @override - bool shouldRecurse(fs.IoNode entry) { - return entry.name != 'gabi++' // abarth says jamesr says we don't use these two - && entry.name != 'stlport' - && super.shouldRecurse(entry); - } - - @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == 'llvm-libc++abi') - return new RepositoryAndroidNdkSourcesCxxStlSubdirectory(this, entry, 'libcxxabi'); - if (entry.name == 'llvm-libc++') - return new RepositoryAndroidNdkSourcesCxxStlSubdirectory(this, entry, 'libcxx'); - return super.createSubdirectory(entry); - } -} - -class RepositoryAndroidNdkSourcesThirdPartyDirectory extends RepositoryGenericThirdPartyDirectory { - RepositoryAndroidNdkSourcesThirdPartyDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - bool shouldRecurse(fs.IoNode entry) { - if (entry.name == 'googletest') - return false; // testing infrastructure, not shipped with flutter engine - if (entry.name == 'shaderc') - return false; // abarth says we don't use any shader stuff - if (entry.name == 'vulkan') - return false; // abath says we do use vulkan so might use this - throw 'unexpected Android NDK third-party package: ${entry.name}'; - } -} - -class RepositoryAndroidNdkSourcesDirectory extends RepositoryDirectory { - RepositoryAndroidNdkSourcesDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == 'android') - return new RepositoryAndroidNdkSourcesAndroidDirectory(this, entry); - if (entry.name == 'cxx-stl') - return new RepositoryAndroidNdkSourcesCxxStlDirectory(this, entry); - if (entry.name == 'third_party') - return new RepositoryAndroidNdkSourcesThirdPartyDirectory(this, entry); - return super.createSubdirectory(entry); - } -} - - -class RepositoryAndroidNdkDirectory extends RepositoryDirectory { - RepositoryAndroidNdkDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - bool shouldRecurse(fs.IoNode entry) { - // we don't link with or use any of the Android NDK samples - return entry.name != 'build' - && entry.name != 'docs' - && entry.name != 'prebuilt' // only used by engine debug builds, which we don't ship - && entry.name != 'samples' - && entry.name != 'tests' - && entry.name != 'toolchains' // only used at build time, doesn't seem to contain anything that gets shipped with the build output - && super.shouldRecurse(entry); - } - - @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == 'platforms') - return new RepositoryAndroidNdkPlatformsDirectory(this, entry); - if (entry.name == 'sources') - return new RepositoryAndroidNdkSourcesDirectory(this, entry); - return super.createSubdirectory(entry); - } -} - -class RepositoryAndroidToolsDirectory extends RepositoryDirectory { - RepositoryAndroidToolsDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - bool get subdirectoriesAreLicenseRoots => true; - - @override - bool shouldRecurse(fs.IoNode entry) { - return entry.name != 'VERSION_LINUX_SDK' - && entry.name != 'VERSION_LINUX_NDK' - && entry.name != 'VERSION_MACOSX_SDK' - && entry.name != 'VERSION_MACOSX_NDK' - && super.shouldRecurse(entry); - } - - @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == 'sdk') - return new RepositoryAndroidSdkDirectory(this, entry); - if (entry.name == 'ndk') - return new RepositoryAndroidNdkDirectory(this, entry); - return super.createSubdirectory(entry); - } - - // This directory's contents are different on each host platform. We assume - // that the components of the Android SDK that are linked into our releases - // are consistent among all host platforms. Given that the host SDK will not - // affect the signature, be sure to force a regeneration of the third_party - // golden licenses if the SDK is ever updated. - @override - bool get includeInSignature => false; -} - -class RepositoryAndroidPlatformDirectory extends RepositoryDirectory { - RepositoryAndroidPlatformDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryAndroidPlatformDirectory extends _RepositoryDirectory { + _RepositoryAndroidPlatformDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool shouldRecurse(fs.IoNode entry) { @@ -1590,8 +1323,8 @@ class RepositoryAndroidPlatformDirectory extends RepositoryDirectory { } } -class RepositoryExpatDirectory extends RepositoryDirectory { - RepositoryExpatDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryExpatDirectory extends _RepositoryDirectory { + _RepositoryExpatDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool get isLicenseRootException => true; @@ -1600,13 +1333,13 @@ class RepositoryExpatDirectory extends RepositoryDirectory { bool get subdirectoriesAreLicenseRoots => true; } -class RepositoryFreetypeDocsDirectory extends RepositoryDirectory { - RepositoryFreetypeDocsDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryFreetypeDocsDirectory extends _RepositoryDirectory { + _RepositoryFreetypeDocsDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override - RepositoryFile createFile(fs.IoNode entry) { + _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'LICENSE.TXT') - return new RepositoryFreetypeLicenseFile(this, entry); + return new _RepositoryFreetypeLicenseFile(this, entry); return super.createFile(entry); } @@ -1614,7 +1347,7 @@ class RepositoryFreetypeDocsDirectory extends RepositoryDirectory { int get fileCount => 0; @override - Set getLicenses(Progress progress) { + Set getLicenses(_Progress progress) { // We don't ship anything in this directory so don't bother looking for licenses there. // However, there are licenses in this directory referenced from elsewhere, so we do // want to crawl it and expose them. @@ -1622,8 +1355,8 @@ class RepositoryFreetypeDocsDirectory extends RepositoryDirectory { } } -class RepositoryFreetypeSrcGZipDirectory extends RepositoryDirectory { - RepositoryFreetypeSrcGZipDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryFreetypeSrcGZipDirectory extends _RepositoryDirectory { + _RepositoryFreetypeSrcGZipDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); // advice was to make this directory's inffixed.h file (which has no license) // use the license in zlib.h. @@ -1648,13 +1381,13 @@ class RepositoryFreetypeSrcGZipDirectory extends RepositoryDirectory { } } -class RepositoryFreetypeSrcDirectory extends RepositoryDirectory { - RepositoryFreetypeSrcDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryFreetypeSrcDirectory extends _RepositoryDirectory { + _RepositoryFreetypeSrcDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'gzip') - return new RepositoryFreetypeSrcGZipDirectory(this, entry); + return new _RepositoryFreetypeSrcGZipDirectory(this, entry); return super.createSubdirectory(entry); } @@ -1665,8 +1398,8 @@ class RepositoryFreetypeSrcDirectory extends RepositoryDirectory { } } -class RepositoryFreetypeDirectory extends RepositoryDirectory { - RepositoryFreetypeDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryFreetypeDirectory extends _RepositoryDirectory { + _RepositoryFreetypeDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override List nearestLicensesFor(String name) { @@ -1697,17 +1430,17 @@ class RepositoryFreetypeDirectory extends RepositoryDirectory { } @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'src') - return new RepositoryFreetypeSrcDirectory(this, entry); + return new _RepositoryFreetypeSrcDirectory(this, entry); if (entry.name == 'docs') - return new RepositoryFreetypeDocsDirectory(this, entry); + return new _RepositoryFreetypeDocsDirectory(this, entry); return super.createSubdirectory(entry); } } -class RepositoryIcuDirectory extends RepositoryDirectory { - RepositoryIcuDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryIcuDirectory extends _RepositoryDirectory { + _RepositoryIcuDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool shouldRecurse(fs.IoNode entry) { @@ -1716,15 +1449,15 @@ class RepositoryIcuDirectory extends RepositoryDirectory { } @override - RepositoryFile createFile(fs.IoNode entry) { + _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'LICENSE') - return new RepositoryIcuLicenseFile(this, entry); + return new _RepositoryIcuLicenseFile(this, entry); return super.createFile(entry); } } -class RepositoryHarfbuzzDirectory extends RepositoryDirectory { - RepositoryHarfbuzzDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryHarfbuzzDirectory extends _RepositoryDirectory { + _RepositoryHarfbuzzDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool shouldRecurse(fs.IoNode entry) { @@ -1733,19 +1466,19 @@ class RepositoryHarfbuzzDirectory extends RepositoryDirectory { } } -class RepositoryJSR305Directory extends RepositoryDirectory { - RepositoryJSR305Directory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryJSR305Directory extends _RepositoryDirectory { + _RepositoryJSR305Directory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'src') - return new RepositoryJSR305SrcDirectory(this, entry); + return new _RepositoryJSR305SrcDirectory(this, entry); return super.createSubdirectory(entry); } } -class RepositoryJSR305SrcDirectory extends RepositoryDirectory { - RepositoryJSR305SrcDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryJSR305SrcDirectory extends _RepositoryDirectory { + _RepositoryJSR305SrcDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool shouldRecurse(fs.IoNode entry) { @@ -1755,26 +1488,26 @@ class RepositoryJSR305SrcDirectory extends RepositoryDirectory { } } -class RepositoryLibJpegDirectory extends RepositoryDirectory { - RepositoryLibJpegDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryLibJpegDirectory extends _RepositoryDirectory { + _RepositoryLibJpegDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override - RepositoryFile createFile(fs.IoNode entry) { + _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'README') - return new RepositoryReadmeIjgFile(this, entry); + return new _RepositoryReadmeIjgFile(this, entry); if (entry.name == 'LICENSE') - return new RepositoryLicenseFileWithLeader(this, entry, new RegExp(r'^\(Copied from the README\.\)\n+-+\n+')); + return new _RepositoryLicenseFileWithLeader(this, entry, new RegExp(r'^\(Copied from the README\.\)\n+-+\n+')); return super.createFile(entry); } } -class RepositoryLibJpegTurboDirectory extends RepositoryDirectory { - RepositoryLibJpegTurboDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryLibJpegTurboDirectory extends _RepositoryDirectory { + _RepositoryLibJpegTurboDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override - RepositoryFile createFile(fs.IoNode entry) { + _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'LICENSE.md') - return new RepositoryLibJpegTurboLicense(this, entry); + return new _RepositoryLibJpegTurboLicense(this, entry); return super.createFile(entry); } @@ -1787,19 +1520,19 @@ class RepositoryLibJpegTurboDirectory extends RepositoryDirectory { } } -class RepositoryLibPngDirectory extends RepositoryDirectory { - RepositoryLibPngDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryLibPngDirectory extends _RepositoryDirectory { + _RepositoryLibPngDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override - RepositoryFile createFile(fs.IoNode entry) { + _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'LICENSE' || entry.name == 'png.h') - return new RepositoryLibPngLicenseFile(this, entry); + return new _RepositoryLibPngLicenseFile(this, entry); return super.createFile(entry); } } -class RepositoryLibWebpDirectory extends RepositoryDirectory { - RepositoryLibWebpDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryLibWebpDirectory extends _RepositoryDirectory { + _RepositoryLibWebpDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool shouldRecurse(fs.IoNode entry) { @@ -1810,19 +1543,19 @@ class RepositoryLibWebpDirectory extends RepositoryDirectory { } } -class RepositoryPkgDirectory extends RepositoryDirectory { - RepositoryPkgDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryPkgDirectory extends _RepositoryDirectory { + _RepositoryPkgDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'when') - return new RepositoryPkgWhenDirectory(this, entry); + return new _RepositoryPkgWhenDirectory(this, entry); return super.createSubdirectory(entry); } } -class RepositoryPkgWhenDirectory extends RepositoryDirectory { - RepositoryPkgWhenDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryPkgWhenDirectory extends _RepositoryDirectory { + _RepositoryPkgWhenDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool shouldRecurse(fs.IoNode entry) { @@ -1831,26 +1564,26 @@ class RepositoryPkgWhenDirectory extends RepositoryDirectory { } } -class RepositorySkiaLibWebPDirectory extends RepositoryDirectory { - RepositorySkiaLibWebPDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositorySkiaLibWebPDirectory extends _RepositoryDirectory { + _RepositorySkiaLibWebPDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'webp') - return new RepositoryReachOutDirectory(this, entry, new Set.from(const ['config.h']), 3); + return new _RepositoryReachOutDirectory(this, entry, new Set.from(const ['config.h']), 3); return super.createSubdirectory(entry); } } -class RepositorySkiaLibSdlDirectory extends RepositoryDirectory { - RepositorySkiaLibSdlDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositorySkiaLibSdlDirectory extends _RepositoryDirectory { + _RepositorySkiaLibSdlDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool get isLicenseRootException => true; } -class RepositorySkiaThirdPartyDirectory extends RepositoryGenericThirdPartyDirectory { - RepositorySkiaThirdPartyDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositorySkiaThirdPartyDirectory extends _RepositoryGenericThirdPartyDirectory { + _RepositorySkiaThirdPartyDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool shouldRecurse(fs.IoNode entry) { @@ -1866,21 +1599,21 @@ class RepositorySkiaThirdPartyDirectory extends RepositoryGenericThirdPartyDirec } @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'ktx') - return new RepositoryReachOutDirectory(this, entry, new Set.from(const ['ktx.h', 'ktx.cpp']), 2); + return new _RepositoryReachOutDirectory(this, entry, new Set.from(const ['ktx.h', 'ktx.cpp']), 2); if (entry.name == 'libmicrohttpd') - return new RepositoryReachOutDirectory(this, entry, new Set.from(const ['MHD_config.h']), 2); + return new _RepositoryReachOutDirectory(this, entry, new Set.from(const ['MHD_config.h']), 2); if (entry.name == 'libwebp') - return new RepositorySkiaLibWebPDirectory(this, entry); + return new _RepositorySkiaLibWebPDirectory(this, entry); if (entry.name == 'libsdl') - return new RepositorySkiaLibSdlDirectory(this, entry); + return new _RepositorySkiaLibSdlDirectory(this, entry); return super.createSubdirectory(entry); } } -class RepositorySkiaDirectory extends RepositoryDirectory { - RepositorySkiaDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositorySkiaDirectory extends _RepositoryDirectory { + _RepositorySkiaDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool shouldRecurse(fs.IoNode entry) { @@ -1891,33 +1624,33 @@ class RepositorySkiaDirectory extends RepositoryDirectory { } @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'third_party') - return new RepositorySkiaThirdPartyDirectory(this, entry); + return new _RepositorySkiaThirdPartyDirectory(this, entry); return super.createSubdirectory(entry); } } -class RepositoryVulkanDirectory extends RepositoryDirectory { - RepositoryVulkanDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryVulkanDirectory extends _RepositoryDirectory { + _RepositoryVulkanDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool shouldRecurse(fs.IoNode entry) { - return entry.name != 'doc' // documentation - && entry.name != 'out' // documentation + // Flutter only uses the headers in the include directory. + return entry.name == 'include' && super.shouldRecurse(entry); } @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'src') - return new RepositoryExcludeSubpathDirectory(this, entry, const ['spec']); + return new _RepositoryExcludeSubpathDirectory(this, entry, const ['spec']); return super.createSubdirectory(entry); } } -class RepositoryRootThirdPartyDirectory extends RepositoryGenericThirdPartyDirectory { - RepositoryRootThirdPartyDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryRootThirdPartyDirectory extends _RepositoryGenericThirdPartyDirectory { + _RepositoryRootThirdPartyDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool shouldRecurse(fs.IoNode entry) { @@ -1945,45 +1678,45 @@ class RepositoryRootThirdPartyDirectory extends RepositoryGenericThirdPartyDirec } @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'android_platform') - return new RepositoryAndroidPlatformDirectory(this, entry); + return new _RepositoryAndroidPlatformDirectory(this, entry); if (entry.name == 'boringssl') - return new RepositoryBoringSSLDirectory(this, entry); + return new _RepositoryBoringSSLDirectory(this, entry); if (entry.name == 'catapult') - return new RepositoryCatapultDirectory(this, entry); + return new _RepositoryCatapultDirectory(this, entry); if (entry.name == 'dart') - return new RepositoryDartDirectory(this, entry); + return new _RepositoryDartDirectory(this, entry); if (entry.name == 'expat') - return new RepositoryExpatDirectory(this, entry); + return new _RepositoryExpatDirectory(this, entry); if (entry.name == 'freetype-android') throw '//third_party/freetype-android is no longer part of this client: remove it'; if (entry.name == 'freetype2') - return new RepositoryFreetypeDirectory(this, entry); + return new _RepositoryFreetypeDirectory(this, entry); if (entry.name == 'harfbuzz') - return new RepositoryHarfbuzzDirectory(this, entry); + return new _RepositoryHarfbuzzDirectory(this, entry); if (entry.name == 'icu') - return new RepositoryIcuDirectory(this, entry); + return new _RepositoryIcuDirectory(this, entry); if (entry.name == 'jsr-305') - return new RepositoryJSR305Directory(this, entry); + return new _RepositoryJSR305Directory(this, entry); if (entry.name == 'libjpeg') - return new RepositoryLibJpegDirectory(this, entry); + return new _RepositoryLibJpegDirectory(this, entry); if (entry.name == 'libjpeg_turbo' || entry.name == 'libjpeg-turbo') - return new RepositoryLibJpegTurboDirectory(this, entry); + return new _RepositoryLibJpegTurboDirectory(this, entry); if (entry.name == 'libpng') - return new RepositoryLibPngDirectory(this, entry); + return new _RepositoryLibPngDirectory(this, entry); if (entry.name == 'libwebp') - return new RepositoryLibWebpDirectory(this, entry); + return new _RepositoryLibWebpDirectory(this, entry); if (entry.name == 'pkg') - return new RepositoryPkgDirectory(this, entry); + return new _RepositoryPkgDirectory(this, entry); if (entry.name == 'vulkan') - return new RepositoryVulkanDirectory(this, entry); + return new _RepositoryVulkanDirectory(this, entry); return super.createSubdirectory(entry); } } -class RepositoryBoringSSLThirdPartyDirectory extends RepositoryDirectory { - RepositoryBoringSSLThirdPartyDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryBoringSSLThirdPartyDirectory extends _RepositoryDirectory { + _RepositoryBoringSSLThirdPartyDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool shouldRecurse(fs.IoNode entry) { @@ -1992,8 +1725,8 @@ class RepositoryBoringSSLThirdPartyDirectory extends RepositoryDirectory { } } -class RepositoryBoringSSLSourceDirectory extends RepositoryDirectory { - RepositoryBoringSSLSourceDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryBoringSSLSourceDirectory extends _RepositoryDirectory { + _RepositoryBoringSSLSourceDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override String get libraryName => 'boringssl'; @@ -2008,16 +1741,16 @@ class RepositoryBoringSSLSourceDirectory extends RepositoryDirectory { } @override - RepositoryFile createFile(fs.IoNode entry) { + _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'LICENSE') - return new RepositoryOpenSSLLicenseFile(this, entry); + return new _RepositoryOpenSSLLicenseFile(this, entry); return super.createFile(entry); } @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'third_party') - return new RepositoryBoringSSLThirdPartyDirectory(this, entry); + return new _RepositoryBoringSSLThirdPartyDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -2029,8 +1762,8 @@ class RepositoryBoringSSLSourceDirectory extends RepositoryDirectory { /// It also has a trailer that mentions licenses that are used during build /// time of BoringSSL - those can be ignored as well since they don't apply /// to code that is distributed. -class RepositoryOpenSSLLicenseFile extends RepositorySingleLicenseFile { - RepositoryOpenSSLLicenseFile(RepositoryDirectory parent, fs.TextFile io) +class _RepositoryOpenSSLLicenseFile extends _RepositorySingleLicenseFile { + _RepositoryOpenSSLLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : super(parent, io, new License.fromBodyAndType( LineSplitter.split(io.readString()) @@ -2056,72 +1789,72 @@ class RepositoryOpenSSLLicenseFile extends RepositorySingleLicenseFile { } } -class RepositoryBoringSSLDirectory extends RepositoryDirectory { - RepositoryBoringSSLDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryBoringSSLDirectory extends _RepositoryDirectory { + _RepositoryBoringSSLDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override - RepositoryFile createFile(fs.IoNode entry) { + _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'README') - return new RepositoryBlankLicenseFile(this, entry, 'This repository contains the files generated by boringssl for its build.'); + return new _RepositoryBlankLicenseFile(this, entry, 'This repository contains the files generated by boringssl for its build.'); return super.createFile(entry); } @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'src') - return new RepositoryBoringSSLSourceDirectory(this, entry); + return new _RepositoryBoringSSLSourceDirectory(this, entry); return super.createSubdirectory(entry); } } -class RepositoryCatapultThirdPartyApiClientDirectory extends RepositoryDirectory { - RepositoryCatapultThirdPartyApiClientDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryCatapultThirdPartyApiClientDirectory extends _RepositoryDirectory { + _RepositoryCatapultThirdPartyApiClientDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override - RepositoryFile createFile(fs.IoNode entry) { + _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'LICENSE') - return new RepositoryCatapultApiClientLicenseFile(this, entry); + return new _RepositoryCatapultApiClientLicenseFile(this, entry); return super.createFile(entry); } } -class RepositoryCatapultThirdPartyCoverageDirectory extends RepositoryDirectory { - RepositoryCatapultThirdPartyCoverageDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryCatapultThirdPartyCoverageDirectory extends _RepositoryDirectory { + _RepositoryCatapultThirdPartyCoverageDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override - RepositoryFile createFile(fs.IoNode entry) { + _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'NOTICE.txt') - return new RepositoryCatapultCoverageLicenseFile(this, entry); + return new _RepositoryCatapultCoverageLicenseFile(this, entry); return super.createFile(entry); } } -class RepositoryCatapultThirdPartyDirectory extends RepositoryDirectory { - RepositoryCatapultThirdPartyDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryCatapultThirdPartyDirectory extends _RepositoryDirectory { + _RepositoryCatapultThirdPartyDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'apiclient') - return new RepositoryCatapultThirdPartyApiClientDirectory(this, entry); + return new _RepositoryCatapultThirdPartyApiClientDirectory(this, entry); if (entry.name == 'coverage') - return new RepositoryCatapultThirdPartyCoverageDirectory(this, entry); + return new _RepositoryCatapultThirdPartyCoverageDirectory(this, entry); return super.createSubdirectory(entry); } } -class RepositoryCatapultDirectory extends RepositoryDirectory { - RepositoryCatapultDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryCatapultDirectory extends _RepositoryDirectory { + _RepositoryCatapultDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'third_party') - return new RepositoryCatapultThirdPartyDirectory(this, entry); + return new _RepositoryCatapultThirdPartyDirectory(this, entry); return super.createSubdirectory(entry); } } -class RepositoryDartRuntimeThirdPartyDirectory extends RepositoryGenericThirdPartyDirectory { - RepositoryDartRuntimeThirdPartyDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryDartRuntimeThirdPartyDirectory extends _RepositoryGenericThirdPartyDirectory { + _RepositoryDartRuntimeThirdPartyDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool shouldRecurse(fs.IoNode entry) { @@ -2131,8 +1864,8 @@ class RepositoryDartRuntimeThirdPartyDirectory extends RepositoryGenericThirdPar } } -class RepositoryDartThirdPartyDirectory extends RepositoryGenericThirdPartyDirectory { - RepositoryDartThirdPartyDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryDartThirdPartyDirectory extends _RepositoryGenericThirdPartyDirectory { + _RepositoryDartThirdPartyDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool shouldRecurse(fs.IoNode entry) { @@ -2146,34 +1879,34 @@ class RepositoryDartThirdPartyDirectory extends RepositoryGenericThirdPartyDirec } @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'boringssl') - return new RepositoryBoringSSLDirectory(this, entry); + return new _RepositoryBoringSSLDirectory(this, entry); return super.createSubdirectory(entry); } } -class RepositoryDartRuntimeDirectory extends RepositoryDirectory { - RepositoryDartRuntimeDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryDartRuntimeDirectory extends _RepositoryDirectory { + _RepositoryDartRuntimeDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'third_party') - return new RepositoryDartRuntimeThirdPartyDirectory(this, entry); + return new _RepositoryDartRuntimeThirdPartyDirectory(this, entry); return super.createSubdirectory(entry); } } -class RepositoryDartDirectory extends RepositoryDirectory { - RepositoryDartDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryDartDirectory extends _RepositoryDirectory { + _RepositoryDartDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool get isLicenseRoot => true; @override - RepositoryFile createFile(fs.IoNode entry) { + _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'LICENSE') - return new RepositoryDartLicenseFile(this, entry); + return new _RepositoryDartLicenseFile(this, entry); return super.createFile(entry); } @@ -2189,17 +1922,17 @@ class RepositoryDartDirectory extends RepositoryDirectory { } @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'third_party') - return new RepositoryDartThirdPartyDirectory(this, entry); + return new _RepositoryDartThirdPartyDirectory(this, entry); if (entry.name == 'runtime') - return new RepositoryDartRuntimeDirectory(this, entry); + return new _RepositoryDartRuntimeDirectory(this, entry); return super.createSubdirectory(entry); } } -class RepositoryFlutterDirectory extends RepositoryDirectory { - RepositoryFlutterDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryFlutterDirectory extends _RepositoryDirectory { + _RepositoryFlutterDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override String get libraryName => 'engine'; @@ -2220,42 +1953,42 @@ class RepositoryFlutterDirectory extends RepositoryDirectory { } @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'sky') - return new RepositoryExcludeSubpathDirectory(this, entry, const ['packages', 'sky_engine', 'LICENSE']); // that's the output of this script! + return new _RepositoryExcludeSubpathDirectory(this, entry, const ['packages', 'sky_engine', 'LICENSE']); // that's the output of this script! if (entry.name == 'third_party') - return new RepositoryFlutterThirdPartyDirectory(this, entry); + return new _RepositoryFlutterThirdPartyDirectory(this, entry); return super.createSubdirectory(entry); } } -class RepositoryFlutterThirdPartyDirectory extends RepositoryDirectory { - RepositoryFlutterThirdPartyDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryFlutterThirdPartyDirectory extends _RepositoryDirectory { + _RepositoryFlutterThirdPartyDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool get subdirectoriesAreLicenseRoots => true; @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'txt') - return new RepositoryFlutterTxtDirectory(this, entry); + return new _RepositoryFlutterTxtDirectory(this, entry); return super.createSubdirectory(entry); } } -class RepositoryFlutterTxtDirectory extends RepositoryDirectory { - RepositoryFlutterTxtDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryFlutterTxtDirectory extends _RepositoryDirectory { + _RepositoryFlutterTxtDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'third_party') - return new RepositoryFlutterTxtThirdPartyDirectory(this, entry); + return new _RepositoryFlutterTxtThirdPartyDirectory(this, entry); return super.createSubdirectory(entry); } } -class RepositoryFlutterTxtThirdPartyDirectory extends RepositoryDirectory { - RepositoryFlutterTxtThirdPartyDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); +class _RepositoryFlutterTxtThirdPartyDirectory extends _RepositoryDirectory { + _RepositoryFlutterTxtThirdPartyDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @override bool shouldRecurse(fs.IoNode entry) { @@ -2263,8 +1996,8 @@ class RepositoryFlutterTxtThirdPartyDirectory extends RepositoryDirectory { } } -class RepositoryRoot extends RepositoryDirectory { - RepositoryRoot(fs.Directory io) : super(null, io); +class _RepositoryRoot extends _RepositoryDirectory { + _RepositoryRoot(fs.Directory io) : super(null, io); @override String get libraryName { @@ -2290,29 +2023,29 @@ class RepositoryRoot extends RepositoryDirectory { } @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { + _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'base') throw '//base is no longer part of this client: remove it'; if (entry.name == 'third_party') - return new RepositoryRootThirdPartyDirectory(this, entry); + return new _RepositoryRootThirdPartyDirectory(this, entry); if (entry.name == 'flutter') - return new RepositoryFlutterDirectory(this, entry); + return new _RepositoryFlutterDirectory(this, entry); return super.createSubdirectory(entry); } @override - List get virtualSubdirectories { + List<_RepositoryDirectory> get virtualSubdirectories { // Skia is updated more frequently than other third party libraries and // is therefore represented as a separate top-level component. fs.Directory thirdPartyNode = io.walk.firstWhere((fs.IoNode node) => node.name == 'third_party'); fs.IoNode skiaNode = thirdPartyNode.walk.firstWhere((fs.IoNode node) => node.name == 'skia'); - return [new RepositorySkiaDirectory(this, skiaNode)]; + return <_RepositoryDirectory>[new _RepositorySkiaDirectory(this, skiaNode)]; } } -class Progress { - Progress(this.max) { +class _Progress { + _Progress(this.max) { // This may happen when a git client contains left-over empty component // directories after DEPS file changes. if (max <= 0) @@ -2400,11 +2133,11 @@ Future main(List arguments) async { try { system.stderr.writeln('Finding files...'); fs.FileSystemDirectory rootDirectory = new fs.FileSystemDirectory.fromPath(argResults['src']); - final RepositoryDirectory root = new RepositoryRoot(rootDirectory); + final _RepositoryDirectory root = new _RepositoryRoot(rootDirectory); if (releaseMode) { system.stderr.writeln('Collecting licenses...'); - Progress progress = new Progress(root.fileCount); + _Progress progress = new _Progress(root.fileCount); List licenses = new Set.from(root.getLicenses(progress).toList()).toList(); if (progress.hadErrors) throw 'Had failures while collecting licenses.'; @@ -2423,8 +2156,9 @@ Future main(List arguments) async { } else { RegExp signaturePattern = new RegExp(r'Signature: (\w+)'); + final List usedGoldens = []; bool isFirstComponent = true; - for (RepositoryDirectory component in root.subdirectories) { + for (_RepositoryDirectory component in root.subdirectories) { system.stderr.writeln('Collecting licenses for ${component.io.name}'); String signature; @@ -2441,10 +2175,11 @@ Future main(List arguments) async { // Check whether the golden file matches the signature of the current contents // of this directory. try { - system.File goldenFile = new system.File( - path.join(argResults['golden'], 'licenses_${component.io.name}')); + final String goldenFileName = 'licenses_${component.io.name}'; + system.File goldenFile = new system.File(path.join(argResults['golden'], goldenFileName)); String goldenSignature = await goldenFile.openRead() .transform(utf8.decoder).transform(new LineSplitter()).first; + usedGoldens.add(goldenFileName); Match goldenMatch = signaturePattern.matchAsPrefix(goldenSignature); if (goldenMatch != null && goldenMatch.group(1) == signature) { system.stderr.writeln(' Skipping this component - no change in signature'); @@ -2454,7 +2189,7 @@ Future main(List arguments) async { system.stderr.writeln(' Failed to read signature file, scanning directory.'); } - Progress progress = new Progress(component.fileCount); + _Progress progress = new _Progress(component.fileCount); system.File outFile = new system.File( path.join(argResults['out'], 'licenses_${component.name}')); @@ -2462,7 +2197,7 @@ Future main(List arguments) async { if (signature != null) sink.writeln('Signature: $signature\n'); - RepositoryDirectory componentRoot; + _RepositoryDirectory componentRoot; if (isFirstComponent) { // For the first component, we can use the results of the initial // repository crawl. @@ -2472,8 +2207,8 @@ Future main(List arguments) async { // For other components, we need a clean repository that does not // contain any state left over from previous components. clearLicenseRegistry(); - componentRoot = new RepositoryRoot(rootDirectory).subdirectories.firstWhere( - (RepositoryDirectory dir) => dir.name == component.name + componentRoot = new _RepositoryRoot(rootDirectory).subdirectories.firstWhere( + (_RepositoryDirectory dir) => dir.name == component.name ); } List licenses = new Set.from( @@ -2500,6 +2235,14 @@ Future main(List arguments) async { progress.flush(); system.stderr.writeln(''); } + + final Set unusedGoldens = system.Directory(argResults['golden']).listSync().map((system.FileSystemEntity file) => path.basename(file.path)).toSet() + ..removeAll(usedGoldens); + if (unusedGoldens.isNotEmpty) { + system.stderr.writeln('The following golden files in ${argResults['golden']} are unused and need to be deleted:'); + unusedGoldens.map((String s) => ' * $s').forEach(system.stderr.writeln); + system.exit(1); + } } } catch (e, stack) { system.stderr.writeln('failure: $e\n$stack'); diff --git a/tools/licenses/lib/patterns.dart b/tools/licenses/lib/patterns.dart index 1f6be57254990..dde04c5438e7f 100644 --- a/tools/licenses/lib/patterns.dart +++ b/tools/licenses/lib/patterns.dart @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/BUILD.gn b/vulkan/BUILD.gn index 2c021229456fa..e5412a6431a21 100644 --- a/vulkan/BUILD.gn +++ b/vulkan/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -60,12 +60,10 @@ source_set("vulkan") { deps = [ "$flutter_root/fml", "//third_party/skia", - "//third_party/skia:gpu", ] public_configs = [ ":vulkan_config", "$flutter_root:config", - "//third_party/skia:skia_private", ] } diff --git a/vulkan/skia_vulkan_header.h b/vulkan/skia_vulkan_header.h index e3f36ff0f96a8..7af41d7b5ec29 100644 --- a/vulkan/skia_vulkan_header.h +++ b/vulkan/skia_vulkan_header.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_application.cc b/vulkan/vulkan_application.cc index 7bc8d8f16f8fe..87c194ad7ee70 100644 --- a/vulkan/vulkan_application.cc +++ b/vulkan/vulkan_application.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_application.h b/vulkan/vulkan_application.h index 82a1bbbf61b4e..fd2e7994efd93 100644 --- a/vulkan/vulkan_application.h +++ b/vulkan/vulkan_application.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_backbuffer.cc b/vulkan/vulkan_backbuffer.cc index 5943534063fda..e61045eaa8ad9 100644 --- a/vulkan/vulkan_backbuffer.cc +++ b/vulkan/vulkan_backbuffer.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_backbuffer.h b/vulkan/vulkan_backbuffer.h index 3de06f76af89f..b6cdac62b89b3 100644 --- a/vulkan/vulkan_backbuffer.h +++ b/vulkan/vulkan_backbuffer.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_command_buffer.cc b/vulkan/vulkan_command_buffer.cc index 899963d9f204d..09ccf0e975805 100644 --- a/vulkan/vulkan_command_buffer.cc +++ b/vulkan/vulkan_command_buffer.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_command_buffer.h b/vulkan/vulkan_command_buffer.h index f336a077ff308..bad0be185cfbf 100644 --- a/vulkan/vulkan_command_buffer.h +++ b/vulkan/vulkan_command_buffer.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_debug_report.cc b/vulkan/vulkan_debug_report.cc index 96e32de8ac566..bd8f36ff46f2d 100644 --- a/vulkan/vulkan_debug_report.cc +++ b/vulkan/vulkan_debug_report.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_debug_report.h b/vulkan/vulkan_debug_report.h index 31e1b548a3e02..aa71f8cb4cd4a 100644 --- a/vulkan/vulkan_debug_report.h +++ b/vulkan/vulkan_debug_report.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_device.cc b/vulkan/vulkan_device.cc index 1cb7fc41b4d7f..50688c1bac16a 100644 --- a/vulkan/vulkan_device.cc +++ b/vulkan/vulkan_device.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_device.h b/vulkan/vulkan_device.h index d48b02934a90f..f050fb889c7a7 100644 --- a/vulkan/vulkan_device.h +++ b/vulkan/vulkan_device.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_handle.cc b/vulkan/vulkan_handle.cc index 2b6e3def3f10d..eb15d9ff13147 100644 --- a/vulkan/vulkan_handle.cc +++ b/vulkan/vulkan_handle.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_handle.h b/vulkan/vulkan_handle.h index 60be8a5f19fec..a829d0d10f6b7 100644 --- a/vulkan/vulkan_handle.h +++ b/vulkan/vulkan_handle.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_image.cc b/vulkan/vulkan_image.cc index 2dfb2cdc83d1f..492f9f310336a 100644 --- a/vulkan/vulkan_image.cc +++ b/vulkan/vulkan_image.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_image.h b/vulkan/vulkan_image.h index 0ab5463154973..ac4690b8ca589 100644 --- a/vulkan/vulkan_image.h +++ b/vulkan/vulkan_image.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_interface.cc b/vulkan/vulkan_interface.cc index f5cadf22dddfa..56cb828e9db04 100644 --- a/vulkan/vulkan_interface.cc +++ b/vulkan/vulkan_interface.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -62,30 +62,14 @@ std::string VulkanResultToString(VkResult result) { return "VK_RESULT_RANGE_SIZE"; case VK_RESULT_MAX_ENUM: return "VK_RESULT_MAX_ENUM"; - -#if VK_HEADER_VERSION >= 63 - case VK_ERROR_NOT_PERMITTED_EXT: - return "VK_ERROR_NOT_PERMITTED_EXT"; -#endif - -#if VK_HEADER_VERSION >= 72 - case VK_ERROR_FRAGMENTATION_EXT: - return "VK_ERROR_FRAGMENTATION_EXT"; -#endif - -#if OS_FUCHSIA -#if VK_KHR_external_memory - case VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR: - return "VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR"; -#elif VK_KHX_external_memory - case VK_ERROR_INVALID_EXTERNAL_HANDLE_KHX: - return "VK_ERROR_INVALID_EXTERNAL_HANDLE_KHX"; -#endif - case VK_ERROR_OUT_OF_POOL_MEMORY_KHR: - return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR"; -#endif + case VK_ERROR_INVALID_EXTERNAL_HANDLE: + return "VK_ERROR_INVALID_EXTERNAL_HANDLE"; + case VK_ERROR_OUT_OF_POOL_MEMORY: + return "VK_ERROR_OUT_OF_POOL_MEMORY"; + default: + return "Unknown Error"; } - return "Unknown Error"; + return ""; } } // namespace vulkan diff --git a/vulkan/vulkan_interface.h b/vulkan/vulkan_interface.h index f96b99eb8cb9c..6934ec97925eb 100644 --- a/vulkan/vulkan_interface.h +++ b/vulkan/vulkan_interface.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_native_surface.cc b/vulkan/vulkan_native_surface.cc index e05cfb1fc14bd..e85023208344e 100644 --- a/vulkan/vulkan_native_surface.cc +++ b/vulkan/vulkan_native_surface.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_native_surface.h b/vulkan/vulkan_native_surface.h index e66bf01d030a1..0cf3c33fa5431 100644 --- a/vulkan/vulkan_native_surface.h +++ b/vulkan/vulkan_native_surface.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_native_surface_android.cc b/vulkan/vulkan_native_surface_android.cc index f635f60b7d9ff..ba36e9f17fcff 100644 --- a/vulkan/vulkan_native_surface_android.cc +++ b/vulkan/vulkan_native_surface_android.cc @@ -1,9 +1,11 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "flutter/vulkan/vulkan_native_surface_android.h" +#include + #include "third_party/skia/include/gpu/vk/GrVkBackendContext.h" namespace vulkan { diff --git a/vulkan/vulkan_native_surface_android.h b/vulkan/vulkan_native_surface_android.h index bd327d345ca77..9628eb5252925 100644 --- a/vulkan/vulkan_native_surface_android.h +++ b/vulkan/vulkan_native_surface_android.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_native_surface_magma.cc b/vulkan/vulkan_native_surface_magma.cc index e654594355f77..61c12d8d2d0ac 100644 --- a/vulkan/vulkan_native_surface_magma.cc +++ b/vulkan/vulkan_native_surface_magma.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_native_surface_magma.h b/vulkan/vulkan_native_surface_magma.h index 87373289a834d..1f3bbfe2f09f2 100644 --- a/vulkan/vulkan_native_surface_magma.h +++ b/vulkan/vulkan_native_surface_magma.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_proc_table.cc b/vulkan/vulkan_proc_table.cc index bab2b9b54962d..50d25b44263ef 100644 --- a/vulkan/vulkan_proc_table.cc +++ b/vulkan/vulkan_proc_table.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_proc_table.h b/vulkan/vulkan_proc_table.h index 54986a71a7138..12d4b5beb9b03 100644 --- a/vulkan/vulkan_proc_table.h +++ b/vulkan/vulkan_proc_table.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_provider.cc b/vulkan/vulkan_provider.cc index 1128d23ec0257..4b8cb5433e622 100644 --- a/vulkan/vulkan_provider.cc +++ b/vulkan/vulkan_provider.cc @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_provider.h b/vulkan/vulkan_provider.h index 041b5b2a9de75..eca43f53a0a3b 100644 --- a/vulkan/vulkan_provider.h +++ b/vulkan/vulkan_provider.h @@ -1,4 +1,4 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_surface.cc b/vulkan/vulkan_surface.cc index 286438d0a3f5e..21224724d4f29 100644 --- a/vulkan/vulkan_surface.cc +++ b/vulkan/vulkan_surface.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_surface.h b/vulkan/vulkan_surface.h index 81dd7cdfb7278..c1be63ed0ce71 100644 --- a/vulkan/vulkan_surface.h +++ b/vulkan/vulkan_surface.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_swapchain.cc b/vulkan/vulkan_swapchain.cc index 595614760aa1d..c69e9d263f7d0 100644 --- a/vulkan/vulkan_swapchain.cc +++ b/vulkan/vulkan_swapchain.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_swapchain.h b/vulkan/vulkan_swapchain.h index 49b0e66cefbd9..e85eede05fc97 100644 --- a/vulkan/vulkan_swapchain.h +++ b/vulkan/vulkan_swapchain.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_utilities.cc b/vulkan/vulkan_utilities.cc index 4bce8e7a91d7a..6d952777a6cfd 100644 --- a/vulkan/vulkan_utilities.cc +++ b/vulkan/vulkan_utilities.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_utilities.h b/vulkan/vulkan_utilities.h index ab3d52b4cc207..2e071075a2671 100644 --- a/vulkan/vulkan_utilities.h +++ b/vulkan/vulkan_utilities.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_window.cc b/vulkan/vulkan_window.cc index 43a4f3b000650..44ef7f4a22723 100644 --- a/vulkan/vulkan_window.cc +++ b/vulkan/vulkan_window.cc @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/vulkan/vulkan_window.h b/vulkan/vulkan_window.h index b205762079c8a..ade09d57ac765 100644 --- a/vulkan/vulkan_window.h +++ b/vulkan/vulkan_window.h @@ -1,4 +1,4 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file.